|
66590
|
NULL
|
0
|
2026-04-21T14:48:30.604250+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776782910604_m1.jpg...
|
PhpStorm
|
faVsco.js – AutomatedReportsService.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsRepositoryTest
Run 'AutomatedReportsRepositoryTest'
Debug 'AutomatedReportsRepositoryTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
3
102
3
34
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Kiosk\AutomatedReports;
use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Carbon\Exceptions\InvalidFormatException;
use DateTime;
use DateTimeInterface;
use DateTimeZone;
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcher;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Jiminny\Component\ActivitySearch\FilterDefinition\InputTypeEnum;
use Jiminny\Component\AskAnything\AskAnythingPromptService;
use Jiminny\Component\AskAnything\Dtos\AskAnythingPromptDto;
use Jiminny\Component\UrlGenerator\Webhook;
use Jiminny\Contracts\Repositories\PlaybookCategoryRepository;
use Jiminny\Contracts\Repositories\TeamRepository;
use Jiminny\Contracts\Repositories\UserRepository;
use Jiminny\Exceptions\ApplicationException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Exceptions\ModelNotFoundException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateReportJob;
use Jiminny\Models\Activity\Search;
use Jiminny\Models\AskAnything\AskAnythingPrompt;
use Jiminny\Models\AskAnything\AskAnythingPromptTarget;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Contracts\UserContract;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AskAnythingRepository;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Repositories\GroupRepository;
use Jiminny\Repositories\SearchRepository;
use Jiminny\Repositories\StageRepository;
use Throwable;
class AutomatedReportsService
{
public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';
public const string TYPE_ASK_JIMINNY = 'ask_jiminny';
/**
* Standard report types (used by kiosk for existing automated reports).
*/
// @TODO this will add filter, however if we need to control feature by FF we need conditional logic
public const array TYPES = [
['id' => 'exec_summary', 'name' => 'Exec Summary'],
['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],
['id' => 'product_feedback', 'name' => 'Product Feedback'],
['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],
// ['id' => 'questions', 'name' => 'Questions'],
// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],
];
public const array ALL_TYPES = [
...self::TYPES,
['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],
];
public const string FREQUENCY_DAILY = 'daily';
public const string FREQUENCY_WEEKLY = 'weekly';
public const string FREQUENCY_MONTHLY = 'monthly';
public const string FREQUENCY_QUARTERLY = 'quarterly';
public const string FREQUENCY_ONE_OFF = 'one_off';
/**
* Frequencies for standard (non-Ask Jiminny) reports.
*/
public const array FREQUENCIES = [
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
/**
* Frequencies for Ask Jiminny reports.
*/
public const array ASK_JIMINNY_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
];
public const string MEDIA_TYPE_PDF = 'pdf';
public const string MEDIA_TYPE_PODCAST = 'podcast';
public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];
public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];
public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];
public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];
public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];
public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];
public const int SENT_REPORT_AT_HOURS = 5;
public const string PDF_KEY = 'pdf';
public const string AUDIO_KEY = 'audio';
private const array ALL_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
private const string S3_DIR = 'reports';
private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];
private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];
public function __construct(
private readonly TeamRepository $teamRepository,
private readonly GroupRepository $groupRepository,
private readonly UserRepository $userRepository,
private readonly StageRepository $stageRepository,
private readonly DealStagesService $dealStagesService,
private readonly RecipientsService $recipientsService,
private readonly AutomatedReportsRepository $automatedReportsRepository,
private readonly Webhook $webhookService,
private readonly BusDispatcher $dispatcher,
private readonly ActivityTypeService $activityTypeService,
private readonly PlaybookCategoryRepository $playbookCategoryRepository,
private readonly AskAnythingPromptService $askAnythingPromptService,
private readonly SearchRepository $activitySearchRepository,
private readonly AskAnythingRepository $askAnythingRepository,
) {
}
public static function getTypes(): array
{
$types = self::TYPES;
return array_map(static function ($type) {
return $type['id'];
}, $types);
}
public static function getCallTypes(): array
{
return array_map(static function ($callType) {
return $callType['id'];
}, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);
}
public static function getFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::FREQUENCIES);
}
// front-facing structure
public function getReportEnabledFieldData(bool $value = false): array
{
return [
'id' => 'report_enabled',
'label' => '',
'inputType' => InputTypeEnum::TOGGLE,
'value' => $value,
];
}
// Organizations = Teams
public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array
{
$options = $this->getTeams();
if ($shortVersion) {
return [
'id' => 'organization',
'label' => 'Organization',
'options' => $options,
];
}
return [
'id' => 'organization',
'label' => 'Organization',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $options,
'value' => $value,
'dependencies' => [
'teams',
'deal_stage_at_call',
'current_deal_stage',
'recipients',
ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,
],
'dependsOn' => [],
];
}
// Teams = Groups
public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array
{
if ($shortVersion) {
return [
'id' => 'teams',
'label' => 'Team',
'options' => $options,
];
}
return [
'id' => 'teams',
'label' => 'Team',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => false,
'placeholder' => 'Select',
'options' => $options,
'value' => $value, // value should be an array of objects {id, name}
'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],
'dependsOn' => [],
];
}
public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array
{
$types = [];
if ($team instanceof Team) {
if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
$types = self::TYPES;
}
if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {
$types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];
}
} else {
$types = self::TYPES;
}
if ($shortVersion) {
return [
'id' => 'report_type',
'label' => 'Report Type',
'options' => $types,
];
}
return [
'id' => 'report_type',
'label' => 'Report Type',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $types,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getFrequencyFieldData(?string $value = null): array
{
return [
'id' => 'frequency',
'label' => 'Frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => self::FREQUENCIES,
'value' => $value,
'dependencies' => ['period'],
'dependsOn' => [],
];
}
public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array
{
return [
'id' => 'period',
'label' => 'Select one-off period',
'inputType' => InputTypeEnum::DATE_RANGE,
'required' => true,
'placeholder' => 'Select',
'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],
'queryParams' => [
'startDate' => 'start_date_period',
'endDate' => 'end_date_period',
],
'dependencies' => [],
'dependsOn' => ['frequency'],
];
}
public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array
{
return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);
}
public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);
}
public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);
}
public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'deal_value',
'label' => 'Deal Value',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_deal_value',
'max' => 'max_deal_value',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array
{
$value = [];
$conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;
$dialerOn && $value[] = self::CALL_TYPE_DIALER;
return [
'id' => 'call_type',
'label' => 'Call Type',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => [
self::CALL_TYPE_CONFERENCE,
self::CALL_TYPE_DIALER,
],
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getMediaTypeFieldData(?AutomatedReport $report = null): array
{
$value = [];
if ($report) {
$value = $this->transformMediaTypes($report);
}
return [
'id' => 'media_types',
'label' => 'Export as',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => self::MEDIA_TYPE_OBJECTS,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'call_duration',
'label' => 'Call Duration',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_call_duration',
'max' => 'max_call_duration',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getRecipientsFieldData(?Team $team = null, array $value = []): array
{
return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);
}
public function getJiminnyRecipientsFieldData(array $value = []): array
{
return $this->recipientsService->getJiminnyRecipientsFieldData($value);
}
public function getAdditionalPromptInputFieldData(?string $value = null): array
{
return [
'id' => 'additional_prompt_input',
'label' => 'Special requirements',
'inputType' => InputTypeEnum::TEXTAREA,
'required' => false,
'placeholder' => 'What should be the focus of the report?',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCustomReportNameFieldData(?string $value = null): array
{
return [
'id' => 'custom_name',
'label' => 'Custom report name',
'inputType' => InputTypeEnum::TEXT,
'required' => false,
'placeholder' => 'Enter custom name',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
// data providers
public function getTeams(): array
{
$teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);
$teamData = [];
foreach ($teams as $team) {
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
continue;
}
$teamData[] = $this->transformTeam($team);
}
return $teamData;
}
public function getTeamGroups(string $teamUuid): array
{
$data = [];
$team = $this->getTeam($teamUuid);
if ($team !== null) {
$groups = $team->groups()->get();
foreach ($groups as $group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
];
}
}
return $data;
}
public function getTeamsGroupsOptions(array $filterTeamUuids = []): array
{
$data = [];
$teams = $this->getTeams();
foreach ($teams as $team) {
if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {
continue;
}
$data[] = [
'label' => $team['name'],
'groups' => $this->getTeamGroups($team['id']),
];
}
return $data;
}
public function getTeam(string $teamUuid): ?Team
{
return $this->teamRepository->idOrUuid($teamUuid);
}
public function getTeamById(int $teamId): ?Team
{
return $this->teamRepository->find($teamId);
}
public function getGroupsUuids(AutomatedReport $report): array
{
$uuids = [];
$reportGroups = $report->getGroups();
foreach ($reportGroups as $groupId) {
if ($group = $this->groupRepository->find($groupId)) {
$uuids[] = $group->getUuid();
}
}
return $uuids;
}
public function getPlaybookCategoriesUuids(AutomatedReport $report): array
{
$uuids = [];
$playbookCategories = $report->getPlaybookCategories();
foreach ($playbookCategories as $id) {
if ($category = $this->playbookCategoryRepository->find($id)) {
$uuids[] = $category->getUuid();
}
}
return $uuids;
}
public function getDealAtCallStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getDealAtCallStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getCurrentDealStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getCurrentDealStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getRecipients());
}
public function getJiminnyUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function extractUserUuids(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => $user->getUuid())
->values()
->all();
}
// get mail data
public function getRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getRecipients());
}
/**
* @return array<UserContract>
*/
public function getRecipientUserObjects(AutomatedReport $report): array
{
$userIds = $report->getRecipients()['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->values()
->all();
}
private function getJiminnyRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function buildRecipientUsers(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => [
'email' => $user->getEmailAddress(),
'name' => $user->getName(),
'timezone' => $user->getTimezone()->getName(),
])
->values()
->all();
}
public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array
{
if ($report->isAskJiminnyReport()) {
$recipients = $this->resolveAskJiminnyRecipients($report);
} else {
$recipients = $this->getRecipientUsers($report);
if ($includeJiminny) {
$recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));
}
}
$emails = [];
return array_values(array_filter(
$recipients,
static function ($recipient) use (&$emails) {
if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {
return false;
}
$emails[] = $recipient['email'];
return true;
}
));
}
private function resolveAskJiminnyRecipients(AutomatedReport $report): array
{
$recipients = [];
$creator = $report->getCreator();
if ($creator !== null) {
$recipients[] = [
'email' => $creator->getEmailAddress(),
'name' => $creator->getName(),
'timezone' => $creator->getTimezone()->getName(),
];
}
return array_merge(
$recipients,
$this->buildRecipientUsers($report->getRecipients()),
$this->getGroupRecipientUsers($report),
);
}
private function getGroupRecipientUsers(AutomatedReport $report): array
{
$users = [];
foreach ($report->getGroups() as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group === null) {
continue;
}
foreach ($group->getMembers() as $member) {
$users[] = [
'email' => $member->getEmailAddress(),
'name' => $member->getName(),
'timezone' => $member->getTimezone()->getName(),
];
}
}
return $users;
}
public function getReportTypeName(AutomatedReportResult $report): string
{
$type = $report->getReport()->getType();
$getType = $this->transformReportType($type);
return $getType['name'];
}
public function getReportPeriodName(AutomatedReportResult $report): string
{
$from = $report->getFromDate();
$to = $report->getToDate();
$frequency = $report->getReport()->getFrequency();
if ($from === null || $to === null) {
if (! $report->getReport()->isAskJiminnyReport()) {
$invalidPeriod = $from === null ? 'from' : 'to';
throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);
}
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
}
return $this->formatReportPeriodName($frequency, $from, $to);
}
private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string
{
$fromYear = $from->format('Y');
$toYear = $to->format('Y');
$differentYears = $fromYear !== $toYear;
switch ($frequency) {
case self::FREQUENCY_DAILY:
return $from->format('j M Y');
case self::FREQUENCY_QUARTERLY:
// 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ
$startMonth = $from->format('M');
$endMonth = $to->copy()->subMonth();
$endMonthName = $endMonth->format('M');
$endMonthYear = $endMonth->format('Y');
if ($differentYears) {
return "{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}";
}
return "{$startMonth} - {$endMonthName} {$toYear}";
case self::FREQUENCY_MONTHLY:
// 'May 2025' - monthly reports are always within the same year
return $from->format('M Y');
case self::FREQUENCY_WEEKLY:
// '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ
$startDay = $from->format('j');
$endDay = $to->format('j');
$startMonth = $from->format('M');
$endMonth = $to->format('M');
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
if ($startMonth !== $endMonth) {
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
}
return "{$startDay} - {$endDay} {$endMonth} {$toYear}";
case self::FREQUENCY_ONE_OFF:
// '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ
$startDay = $from->format('j');
$startMonth = $from->format('M');
$endDay = $to->format('j');
$endMonth = $to->format('M');
// If same month and year, use a format like '2-31 May 2025'
if ($startMonth === $endMonth && ! $differentYears) {
return "{$startDay} - {$endDay} {$startMonth} {$toYear}";
}
// If different years, include both years
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
// Same year but different months
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
default:
// Default format for unknown frequencies
return $from->format('j M Y') . ' - ' . $to->format('j M Y');
}
}
public function getReportTeamsName(AutomatedReportResult $report): string
{
$groups = $report->getGroups();
if (empty($groups)) {
return 'All';
}
// Get group names from repository
$groupNames = [];
foreach ($groups as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group) {
$groupNames[] = $group->getName();
}
}
if (count($groupNames) === 1) {
// Single team format
$teamsName = $groupNames[0];
} else {
// Multiple teams format
$teamsName = implode(', ', $groupNames);
}
return $teamsName;
}
public function getReportFileName(AutomatedReportResult $report): string
{
$customName = $report->getReport()->getCustomName();
$periodName = $this->getReportPeriodName($report);
$filenameSuffix = $this->getFilenameSuffix($report);
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$customName} - {$periodName}");
}
$baseName = $this->getReportTypeName($report);
if ($filenameSuffix) {
$baseName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}");
}
public function getReportFileNameWithExtension(AutomatedReportResult $result): string
{
$extension = $this->getMediaTypeMetadata($result)['extension'];
return $this->getReportFileName($result) . '.' . $extension;
}
public function sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool
{
$recipients = array_map('intval', $report->getRecipients()['users'] ?? []);
return in_array($user->getId(), $recipients);
}
public function transformReportResults(Collection $automatedReportResults): array
{
$data = [];
foreach ($automatedReportResults as $automatedReportResult) {
/** @var AutomatedReportResult $automatedReportResult */
$report = $automatedReportResult->getReport();
$createdBy = $report->getCreator();
$creator = [
'id' => $createdBy?->getUuid(),
'name' => $createdBy?->getName(),
'email' => $createdBy?->getEmailAddress(),
'photoUrl' => $createdBy?->getPhotoUrl(),
];
$recipients = $this->buildRecipients($report);
$data[] = [
'id' => $automatedReportResult->getUuid(),
'name' => $automatedReportResult->getName(),
'frequency' => $this->transformFrequency($report->getFrequency()),
'recipients' => $recipients,
'recipients' => [
...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),
...array_values($this->transformRecipients($report->getRecipients())),
],
'report_type' => $this->transformReportType($report->getType()),
'media_type' => $automatedReportResult->getMediaType(),
'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),
'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),
'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),
'creator' => $creator,
];
}
return $data;
}
private function buildRecipients(AutomatedReport $report)
{
}
public function hasCallTypeConference(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);
}
public function hasCallTypeDialer(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);
}
// transformers
private function transformTeam(Team $team): array
{
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
return [];
}
return [
'id' => $team->getUuid(),
'name' => $team->getName(),
];
}
private function transformReportFullView(AutomatedReport $report): array
{
$base = $this->transformReportBase($report);
return $report->getType() === self::TYPE_ASK_JIMINNY
? $base + $this->transformAskJiminnyFields($report)
: $base + $this->transformStandardReportFields($report);
}
private function transformReportBase(AutomatedReport $report): array
{
return [
'id' => $report->getUuid(),
'organization' => $this->transformOrganization(team: $report->getTeam()),
'report_type' => $this->transformReportType($report->getType()),
'frequency' => $this->transformFrequency($report->getFrequency()),
];
}
private function transformStandardReportFields(AutomatedReport $report): array
{
$team = $report->getTeam();
return [
'report_enabled' => $report->getStatus(),
'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),
'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),
'deal_value_min' => $report->getDealValueMin(),
'deal_value_max' => $report->getDealValueMax(),
'call_types' => $this->transformCallType($report->getCallTypes()),
'media_types' => $this->transformMediaTypes($report),
'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),
'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),
'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),
'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),
'recipients' => $this->transformRecipients($report->getRecipients()),
'created_by' => $this->transformCreator($report->getCreator()),
'additional_prompt_input' => $report->getAdditionalPromptInput(),
'custom_name' => $report->getCustomName(),
'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),
'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),
'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),
];
}
private function transformAskJiminnyFields(AutomatedReport $report): array
{
$team = $report->getTeam();
$creatorId = $report->getAttribute('created_by');
$explicitUserIds = array_values(array_filter(
$report->getRecipients()['users'] ?? [],
static fn ($id) => $id !== $creatorId
));
return [
'report_name' => $report->getCustomName(),
'enabled' => $report->getStatus(),
'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),
'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),
'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),
'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),
];
}
private function transformOrganization(?Team $team): array
{
return [
'id' => $team?->getUuid(),
'name' => $team?->getName(),
];
}
private function transformReportType(string $type): array
{
foreach (self::ALL_TYPES as $typeItem) {
if ($typeItem['id'] === $type) {
return $typeItem;
}
}
return [];
}
private function transformCallType(array $types): array
{
$result = [];
$callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];
foreach ($types as $type) {
foreach ($callTypes as $callTypeItem) {
if ($callTypeItem['id'] === $type) {
$result[] = $callTypeItem;
break;
}
}
}
return $result;
}
private function transformMediaTypes(AutomatedReport $report): array
{
$values = [];
foreach ($report->getMediaTypes() as $mediaType) {
if (! in_array($mediaType, self::MEDIA_TYPES, true)) {
continue;
}
$values[] = match ($mediaType) {
self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,
self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,
};
}
return $values;
}
private function transformFrequency(string $frequency): array
{
foreach (self::ALL_FREQUENCIES as $frequencyItem) {
if ($frequencyItem['id'] === $frequency) {
return $frequencyItem;
}
}
return [];
}
public function transformDurationToMinutes(?int $duration): ?int
{
if (! $duration) {
return null;
}
return (int) ($duration / 60);
}
private function transformGroups(?Team $team, array $groupsIds): array
{
if (empty($groupsIds) || ! $team) {
return [];
}
$data = [];
foreach ($groupsIds as $groupId) {
$group = $team->groups()->where('id', $groupId)->first();
if ($group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
'photoUrl' => $group->getPhotoUrl(),
];
}
}
return $data;
}
private function transformStages(?Team $team, array $stagesIds): array
{
if (empty($stagesIds) || ! $team) {
return [];
}
$data = [];
foreach ($stagesIds as $stageId) {
$stage = $team->stages()->where('id', $stageId)->first();
if ($stage) {
$data[] = [
'id' => $stage->getUuid(),
'name' => $stage->getName(),
];
}
}
return $data;
}
private function transformRecipients(array $recipients): array
{
$users = [];
foreach ($recipients['users'] ?? [] as $userId) {
$users[] = $this->transformUser($userId);
}
return $users;
}
private function transformCreator(?User $user): ?array
{
if ($user === null) {
return null;
}
return $this->transformUser($user->getId());
}
private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array
{
if ($prompt === null) {
return null;
}
return [
'id' => $prompt->getUuid(),
'name' => $prompt->getTitle(),
];
}
private function transformSafeSearch(?Search $search): ?array
{
if ($search === null) {
return null;
}
return [
'id' => $search->getUuid(),
'name' => $search->getName(),
];
}
private function transformUser(int $userId): array
{
/* @var ?User $user */
$user = $this->userRepository->find($userId);
return [
'id' => $user?->getUuid(),
'name' => $user?->getName(),
'email' => $user?->getEmailAddress(),
'photoUrl' => $user?->getPhotoUrl(),
];
}
public function create(array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$validatedData['created_by'] = auth()->id();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
public function update(string $uuid, array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$report = $this->automatedReportsRepository->findByUuid($uuid);
if (! $report) {
throw new InvalidArgumentException('Report not found');
}
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
/**
* Create an Ask Jiminny report.
*/
public function createAskJiminnyReport(array $data, User $creator): array
{
$validatedData = $this->validateAskJiminnyReportData($data, $creator);
$validatedData['created_by'] = $creator->getId();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
return $this->transformReportFullView($automatedReport);
}
/**
* Update an Ask Jiminny report.
*/
public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array
{
if (! $report->isAskJiminnyReport()) {
throw new InvalidArgumentException('Report is not an Ask Jiminny report');
}
$validatedData = $this->validateAskJiminnyReportData($data, $user);
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
return $this->transformReportFullView($automatedReport);
}
public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array
{
$this->automatedReportsRepository->update($report, ['status' => $status]);
return $this->transformReportFullView($report->fresh());
}
/**
* Validate and transform data for Ask Jiminny reports.
*/
private function validateAskJiminnyReportData(array $data, User $user): array
{
// Validate name
$name = trim($data['report_name'] ?? '');
if (empty($name)) {
throw new InvalidArgumentException('Report name is required');
}
if (mb_strlen($name) > 50) {
throw new InvalidArgumentException('Report name must be 50 characters or less');
}
// Validate frequency (only daily, weekly, monthly for Ask Jiminny)
$frequency = $data['frequency'] ?? null;
$askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];
if (! in_array($frequency, $askJiminnyFrequencies, true)) {
throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');
}
// Validate expiration date
$expiresAt = $data['expires_on'] ?? null;
if (empty($expiresAt)) {
throw new InvalidArgumentException('Expiration date is required');
}
try {
$expiresAtDate = Carbon::parse($expiresAt);
} catch (InvalidFormatException $e) {
throw new InvalidArgumentException('Expiration date format is invalid');
}
$maxExpiration = Carbon::now()->addYear()->endOfDay();
if ($expiresAtDate->gt($maxExpiration)) {
throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');
}
if ($expiresAtDate->isPast()) {
throw new InvalidArgumentException('Expiration date cannot be in the past');
}
// Validate saved search
$activitySearchId = $data['saved_search'] ?? null;
if (empty($activitySearchId)) {
throw new InvalidArgumentException('Saved search is required');
}
$savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);
if (! $savedSearch) {
throw new InvalidArgumentException('Saved search not found or does not belong to you');
}
// Validate saved prompt
$askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;
if (empty($askAnythingPromptId)) {
throw new InvalidArgumentException('Ask Jiminny prompt is required');
}
$prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);
if (! $prompt) {
throw new InvalidArgumentException('Ask Jiminny prompt not found');
}
// Validate status
$status = $data['enabled'] ?? false;
$recipientUserIds = [$user->getId()];
if (! empty($data['share_users'])) {
$sharedUserIds = $this->validateAndGetUserIdsByTeam(
$user->team,
(array) $data['share_users']
);
$recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);
}
$sharedGroupIds = [];
if (! empty($data['share_teams'])) {
$sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);
}
$recipientUserIds = array_values(array_unique($recipientUserIds));
return [
'team_id' => $user->getTeamId(),
'type' => self::TYPE_ASK_JIMINNY,
'status' => (bool) $status,
'frequency' => $frequency,
'custom_name' => $name,
'activity_search_id' => $savedSearch->getId(),
'ask_anything_prompt_id' => $prompt->getId(),
'expires_at' => $expiresAtDate->toDateString(),
'media_types' => [self::MEDIA_TYPE_PDF],
'call_types' => [],
'recipients' => ['users' => $recipientUserIds],
'groups' => $sharedGroupIds,
];
}
public static function getAskJiminnyFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::ASK_JIMINNY_FREQUENCIES);
}
public function getAskJiminnyReportFilters(User $user): array
{
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
return [
[
'id' => 'prompt',
'label' => 'Prompt',
'options' => $prompts,
],
[
'id' => 'saved_search',
'label' => 'Saved Search',
'options' => $savedSearches,
],
];
}
public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array
{
$team = $user->getTeam();
$userTimezone = $user->getTimezone();
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
$teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [
'id' => $group->getUuid(),
'name' => $group->getName(),
])->values()->all();
$shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];
$sharedTeamsValue = [];
$sharedUsersValue = [];
if ($report) {
$sharedTeamsValue = $this->transformGroups($team, $report->getGroups());
$recipientUserIds = $report->getRecipients()['users'] ?? [];
$creatorId = $report->getAttribute('created_by');
$sharedUserIds = array_values(array_filter(
$recipientUserIds,
static fn ($id) => $id !== $creatorId
));
$sharedUsersValue = collect($sharedUserIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (User $u) => [
'id' => $u->getUuid(),
'name' => $u->getName(),
])
->values()
->all();
}
return [
'fields' => [
[
'id' => 'enabled',
'inputType' => InputTypeEnum::TOGGLE,
'label' => '',
'value' => $report?->getStatus() ?? false,
],
[
'id' => 'report_name',
'inputType' => InputTypeEnum::TEXT,
'label' => 'Name',
'placeholder' => 'Enter name',
'required' => true,
'validation' => ['maxLength' => 50],
'value' => $report?->getCustomName() ?? '',
],
[
'id' => 'frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'label' => 'Frequency',
'required' => true,
'placeholder' => 'Select',
'options' => self::ASK_JIMINNY_FREQUENCIES,
'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,
],
[
'id' => 'expires_on',
'inputType' => InputTypeEnum::DATE,
'label' => 'Expires on',
'required' => true,
'placeholder' => 'Select',
'validation' => [
'minDate' => now($userTimezone)->toDateString(),
'maxDate' => now($userTimezone)->addYear()->toDateString(),
],
'value' => $report?->getExpiresAt()?->toDateString(),
],
[
...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"#11894 on JY-18909-automated-reports-ask-jiminny, menu","depth":5,"help_text":"Pull request #11894 exists for current branch JY-18909-automated-reports-ask-jiminny","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AutomatedReportsRepositoryTest","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AutomatedReportsRepositoryTest'","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AutomatedReportsRepositoryTest'","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"3","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"102","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"3","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"34","depth":4,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Kiosk\\AutomatedReports;\n\nuse Carbon\\CarbonImmutable;\nuse Carbon\\CarbonInterface;\nuse Carbon\\Exceptions\\InvalidFormatException;\nuse DateTime;\nuse DateTimeInterface;\nuse DateTimeZone;\nuse Illuminate\\Contracts\\Bus\\Dispatcher as BusDispatcher;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Support\\Facades\\Log;\nuse Illuminate\\Support\\Facades\\Storage;\nuse Jiminny\\Component\\ActivitySearch\\FilterDefinition\\InputTypeEnum;\nuse Jiminny\\Component\\AskAnything\\AskAnythingPromptService;\nuse Jiminny\\Component\\AskAnything\\Dtos\\AskAnythingPromptDto;\nuse Jiminny\\Component\\UrlGenerator\\Webhook;\nuse Jiminny\\Contracts\\Repositories\\PlaybookCategoryRepository;\nuse Jiminny\\Contracts\\Repositories\\TeamRepository;\nuse Jiminny\\Contracts\\Repositories\\UserRepository;\nuse Jiminny\\Exceptions\\ApplicationException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Exceptions\\ModelNotFoundException;\nuse Jiminny\\Jobs\\AutomatedReports\\RequestGenerateReportJob;\nuse Jiminny\\Models\\Activity\\Search;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPrompt;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPromptTarget;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Contracts\\UserContract;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Repositories\\AskAnythingRepository;\nuse Jiminny\\Repositories\\AutomatedReportsRepository;\nuse Jiminny\\Repositories\\GroupRepository;\nuse Jiminny\\Repositories\\SearchRepository;\nuse Jiminny\\Repositories\\StageRepository;\nuse Throwable;\n\nclass AutomatedReportsService\n{\n public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';\n public const string TYPE_ASK_JIMINNY = 'ask_jiminny';\n\n /**\n * Standard report types (used by kiosk for existing automated reports).\n */\n // @TODO this will add filter, however if we need to control feature by FF we need conditional logic\n public const array TYPES = [\n ['id' => 'exec_summary', 'name' => 'Exec Summary'],\n ['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],\n ['id' => 'product_feedback', 'name' => 'Product Feedback'],\n ['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],\n// ['id' => 'questions', 'name' => 'Questions'],\n// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],\n ];\n\n public const array ALL_TYPES = [\n ...self::TYPES,\n ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],\n ];\n\n public const string FREQUENCY_DAILY = 'daily';\n public const string FREQUENCY_WEEKLY = 'weekly';\n public const string FREQUENCY_MONTHLY = 'monthly';\n public const string FREQUENCY_QUARTERLY = 'quarterly';\n public const string FREQUENCY_ONE_OFF = 'one_off';\n\n /**\n * Frequencies for standard (non-Ask Jiminny) reports.\n */\n public const array FREQUENCIES = [\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n\n /**\n * Frequencies for Ask Jiminny reports.\n */\n public const array ASK_JIMINNY_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ];\n\n public const string MEDIA_TYPE_PDF = 'pdf';\n public const string MEDIA_TYPE_PODCAST = 'podcast';\n public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];\n public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];\n public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];\n public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];\n\n public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];\n public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];\n public const int SENT_REPORT_AT_HOURS = 5;\n public const string PDF_KEY = 'pdf';\n public const string AUDIO_KEY = 'audio';\n\n private const array ALL_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n private const string S3_DIR = 'reports';\n private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];\n private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];\n\n public function __construct(\n private readonly TeamRepository $teamRepository,\n private readonly GroupRepository $groupRepository,\n private readonly UserRepository $userRepository,\n private readonly StageRepository $stageRepository,\n private readonly DealStagesService $dealStagesService,\n private readonly RecipientsService $recipientsService,\n private readonly AutomatedReportsRepository $automatedReportsRepository,\n private readonly Webhook $webhookService,\n private readonly BusDispatcher $dispatcher,\n private readonly ActivityTypeService $activityTypeService,\n private readonly PlaybookCategoryRepository $playbookCategoryRepository,\n private readonly AskAnythingPromptService $askAnythingPromptService,\n private readonly SearchRepository $activitySearchRepository,\n private readonly AskAnythingRepository $askAnythingRepository,\n ) {\n }\n\n public static function getTypes(): array\n {\n $types = self::TYPES;\n\n return array_map(static function ($type) {\n return $type['id'];\n }, $types);\n }\n\n public static function getCallTypes(): array\n {\n return array_map(static function ($callType) {\n return $callType['id'];\n }, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);\n }\n\n public static function getFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::FREQUENCIES);\n }\n\n // front-facing structure\n public function getReportEnabledFieldData(bool $value = false): array\n {\n return [\n 'id' => 'report_enabled',\n 'label' => '',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'value' => $value,\n ];\n }\n\n // Organizations = Teams\n public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array\n {\n $options = $this->getTeams();\n\n if ($shortVersion) {\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value,\n 'dependencies' => [\n 'teams',\n 'deal_stage_at_call',\n 'current_deal_stage',\n 'recipients',\n ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,\n ],\n 'dependsOn' => [],\n ];\n }\n\n // Teams = Groups\n public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array\n {\n if ($shortVersion) {\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value, // value should be an array of objects {id, name}\n 'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],\n 'dependsOn' => [],\n ];\n }\n\n public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array\n {\n $types = [];\n if ($team instanceof Team) {\n if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n $types = self::TYPES;\n }\n if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {\n $types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];\n }\n } else {\n $types = self::TYPES;\n }\n\n if ($shortVersion) {\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'options' => $types,\n ];\n }\n\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $types,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getFrequencyFieldData(?string $value = null): array\n {\n return [\n 'id' => 'frequency',\n 'label' => 'Frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::FREQUENCIES,\n 'value' => $value,\n 'dependencies' => ['period'],\n 'dependsOn' => [],\n ];\n }\n\n public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array\n {\n return [\n 'id' => 'period',\n 'label' => 'Select one-off period',\n 'inputType' => InputTypeEnum::DATE_RANGE,\n 'required' => true,\n 'placeholder' => 'Select',\n 'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],\n 'queryParams' => [\n 'startDate' => 'start_date_period',\n 'endDate' => 'end_date_period',\n ],\n 'dependencies' => [],\n 'dependsOn' => ['frequency'],\n ];\n }\n\n public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array\n {\n return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);\n }\n\n public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);\n }\n\n public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);\n }\n\n public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'deal_value',\n 'label' => 'Deal Value',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_deal_value',\n 'max' => 'max_deal_value',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array\n {\n $value = [];\n $conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;\n $dialerOn && $value[] = self::CALL_TYPE_DIALER;\n\n return [\n 'id' => 'call_type',\n 'label' => 'Call Type',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => [\n self::CALL_TYPE_CONFERENCE,\n self::CALL_TYPE_DIALER,\n ],\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getMediaTypeFieldData(?AutomatedReport $report = null): array\n {\n $value = [];\n\n if ($report) {\n $value = $this->transformMediaTypes($report);\n }\n\n return [\n 'id' => 'media_types',\n 'label' => 'Export as',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => self::MEDIA_TYPE_OBJECTS,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'call_duration',\n 'label' => 'Call Duration',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_call_duration',\n 'max' => 'max_call_duration',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getRecipientsFieldData(?Team $team = null, array $value = []): array\n {\n return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);\n }\n\n public function getJiminnyRecipientsFieldData(array $value = []): array\n {\n return $this->recipientsService->getJiminnyRecipientsFieldData($value);\n }\n\n public function getAdditionalPromptInputFieldData(?string $value = null): array\n {\n return [\n 'id' => 'additional_prompt_input',\n 'label' => 'Special requirements',\n 'inputType' => InputTypeEnum::TEXTAREA,\n 'required' => false,\n 'placeholder' => 'What should be the focus of the report?',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCustomReportNameFieldData(?string $value = null): array\n {\n return [\n 'id' => 'custom_name',\n 'label' => 'Custom report name',\n 'inputType' => InputTypeEnum::TEXT,\n 'required' => false,\n 'placeholder' => 'Enter custom name',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n // data providers\n public function getTeams(): array\n {\n $teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);\n\n $teamData = [];\n foreach ($teams as $team) {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n continue;\n }\n\n $teamData[] = $this->transformTeam($team);\n }\n\n return $teamData;\n }\n\n public function getTeamGroups(string $teamUuid): array\n {\n $data = [];\n $team = $this->getTeam($teamUuid);\n\n if ($team !== null) {\n $groups = $team->groups()->get();\n\n foreach ($groups as $group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n public function getTeamsGroupsOptions(array $filterTeamUuids = []): array\n {\n $data = [];\n $teams = $this->getTeams();\n\n foreach ($teams as $team) {\n if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {\n continue;\n }\n\n $data[] = [\n 'label' => $team['name'],\n 'groups' => $this->getTeamGroups($team['id']),\n ];\n }\n\n return $data;\n }\n\n public function getTeam(string $teamUuid): ?Team\n {\n return $this->teamRepository->idOrUuid($teamUuid);\n }\n\n public function getTeamById(int $teamId): ?Team\n {\n return $this->teamRepository->find($teamId);\n }\n\n public function getGroupsUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportGroups = $report->getGroups();\n foreach ($reportGroups as $groupId) {\n if ($group = $this->groupRepository->find($groupId)) {\n $uuids[] = $group->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getPlaybookCategoriesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $playbookCategories = $report->getPlaybookCategories();\n foreach ($playbookCategories as $id) {\n if ($category = $this->playbookCategoryRepository->find($id)) {\n $uuids[] = $category->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getDealAtCallStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getDealAtCallStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getCurrentDealStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getCurrentDealStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getRecipients());\n }\n\n public function getJiminnyUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function extractUserUuids(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => $user->getUuid())\n ->values()\n ->all();\n }\n\n // get mail data\n public function getRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getRecipients());\n }\n\n /**\n * @return array<UserContract>\n */\n public function getRecipientUserObjects(AutomatedReport $report): array\n {\n $userIds = $report->getRecipients()['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->values()\n ->all();\n }\n\n private function getJiminnyRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function buildRecipientUsers(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => [\n 'email' => $user->getEmailAddress(),\n 'name' => $user->getName(),\n 'timezone' => $user->getTimezone()->getName(),\n ])\n ->values()\n ->all();\n }\n\n public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array\n {\n if ($report->isAskJiminnyReport()) {\n $recipients = $this->resolveAskJiminnyRecipients($report);\n } else {\n $recipients = $this->getRecipientUsers($report);\n if ($includeJiminny) {\n $recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));\n }\n }\n\n $emails = [];\n\n return array_values(array_filter(\n $recipients,\n static function ($recipient) use (&$emails) {\n if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {\n return false;\n }\n $emails[] = $recipient['email'];\n\n return true;\n }\n ));\n }\n\n private function resolveAskJiminnyRecipients(AutomatedReport $report): array\n {\n $recipients = [];\n\n $creator = $report->getCreator();\n if ($creator !== null) {\n $recipients[] = [\n 'email' => $creator->getEmailAddress(),\n 'name' => $creator->getName(),\n 'timezone' => $creator->getTimezone()->getName(),\n ];\n }\n\n return array_merge(\n $recipients,\n $this->buildRecipientUsers($report->getRecipients()),\n $this->getGroupRecipientUsers($report),\n );\n }\n\n private function getGroupRecipientUsers(AutomatedReport $report): array\n {\n $users = [];\n foreach ($report->getGroups() as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group === null) {\n continue;\n }\n foreach ($group->getMembers() as $member) {\n $users[] = [\n 'email' => $member->getEmailAddress(),\n 'name' => $member->getName(),\n 'timezone' => $member->getTimezone()->getName(),\n ];\n }\n }\n\n return $users;\n }\n\n public function getReportTypeName(AutomatedReportResult $report): string\n {\n $type = $report->getReport()->getType();\n\n $getType = $this->transformReportType($type);\n\n return $getType['name'];\n }\n\n public function getReportPeriodName(AutomatedReportResult $report): string\n {\n $from = $report->getFromDate();\n $to = $report->getToDate();\n $frequency = $report->getReport()->getFrequency();\n\n if ($from === null || $to === null) {\n if (! $report->getReport()->isAskJiminnyReport()) {\n $invalidPeriod = $from === null ? 'from' : 'to';\n\n throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);\n }\n\n $period = $this->calculateFromAndToDatePeriod($frequency);\n $from = $period['fromDate'];\n $to = $period['toDate'];\n }\n\n return $this->formatReportPeriodName($frequency, $from, $to);\n }\n\n private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string\n {\n $fromYear = $from->format('Y');\n $toYear = $to->format('Y');\n $differentYears = $fromYear !== $toYear;\n\n switch ($frequency) {\n case self::FREQUENCY_DAILY:\n return $from->format('j M Y');\n\n case self::FREQUENCY_QUARTERLY:\n // 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ\n $startMonth = $from->format('M');\n $endMonth = $to->copy()->subMonth();\n $endMonthName = $endMonth->format('M');\n $endMonthYear = $endMonth->format('Y');\n\n if ($differentYears) {\n return \"{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}\";\n }\n\n return \"{$startMonth} - {$endMonthName} {$toYear}\";\n\n case self::FREQUENCY_MONTHLY:\n // 'May 2025' - monthly reports are always within the same year\n return $from->format('M Y');\n\n case self::FREQUENCY_WEEKLY:\n // '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ\n $startDay = $from->format('j');\n $endDay = $to->format('j');\n $startMonth = $from->format('M');\n $endMonth = $to->format('M');\n\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n if ($startMonth !== $endMonth) {\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n return \"{$startDay} - {$endDay} {$endMonth} {$toYear}\";\n\n case self::FREQUENCY_ONE_OFF:\n // '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ\n $startDay = $from->format('j');\n $startMonth = $from->format('M');\n $endDay = $to->format('j');\n $endMonth = $to->format('M');\n\n // If same month and year, use a format like '2-31 May 2025'\n if ($startMonth === $endMonth && ! $differentYears) {\n return \"{$startDay} - {$endDay} {$startMonth} {$toYear}\";\n }\n\n // If different years, include both years\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n // Same year but different months\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n\n default:\n // Default format for unknown frequencies\n return $from->format('j M Y') . ' - ' . $to->format('j M Y');\n }\n }\n\n public function getReportTeamsName(AutomatedReportResult $report): string\n {\n $groups = $report->getGroups();\n\n if (empty($groups)) {\n return 'All';\n }\n\n // Get group names from repository\n $groupNames = [];\n foreach ($groups as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group) {\n $groupNames[] = $group->getName();\n }\n }\n\n if (count($groupNames) === 1) {\n // Single team format\n $teamsName = $groupNames[0];\n } else {\n // Multiple teams format\n $teamsName = implode(', ', $groupNames);\n }\n\n return $teamsName;\n }\n\n public function getReportFileName(AutomatedReportResult $report): string\n {\n $customName = $report->getReport()->getCustomName();\n $periodName = $this->getReportPeriodName($report);\n $filenameSuffix = $this->getFilenameSuffix($report);\n\n if ($customName) {\n if ($filenameSuffix) {\n $customName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$customName} - {$periodName}\");\n }\n\n $baseName = $this->getReportTypeName($report);\n\n if ($filenameSuffix) {\n $baseName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}\");\n }\n\n public function getReportFileNameWithExtension(AutomatedReportResult $result): string\n {\n $extension = $this->getMediaTypeMetadata($result)['extension'];\n\n return $this->getReportFileName($result) . '.' . $extension;\n }\n\n public function sanitizeFileName(string $fileName): string\n {\n return str_replace(['/', '\\\\'], '-', $fileName);\n }\n\n public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool\n {\n $recipients = array_map('intval', $report->getRecipients()['users'] ?? []);\n\n return in_array($user->getId(), $recipients);\n }\n\n public function transformReportResults(Collection $automatedReportResults): array\n {\n $data = [];\n foreach ($automatedReportResults as $automatedReportResult) {\n /** @var AutomatedReportResult $automatedReportResult */\n\n $report = $automatedReportResult->getReport();\n\n $createdBy = $report->getCreator();\n $creator = [\n 'id' => $createdBy?->getUuid(),\n 'name' => $createdBy?->getName(),\n 'email' => $createdBy?->getEmailAddress(),\n 'photoUrl' => $createdBy?->getPhotoUrl(),\n ];\n\n $recipients = $this->buildRecipients($report);\n\n $data[] = [\n 'id' => $automatedReportResult->getUuid(),\n 'name' => $automatedReportResult->getName(),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n 'recipients' => $recipients,\n 'recipients' => [\n ...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),\n ...array_values($this->transformRecipients($report->getRecipients())),\n ],\n 'report_type' => $this->transformReportType($report->getType()),\n 'media_type' => $automatedReportResult->getMediaType(),\n 'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),\n 'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),\n 'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),\n 'creator' => $creator,\n ];\n \n \n }\n\n return $data;\n }\n\n private function buildRecipients(AutomatedReport $report)\n {\n \n }\n\n public function hasCallTypeConference(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);\n }\n\n public function hasCallTypeDialer(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);\n }\n\n // transformers\n private function transformTeam(Team $team): array\n {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n return [];\n }\n\n return [\n 'id' => $team->getUuid(),\n 'name' => $team->getName(),\n ];\n }\n\n private function transformReportFullView(AutomatedReport $report): array\n {\n $base = $this->transformReportBase($report);\n\n return $report->getType() === self::TYPE_ASK_JIMINNY\n ? $base + $this->transformAskJiminnyFields($report)\n : $base + $this->transformStandardReportFields($report);\n }\n\n private function transformReportBase(AutomatedReport $report): array\n {\n return [\n 'id' => $report->getUuid(),\n 'organization' => $this->transformOrganization(team: $report->getTeam()),\n 'report_type' => $this->transformReportType($report->getType()),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n ];\n }\n\n private function transformStandardReportFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n\n return [\n 'report_enabled' => $report->getStatus(),\n 'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),\n 'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),\n 'deal_value_min' => $report->getDealValueMin(),\n 'deal_value_max' => $report->getDealValueMax(),\n 'call_types' => $this->transformCallType($report->getCallTypes()),\n 'media_types' => $this->transformMediaTypes($report),\n 'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),\n 'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),\n 'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),\n 'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),\n 'recipients' => $this->transformRecipients($report->getRecipients()),\n 'created_by' => $this->transformCreator($report->getCreator()),\n 'additional_prompt_input' => $report->getAdditionalPromptInput(),\n 'custom_name' => $report->getCustomName(),\n 'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),\n 'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),\n 'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),\n ];\n }\n\n private function transformAskJiminnyFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n $creatorId = $report->getAttribute('created_by');\n $explicitUserIds = array_values(array_filter(\n $report->getRecipients()['users'] ?? [],\n static fn ($id) => $id !== $creatorId\n ));\n\n return [\n 'report_name' => $report->getCustomName(),\n 'enabled' => $report->getStatus(),\n 'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),\n 'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),\n 'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),\n 'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),\n ];\n }\n\n private function transformOrganization(?Team $team): array\n {\n return [\n 'id' => $team?->getUuid(),\n 'name' => $team?->getName(),\n ];\n }\n\n private function transformReportType(string $type): array\n {\n foreach (self::ALL_TYPES as $typeItem) {\n if ($typeItem['id'] === $type) {\n return $typeItem;\n }\n }\n\n return [];\n }\n\n private function transformCallType(array $types): array\n {\n $result = [];\n $callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];\n\n foreach ($types as $type) {\n foreach ($callTypes as $callTypeItem) {\n if ($callTypeItem['id'] === $type) {\n $result[] = $callTypeItem;\n\n break;\n }\n }\n }\n\n return $result;\n }\n\n private function transformMediaTypes(AutomatedReport $report): array\n {\n $values = [];\n\n foreach ($report->getMediaTypes() as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n continue;\n }\n\n $values[] = match ($mediaType) {\n self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,\n self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,\n };\n }\n\n return $values;\n }\n\n private function transformFrequency(string $frequency): array\n {\n foreach (self::ALL_FREQUENCIES as $frequencyItem) {\n if ($frequencyItem['id'] === $frequency) {\n return $frequencyItem;\n }\n }\n\n return [];\n }\n\n public function transformDurationToMinutes(?int $duration): ?int\n {\n if (! $duration) {\n return null;\n }\n\n return (int) ($duration / 60);\n }\n\n private function transformGroups(?Team $team, array $groupsIds): array\n {\n if (empty($groupsIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($groupsIds as $groupId) {\n $group = $team->groups()->where('id', $groupId)->first();\n\n if ($group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n 'photoUrl' => $group->getPhotoUrl(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformStages(?Team $team, array $stagesIds): array\n {\n if (empty($stagesIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($stagesIds as $stageId) {\n $stage = $team->stages()->where('id', $stageId)->first();\n\n if ($stage) {\n $data[] = [\n 'id' => $stage->getUuid(),\n 'name' => $stage->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformRecipients(array $recipients): array\n {\n $users = [];\n foreach ($recipients['users'] ?? [] as $userId) {\n $users[] = $this->transformUser($userId);\n }\n\n return $users;\n }\n\n private function transformCreator(?User $user): ?array\n {\n if ($user === null) {\n return null;\n }\n\n return $this->transformUser($user->getId());\n }\n\n private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array\n {\n if ($prompt === null) {\n return null;\n }\n\n return [\n 'id' => $prompt->getUuid(),\n 'name' => $prompt->getTitle(),\n ];\n }\n\n private function transformSafeSearch(?Search $search): ?array\n {\n if ($search === null) {\n return null;\n }\n\n return [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ];\n }\n\n private function transformUser(int $userId): array\n {\n /* @var ?User $user */\n $user = $this->userRepository->find($userId);\n\n return [\n 'id' => $user?->getUuid(),\n 'name' => $user?->getName(),\n 'email' => $user?->getEmailAddress(),\n 'photoUrl' => $user?->getPhotoUrl(),\n ];\n }\n\n public function create(array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $validatedData['created_by'] = auth()->id();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function update(string $uuid, array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $report = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $report) {\n throw new InvalidArgumentException('Report not found');\n }\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Create an Ask Jiminny report.\n */\n public function createAskJiminnyReport(array $data, User $creator): array\n {\n $validatedData = $this->validateAskJiminnyReportData($data, $creator);\n $validatedData['created_by'] = $creator->getId();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Update an Ask Jiminny report.\n */\n public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array\n {\n if (! $report->isAskJiminnyReport()) {\n throw new InvalidArgumentException('Report is not an Ask Jiminny report');\n }\n\n $validatedData = $this->validateAskJiminnyReportData($data, $user);\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array\n {\n $this->automatedReportsRepository->update($report, ['status' => $status]);\n\n return $this->transformReportFullView($report->fresh());\n }\n\n /**\n * Validate and transform data for Ask Jiminny reports.\n */\n private function validateAskJiminnyReportData(array $data, User $user): array\n {\n // Validate name\n $name = trim($data['report_name'] ?? '');\n if (empty($name)) {\n throw new InvalidArgumentException('Report name is required');\n }\n if (mb_strlen($name) > 50) {\n throw new InvalidArgumentException('Report name must be 50 characters or less');\n }\n\n // Validate frequency (only daily, weekly, monthly for Ask Jiminny)\n $frequency = $data['frequency'] ?? null;\n $askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];\n if (! in_array($frequency, $askJiminnyFrequencies, true)) {\n throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');\n }\n\n // Validate expiration date\n $expiresAt = $data['expires_on'] ?? null;\n if (empty($expiresAt)) {\n throw new InvalidArgumentException('Expiration date is required');\n }\n\n try {\n $expiresAtDate = Carbon::parse($expiresAt);\n } catch (InvalidFormatException $e) {\n throw new InvalidArgumentException('Expiration date format is invalid');\n }\n $maxExpiration = Carbon::now()->addYear()->endOfDay();\n if ($expiresAtDate->gt($maxExpiration)) {\n throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');\n }\n if ($expiresAtDate->isPast()) {\n throw new InvalidArgumentException('Expiration date cannot be in the past');\n }\n\n // Validate saved search\n $activitySearchId = $data['saved_search'] ?? null;\n if (empty($activitySearchId)) {\n throw new InvalidArgumentException('Saved search is required');\n }\n $savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);\n if (! $savedSearch) {\n throw new InvalidArgumentException('Saved search not found or does not belong to you');\n }\n\n // Validate saved prompt\n $askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;\n if (empty($askAnythingPromptId)) {\n throw new InvalidArgumentException('Ask Jiminny prompt is required');\n }\n $prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);\n if (! $prompt) {\n throw new InvalidArgumentException('Ask Jiminny prompt not found');\n }\n\n // Validate status\n $status = $data['enabled'] ?? false;\n\n $recipientUserIds = [$user->getId()];\n\n if (! empty($data['share_users'])) {\n $sharedUserIds = $this->validateAndGetUserIdsByTeam(\n $user->team,\n (array) $data['share_users']\n );\n $recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);\n }\n\n $sharedGroupIds = [];\n if (! empty($data['share_teams'])) {\n $sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);\n }\n\n $recipientUserIds = array_values(array_unique($recipientUserIds));\n\n return [\n 'team_id' => $user->getTeamId(),\n 'type' => self::TYPE_ASK_JIMINNY,\n 'status' => (bool) $status,\n 'frequency' => $frequency,\n 'custom_name' => $name,\n 'activity_search_id' => $savedSearch->getId(),\n 'ask_anything_prompt_id' => $prompt->getId(),\n 'expires_at' => $expiresAtDate->toDateString(),\n 'media_types' => [self::MEDIA_TYPE_PDF],\n 'call_types' => [],\n 'recipients' => ['users' => $recipientUserIds],\n 'groups' => $sharedGroupIds,\n ];\n }\n\n public static function getAskJiminnyFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::ASK_JIMINNY_FREQUENCIES);\n }\n\n public function getAskJiminnyReportFilters(User $user): array\n {\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n return [\n [\n 'id' => 'prompt',\n 'label' => 'Prompt',\n 'options' => $prompts,\n ],\n [\n 'id' => 'saved_search',\n 'label' => 'Saved Search',\n 'options' => $savedSearches,\n ],\n ];\n }\n\n public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array\n {\n $team = $user->getTeam();\n $userTimezone = $user->getTimezone();\n\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n $teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ])->values()->all();\n\n $shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];\n\n $sharedTeamsValue = [];\n $sharedUsersValue = [];\n if ($report) {\n $sharedTeamsValue = $this->transformGroups($team, $report->getGroups());\n\n $recipientUserIds = $report->getRecipients()['users'] ?? [];\n $creatorId = $report->getAttribute('created_by');\n $sharedUserIds = array_values(array_filter(\n $recipientUserIds,\n static fn ($id) => $id !== $creatorId\n ));\n $sharedUsersValue = collect($sharedUserIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (User $u) => [\n 'id' => $u->getUuid(),\n 'name' => $u->getName(),\n ])\n ->values()\n ->all();\n }\n\n return [\n 'fields' => [\n [\n 'id' => 'enabled',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'label' => '',\n 'value' => $report?->getStatus() ?? false,\n ],\n [\n 'id' => 'report_name',\n 'inputType' => InputTypeEnum::TEXT,\n 'label' => 'Name',\n 'placeholder' => 'Enter name',\n 'required' => true,\n 'validation' => ['maxLength' => 50],\n 'value' => $report?->getCustomName() ?? '',\n ],\n [\n 'id' => 'frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Frequency',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::ASK_JIMINNY_FREQUENCIES,\n 'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,\n ],\n [\n 'id' => 'expires_on',\n 'inputType' => InputTypeEnum::DATE,\n 'label' => 'Expires on',\n 'required' => true,\n 'placeholder' => 'Select',\n 'validation' => [\n 'minDate' => now($userTimezone)->toDateString(),\n 'maxDate' => now($userTimezone)->addYear()->toDateString(),\n ],\n 'value' => $report?->getExpiresAt()?->toDateString(),\n ],\n [\n 'id' => 'share_teams',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team',\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $teamGroups,\n 'value' => $sharedTeamsValue,\n ],\n [\n 'id' => 'share_users',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team member',\n 'required' => false,\n 'placeholder' => 'Select',\n 'groupLabelKey' => 'label',\n 'groupValuesKey' => 'users',\n 'optionLabelKey' => 'name',\n 'optionValueKey' => 'id',\n 'options' => $shareUsers,\n 'value' => $sharedUsersValue,\n ],\n [\n 'id' => 'saved_search',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Saved search',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $savedSearches,\n 'value' => $report && $report->getSavedSearch() ? [\n 'id' => $report->getSavedSearch()->getUuid(),\n 'name' => $report->getSavedSearch()->getName(),\n ] : null,\n ],\n [\n 'id' => 'ask_jiminny_prompt',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Ask Jiminny prompt',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $prompts,\n 'value' => $report && $report->getAskAnythingPrompt() ? [\n 'id' => $report->getAskAnythingPrompt()->getUuid(),\n 'name' => $report->getAskAnythingPrompt()->getTitle(),\n ] : null,\n ],\n ],\n ];\n }\n\n private function updateResultNames(AutomatedReport $automatedReport): void\n {\n $results = $this->automatedReportsRepository->getResultsByReport($automatedReport);\n\n foreach ($results as $result) {\n $result->update(['name' => $this->getReportFileName($result)]);\n }\n }\n\n public function updateStatus(string $uuid, array $data): array\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $automatedReport->update([\n 'status' => $status,\n ]);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n private function generateOneOffReport(AutomatedReport $automatedReport): void\n {\n // the scheduler handles all the other frequency types\n if ($automatedReport->getStatus() === false || $automatedReport->getFrequency() !== self::FREQUENCY_ONE_OFF) {\n return;\n }\n\n $this->dispatcher->dispatch(new RequestGenerateReportJob($automatedReport->getUuid()));\n }\n\n public function getReport(string $uuid): AutomatedReport\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n return $automatedReport;\n }\n\n public function get(string $uuid): array\n {\n $automatedReport = $this->getReport($uuid);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function list(string $sortColumn = 'created_at', string $sortDirection = 'desc'): array\n {\n $results = [];\n $collection = $this->automatedReportsRepository->getAllStandardReports($sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function listAskJiminnyReports(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): array {\n $results = [];\n $collection = $this->automatedReportsRepository->getAskJiminnyReportsByUser($user, $sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function delete(string $uuid): void\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $automatedReport->delete();\n }\n\n public function createReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n return $this->automatedReportsRepository->createResult(\n array_merge(\n [\n 'report_id' => $automatedReport->getId(),\n 'status' => AutomatedReportResult::STATUS_DEFAULT,\n ],\n $data\n )\n );\n }\n\n public function getOrCreateReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n $existing = $this->automatedReportsRepository->findLatestDefaultOrFailedResult($automatedReport);\n\n if ($existing !== null) {\n $existing->update(['status' => AutomatedReportResult::STATUS_DEFAULT]);\n\n return $existing;\n }\n\n return $this->createReportResult($automatedReport, $data);\n }\n\n public function getReportResult(string $resultUuid): AutomatedReportResult\n {\n $report = $this->automatedReportsRepository->findResultByUuid($resultUuid);\n\n if (! $report) {\n throw new ModelNotFoundException('Report Result not found');\n }\n\n return $report;\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return $this->automatedReportsRepository->findChildResult($result, $type);\n }\n\n // prophet API calls\n /**\n * @throws ApplicationException\n */\n public function getGenerateReportPayload(AutomatedReport $automatedReport, string $reportResultUuid): array\n {\n $period = $this->calculateFromAndToDate($automatedReport);\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n return [\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResultUuid,\n 'report_type' => $automatedReport->getType(),\n 'media_types' => $automatedReport->getMediaTypes(),\n 'from_date' => $fromDate->startOfDay()->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->endOfDay()->format(DateTimeInterface::RFC3339),\n 'group_ids' => $automatedReport->getGroups(),\n 'call_deal_stage' => $automatedReport->getDealAtCallStages(),\n 'current_deal_stage' => $automatedReport->getCurrentDealStages(),\n 'deal_min_value' => $automatedReport->getDealValueMin(),\n 'deal_max_value' => $automatedReport->getDealValueMax(),\n 'call_types' => $automatedReport->getCallTypes(),\n 'call_duration_min_seconds' => $automatedReport->getCallDurationMin(),\n 'call_duration_max_seconds' => $automatedReport->getCallDurationMax(),\n 'special_requirements' => $automatedReport->getAdditionalPromptInput(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->formatReportPeriodName(\n $automatedReport->getFrequency(),\n $fromDate,\n $toDate,\n ),\n 'playbook_categories' => $automatedReport->getPlaybookCategories(),\n 'custom_name' => $automatedReport->getCustomName(),\n ];\n }\n\n // $inputPayload - FE payload structure\n public function getActivitiesCountPayload(array $inputPayload): array\n {\n // Use validateAndTransformData to validate and normalize input\n $validatedData = $this->validateAndTransformData($inputPayload);\n $period = $this->calculateFromAndToDatePeriod(\n $validatedData['frequency'],\n Carbon::parse($validatedData['from']),\n Carbon::parse($validatedData['to']),\n );\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n // Create payload similar to getGenerateReportPayload\n return [\n 'team_id' => $validatedData['team_id'],\n 'group_ids' => $validatedData['groups'] ?? [],\n 'report_type' => $validatedData['type'],\n 'from_date' => $fromDate->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->format(DateTimeInterface::RFC3339),\n 'call_deal_stage' => $validatedData['deal_at_call_stages'] ?? [],\n 'current_deal_stage' => $validatedData['current_deal_stages'] ?? [],\n 'deal_min_value' => $validatedData['deal_value_min'] ?? null,\n 'deal_max_value' => $validatedData['deal_value_max'] ?? null,\n 'call_types' => $validatedData['call_types'],\n 'call_duration_min_seconds' => $validatedData['call_duration_min'] ?? null,\n 'call_duration_max_seconds' => $validatedData['call_duration_max'] ?? null,\n 'special_requirements' => $validatedData['additional_prompt_input'] ?? null,\n 'playbook_categories' => $validatedData['playbook_categories'] ?? [],\n 'request_id' => null,\n 'callback_url' => null,\n ];\n }\n\n public function shouldSendReport(array $users, ?CarbonInterface $generatedAt = null): bool\n {\n if (empty($users)) {\n return false;\n }\n\n $earliestTz = collect($users)\n ->mapWithKeys(function (array $user) {\n $tz = new DateTimeZone($user['timezone']);\n $nowUtc = new DateTime('now', new DateTimeZone('UTC'));\n $offset = $tz->getOffset($nowUtc);\n\n return [$user['timezone'] => $offset];\n })\n ->sortDesc()\n ->keys()\n ->first();\n\n $now = Carbon::now($earliestTz);\n $isScheduledTime = (int) $now->format('H') === self::SENT_REPORT_AT_HOURS;\n\n if ($isScheduledTime) {\n return true;\n }\n\n return $this->hasPassedScheduledTime($generatedAt, $earliestTz);\n }\n\n public function hasPassedScheduledTime(?CarbonInterface $generatedAt, string $timezone): bool\n {\n if ($generatedAt === null) {\n return false;\n }\n\n $now = Carbon::now($timezone);\n $scheduledTime = $now->copy()->setTime(self::SENT_REPORT_AT_HOURS, 0, 0);\n\n if ($now->hour < self::SENT_REPORT_AT_HOURS) {\n $scheduledTime = $scheduledTime->subDay();\n }\n\n $scheduledTimeUtc = $scheduledTime->copy()->utc();\n $generatedAtUtc = $generatedAt->copy()->utc();\n $nowUtc = $now->copy()->utc();\n\n return $generatedAtUtc->lt($scheduledTimeUtc) && $nowUtc->gt($scheduledTimeUtc);\n }\n\n public function calculateFromAndToDatePeriod(\n string $frequency,\n ?Carbon $fromDate = null,\n ?Carbon $toDate = null\n ): array {\n if ($frequency === self::FREQUENCY_ONE_OFF) {\n return [\n 'fromDate' => $fromDate,\n 'toDate' => $toDate,\n ];\n }\n\n $now = Carbon::now();\n\n return match ($frequency) {\n self::FREQUENCY_DAILY => [\n 'fromDate' => $now->copy()->subDay()->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_WEEKLY => [\n 'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_MONTHLY => [\n 'fromDate' => $now->copy()->subMonths(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_QUARTERLY => [\n 'fromDate' => $now->copy()->subMonths(3)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n default => throw new InvalidArgumentException(\"Unsupported frequency: {$frequency}\"),\n };\n }\n\n private function calculateFromAndToDate(AutomatedReport $automatedReport): array\n {\n return $this->calculateFromAndToDatePeriod(\n $automatedReport->getFrequency(),\n $automatedReport->getFrom(),\n $automatedReport->getTo()\n );\n }\n\n public function getAskJiminnyGenerateReportPayload(\n AutomatedReport $automatedReport,\n AutomatedReportResult $reportResult,\n array $activityIds,\n ): array {\n return [\n 'user_question' => $automatedReport->getAskAnythingPrompt()?->getContent(),\n 'call_ids' => array_map('strval', $activityIds),\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResult->getUuid(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->getReportPeriodName($reportResult),\n 'report_name' => $automatedReport->getCustomName(),\n ];\n }\n\n private function getCallbackUrl(): string\n {\n return $this->webhookService->route('jiminny.webhook.reports.ready');\n }\n\n /**\n * Validate and transform payload data for automated reports\n *\n * @param array $data\n *\n * @throws InvalidArgumentException\n *\n * @return array\n */\n private function validateAndTransformData(array $data): array\n {\n // Validate organization (team) and check feature\n $team = $this->validateOrganization($data['organization'] ?? null);\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $type = $this->validateReportType($data['report_type'] ?? null);\n $frequency = $this->validateFrequency($data['frequency'] ?? null);\n $additionalPromptInput = $this->validateAdditionalPromptInput(\n $data['additional_prompt_input'] ?? null\n );\n $customReportName = $this->validateCustomReportName($data['custom_name'] ?? null);\n\n // Prepare data for the database\n $reportData = [\n 'team_id' => $team->getId(),\n 'type' => $type,\n 'status' => $status,\n 'frequency' => $frequency,\n 'additional_prompt_input' => $additionalPromptInput,\n 'custom_name' => $customReportName,\n ];\n\n // Validate deal values\n $reportData = $this->validateDealValues($data, $reportData);\n\n // Validate date range\n $reportData = $this->validateDateRange($data, $reportData, $frequency);\n\n // Validate call durations\n $reportData = $this->validateCallDurations($data, $reportData);\n\n // Validate call types\n $reportData = $this->validateCallTypes($data, $reportData);\n\n // Validate media types\n $reportData = $this->validateMediaTypes($data, $reportData);\n\n // Validate groups\n if (isset($data['teams'])) {\n $reportData['groups'] = $this->validateAndGetGroupIds($team, $data['teams']);\n }\n\n // Validate deal stages\n $reportData = $this->validateDealStages($data, $reportData, $team, $type);\n\n // Validate playbook categories\n $reportData = $this->validatePlaybookCategories($data, $reportData, $team);\n\n // Validate recipients\n $reportData['recipients'] = [\n 'users' => $this->validateAndGetUserIdsByTeam($team, $data['recipients'] ?? []),\n ];\n\n if (isset($data['jiminny_recipients'])) {\n // Validate Jiminny recipients\n $reportData['jiminny_recipients'] = [\n 'users' => $this->validateAndGetJiminnyUserIds((array) $data['jiminny_recipients']),\n ];\n }\n\n return $reportData;\n }\n\n private function validateDealValues(array $data, array $reportData): array\n {\n if (isset($data['min_deal_value'])) {\n $reportData['deal_value_min'] = (int) $data['min_deal_value'];\n\n if ($reportData['deal_value_min'] > 4294967295 || $reportData['deal_value_min'] < 0) {\n throw new InvalidArgumentException('Min deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_deal_value'])) {\n $reportData['deal_value_max'] = (int) $data['max_deal_value'];\n\n if ($reportData['deal_value_max'] > 4294967295 || $reportData['deal_value_max'] < 0) {\n throw new InvalidArgumentException('Max deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['min_deal_value'], $data['max_deal_value'])\n && $data['min_deal_value'] > $data['max_deal_value']\n ) {\n throw new InvalidArgumentException('Min deal value cannot be greater than max deal value');\n }\n\n return $reportData;\n }\n\n private function validateDateRange(array $data, array $reportData, string $frequency): array\n {\n // Set date range only for one_off frequency\n if ($frequency === 'one_off') {\n if (isset($data['start_date_period'])) {\n $reportData['from'] = $this->parseDate($data['start_date_period']);\n }\n\n if (isset($data['end_date_period'])) {\n $reportData['to'] = $this->parseDate($data['end_date_period']);\n }\n\n if (empty($reportData['from']) || empty($reportData['to'])) {\n throw new InvalidArgumentException(\n 'Start date and end date are required for one_off frequency'\n );\n }\n } else {\n $reportData['from'] = null;\n $reportData['to'] = null;\n }\n\n return $reportData;\n }\n\n private function validateCallDurations(array $data, array $reportData): array\n {\n // Convert call durations from minutes to seconds\n if (isset($data['min_call_duration'])) {\n $reportData['call_duration_min'] = (int) $data['min_call_duration'] * 60;\n\n if ($reportData['call_duration_min'] > 4294967295 || $reportData['call_duration_min'] < 0) {\n throw new InvalidArgumentException('Min call duration should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_call_duration'])) {\n $reportData['call_duration_max'] = (int) $data['max_call_duration'] * 60;\n\n if ($reportData['call_duration_max'] > 4294967295 || $reportData['call_duration_max'] < 0) {\n throw new InvalidArgumentException('Max call duration should be between 0 and 4294967295');\n }\n }\n\n return $reportData;\n }\n\n private function validateCallTypes(array $data, array $reportData): array\n {\n // Set call types\n $reportData['call_types'] = $data['call_type'] ?? [];\n if (empty($reportData['call_types'])) {\n $reportData['call_types'] = self::getCallTypes();\n }\n\n foreach ($reportData['call_types'] as $callType) {\n if (! in_array($callType, self::getCallTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Call type %s is invalid', $callType));\n }\n }\n\n return $reportData;\n }\n\n private function validateMediaTypes(array $data, array $reportData): array\n {\n // Set media types from input data\n $reportData['media_types'] = $data['media_types'] ?? [];\n\n if (empty($reportData['media_types'])) {\n throw new InvalidArgumentException('Media types are required');\n }\n\n foreach ($reportData['media_types'] as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n throw new InvalidArgumentException(sprintf('Media type %s is invalid', $mediaType));\n }\n }\n\n return $reportData;\n }\n\n private function validateDealStages(array $data, array $reportData, Team $team, string $reportType): array\n {\n // Validate and set deal stages\n if (isset($data['deal_stage_at_call'])) {\n $reportData['deal_at_call_stages'] =\n $this->validateAndGetDealStageIds($team, $data['deal_stage_at_call'], 'Deal stage at call');\n }\n\n if (isset($data['current_deal_stage'])) {\n $reportData['current_deal_stages'] =\n $this->validateAndGetDealStageIds($team, $data['current_deal_stage'], 'Current deal stage');\n }\n\n // Ensure current_deal_stage is not provided for loss_analysis report type\n if ($reportType === self::TYPE_LOSS_ANALYSIS && ! empty($data['current_deal_stage'])) {\n throw new InvalidArgumentException('Current deal stage is not applicable for Loss Analysis reports');\n }\n\n return $reportData;\n }\n\n // transform uuid to id\n private function validatePlaybookCategories(array $data, array $reportData, Team $team): array\n {\n $key = 'playbook_categories';\n\n if (isset($data[$key])) {\n $payloadIds = $data[$key];\n $ids = [];\n\n foreach ($payloadIds as $uuid) {\n $uuid = (string) $uuid;\n\n try {\n $playbookCategory = $this->playbookCategoryRepository->findByUuid($uuid);\n } catch (Throwable $throwable) {\n Log::error(__METHOD__ . ' ' . $throwable->getMessage());\n\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory) {\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory->hasPlaybook()) {\n throw new InvalidArgumentException(sprintf('Playbook category %s has no playbook', $uuid));\n }\n\n if ($playbookCategory->getPlaybook()->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Playbook category %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $ids[] = $playbookCategory->getId();\n }\n\n $reportData[$key] = $ids;\n }\n\n return $reportData;\n }\n\n private function validateReportStatus($status): bool\n {\n if (! in_array($status, [true, false], true)) {\n throw new InvalidArgumentException('Report status is invalid');\n }\n\n return $status;\n }\n\n private function validateReportType($type): string\n {\n if (! in_array($type, self::getTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Report type is invalid: %s', $type));\n }\n\n return $type;\n }\n\n private function validateFrequency($frequency): string\n {\n if (! in_array($frequency, self::getFrequencies(), true)) {\n throw new InvalidArgumentException('Frequency is invalid');\n }\n\n return $frequency;\n }\n\n private function validateAdditionalPromptInput(?string $additionalPromptInput): ?string\n {\n if ($additionalPromptInput && strlen($additionalPromptInput) > 5000) {\n throw new InvalidArgumentException('Additional Prompt Input should be less than 5000 characters');\n }\n\n return $additionalPromptInput;\n }\n\n private function validateCustomReportName(?string $customReportName): ?string\n {\n if ($customReportName === null || $customReportName === '') {\n return null;\n }\n\n if (strlen($customReportName) > 70) {\n throw new InvalidArgumentException('Custom report name should be less than 70 characters');\n }\n\n return $customReportName;\n }\n\n private function validateOrganization(?string $organizationUuid): Team\n {\n if (! $organizationUuid) {\n throw new InvalidArgumentException('Organization is required');\n }\n\n $team = $this->teamRepository->idOrUuid($organizationUuid);\n\n if (! $team) {\n throw new InvalidArgumentException('Organization not found');\n }\n\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n throw new InvalidArgumentException('Organization does not have the Automated Reports feature');\n }\n\n return $team;\n }\n\n private function validateAndGetGroupIds(Team $team, array $teamUuids): array\n {\n $groupIds = [];\n\n foreach ($teamUuids as $uuid) {\n $group = $this->groupRepository->findByUuid($uuid);\n\n if ($group === null || $group->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Group %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $groupIds[] = $group->getId();\n\n }\n\n return $groupIds;\n }\n\n private function validateAndGetDealStageIds(Team $team, array $stageUuids, string $propertyLabel): array\n {\n $stageIds = [];\n\n foreach ($stageUuids as $uuid) {\n $stage = $this->stageRepository->findByUuid($uuid);\n\n if ($stage === null || $stage->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Stage %s not found for team %s for %s', $uuid, $team->getUuid(), $propertyLabel)\n );\n }\n\n $stageIds[] = $stage->getId();\n }\n\n return $stageIds;\n }\n\n private function validateAndGetUserIds(array $userUuids, callable $teamCheck): array\n {\n if (empty($userUuids)) {\n return [];\n }\n\n $userIds = [];\n\n foreach ($userUuids as $uuid) {\n $user = $this->userRepository->findByUuid($uuid);\n\n if (! $user || ! $user->isStatusActive()) {\n throw new InvalidArgumentException(\n sprintf('User %s not found or is not active', $uuid)\n );\n }\n\n if (! $teamCheck($user)) {\n throw new InvalidArgumentException(\n sprintf('User %s does not belong to the allowed team(s)', $uuid)\n );\n }\n\n $userIds[] = $user->getId();\n }\n\n return $userIds;\n }\n\n private function validateAndGetUserIdsByTeam(Team $team, array $userUuids): array\n {\n return $this->validateAndGetUserIds($userUuids, fn ($user) => $user->getTeamId() === $team->getId());\n }\n\n private function validateAndGetJiminnyUserIds(array $userUuids): array\n {\n $allowedTeamIds = config('kiosk.teamIds', []);\n\n return $this->validateAndGetUserIds($userUuids, fn ($user) => in_array($user->getTeamId(), $allowedTeamIds, true));\n }\n\n private function parseDate(string $dateString): string\n {\n return date('Y-m-d H:i:s', strtotime($dateString));\n }\n\n private function generateReportResultViewUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.view', ['uuid' => $result->getUuid()]);\n }\n\n private function generateReportResultDownloadUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.download', ['uuid' => $result->getUuid()]);\n }\n\n private function getReportMediaRouteResource(AutomatedReportResult $result): string\n {\n if ($result->getMediaType() === self::MEDIA_TYPE_PDF) {\n return self::PDF_KEY;\n } elseif ($result->getMediaType() === self::MEDIA_TYPE_PODCAST) {\n return self::AUDIO_KEY;\n }\n\n throw new \\InvalidArgumentException('Unknown media type.');\n }\n\n public function getMediaPath(AutomatedReportResult $result): ?string\n {\n $url = match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => $result->getPdfUrl(),\n self::MEDIA_TYPE_PODCAST => $result->getPodcastAudioUrl(),\n default => null,\n };\n\n if ($url === null) {\n return null;\n }\n\n $path = parse_url(trim($url, '\"\\''), PHP_URL_PATH);\n\n return $path ?: null;\n }\n\n public function getFilenameSuffix(AutomatedReportResult $result): ?string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => 'Podcast',\n default => null,\n };\n }\n\n public function getMailSubjectSuffix(AutomatedReportResult $result): string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => 'report',\n self::MEDIA_TYPE_PODCAST => 'podcast',\n default => '',\n };\n }\n\n public function getMediaTypeMetadata(AutomatedReportResult $result): array\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => ['extension' => 'mp3', 'mime' => 'audio/mpeg'],\n self::MEDIA_TYPE_PDF => ['extension' => 'pdf', 'mime' => 'application/pdf'],\n default => ['extension' => null, 'mime' => null],\n };\n }\n\n public function deleteS3Files(AutomatedReportResult $result): void\n {\n $teamUuid = $result->getReport()->getTeam()->getUuid();\n $reportUuid = $result->getUuid();\n\n // delete all files for a report uuid no mather of pdf, podcast, or both\n // in case of both - the podcast files are linked to the pdf (parent) uuid\n // pdf and podcast date times should be close\n $path = sprintf('%s/%s/%s', $teamUuid, self::S3_DIR, $reportUuid);\n\n foreach (self::FILE_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted S3 file', [\n 'path' => $file,\n ]);\n }\n }\n\n foreach (self::FILE_PODCAST_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '_podcast.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted Podcast S3 file', [\n 'path' => $file,\n ]);\n }\n }\n }\n\n /**\n *\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): Collection\n {\n return $this->automatedReportsRepository->getTeamIdsWithReportsResults($teamId);\n }\n\n /**\n * Core delete logic for report results using a query\n *\n * @param Builder $query\n * @param array $logContext\n *\n * @return int\n */\n private function deleteReportResultsByQuery(Builder $query, array $logContext = []): int\n {\n $deletedCount = 0;\n\n if ($query->exists()) {\n Log::info(\n 'Run delete report results',\n array_merge(\n $logContext,\n [\n 'service' => 'AutomatedReportsService',\n ]\n )\n );\n\n $query->chunkById(50, function ($results) use (&$deletedCount, $logContext) {\n foreach ($results as $result) {\n $this->deleteReportResult($result);\n $deletedCount++;\n\n Log::info(\n 'Deleted a report result',\n array_merge(\n $logContext,\n [\n 'result_id' => $result->getId(),\n 'report_id' => $result->getReportId(),\n ]\n )\n );\n }\n });\n }\n\n return $deletedCount;\n }\n\n /**\n * Delete report results for a team by retention period\n *\n * @param Team $team\n * @param CarbonImmutable $retentionDate\n *\n * @return int Number of deleted report results\n */\n public function deleteReportsResultsInRetentionPeriod(Team $team, CarbonImmutable $retentionDate): int\n {\n $reportIds = $this->automatedReportsRepository->getReportIdsByTeam($team);\n\n if ($reportIds->isEmpty()) {\n return 0;\n }\n\n $query = $this->automatedReportsRepository\n ->getReportResultsQueryForRetention($team, $retentionDate);\n\n return $this->deleteReportResultsByQuery($query, [\n 'team_id' => $team->getId(),\n 'retention_date' => $retentionDate->toDateTimeString(),\n ]);\n }\n\n /**\n * Delete ALL report results for a specific automated report\n *\n * @param string $uuid\n *\n * @return int\n */\n public function deleteReportResults(string $uuid): int\n {\n $report = $this->getReport($uuid);\n\n $query = $this->automatedReportsRepository->getResultsByReportQuery($report);\n\n return $this->deleteReportResultsByQuery($query, [\n 'report_uuid' => $uuid,\n 'report_id' => $report->getId(),\n ]);\n }\n\n public function deleteReportResult(AutomatedReportResult $result): void\n {\n $this->deleteS3Files($result);\n\n $result->delete();\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getTeamReports(Team $team): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getReportsByTeam($team);\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getReportResults(AutomatedReport $report): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getResultsByReport($report);\n }\n\n public function deleteAllReportResults(AutomatedReport $report): void\n {\n $results = $this->getReportResults($report);\n\n /** @var AutomatedReportResult $result */\n foreach ($results as $result) {\n Log::info('Deleting result', [\n 'report' => $report->getId(),\n 'result' => $result->getId(),\n ]);\n\n $this->deleteReportResult($result);\n }\n }\n\n public function deleteAllData(Team $team): void\n {\n Log::info('Deleting automated report and results for team', [\n 'team' => $team->getId(),\n ]);\n\n $reports = $this->getTeamReports($team);\n\n /** @var AutomatedReport $report */\n foreach ($reports as $report) {\n Log::info('Deleting report', [\n 'team' => $team->getId(),\n 'report' => $report->getId(),\n ]);\n\n $this->deleteAllReportResults($report);\n\n $report->delete();\n }\n }\n}","depth":4,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Kiosk\\AutomatedReports;\n\nuse Carbon\\CarbonImmutable;\nuse Carbon\\CarbonInterface;\nuse Carbon\\Exceptions\\InvalidFormatException;\nuse DateTime;\nuse DateTimeInterface;\nuse DateTimeZone;\nuse Illuminate\\Contracts\\Bus\\Dispatcher as BusDispatcher;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Support\\Facades\\Log;\nuse Illuminate\\Support\\Facades\\Storage;\nuse Jiminny\\Component\\ActivitySearch\\FilterDefinition\\InputTypeEnum;\nuse Jiminny\\Component\\AskAnything\\AskAnythingPromptService;\nuse Jiminny\\Component\\AskAnything\\Dtos\\AskAnythingPromptDto;\nuse Jiminny\\Component\\UrlGenerator\\Webhook;\nuse Jiminny\\Contracts\\Repositories\\PlaybookCategoryRepository;\nuse Jiminny\\Contracts\\Repositories\\TeamRepository;\nuse Jiminny\\Contracts\\Repositories\\UserRepository;\nuse Jiminny\\Exceptions\\ApplicationException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Exceptions\\ModelNotFoundException;\nuse Jiminny\\Jobs\\AutomatedReports\\RequestGenerateReportJob;\nuse Jiminny\\Models\\Activity\\Search;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPrompt;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPromptTarget;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Contracts\\UserContract;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Repositories\\AskAnythingRepository;\nuse Jiminny\\Repositories\\AutomatedReportsRepository;\nuse Jiminny\\Repositories\\GroupRepository;\nuse Jiminny\\Repositories\\SearchRepository;\nuse Jiminny\\Repositories\\StageRepository;\nuse Throwable;\n\nclass AutomatedReportsService\n{\n public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';\n public const string TYPE_ASK_JIMINNY = 'ask_jiminny';\n\n /**\n * Standard report types (used by kiosk for existing automated reports).\n */\n // @TODO this will add filter, however if we need to control feature by FF we need conditional logic\n public const array TYPES = [\n ['id' => 'exec_summary', 'name' => 'Exec Summary'],\n ['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],\n ['id' => 'product_feedback', 'name' => 'Product Feedback'],\n ['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],\n// ['id' => 'questions', 'name' => 'Questions'],\n// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],\n ];\n\n public const array ALL_TYPES = [\n ...self::TYPES,\n ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],\n ];\n\n public const string FREQUENCY_DAILY = 'daily';\n public const string FREQUENCY_WEEKLY = 'weekly';\n public const string FREQUENCY_MONTHLY = 'monthly';\n public const string FREQUENCY_QUARTERLY = 'quarterly';\n public const string FREQUENCY_ONE_OFF = 'one_off';\n\n /**\n * Frequencies for standard (non-Ask Jiminny) reports.\n */\n public const array FREQUENCIES = [\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n\n /**\n * Frequencies for Ask Jiminny reports.\n */\n public const array ASK_JIMINNY_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ];\n\n public const string MEDIA_TYPE_PDF = 'pdf';\n public const string MEDIA_TYPE_PODCAST = 'podcast';\n public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];\n public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];\n public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];\n public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];\n\n public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];\n public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];\n public const int SENT_REPORT_AT_HOURS = 5;\n public const string PDF_KEY = 'pdf';\n public const string AUDIO_KEY = 'audio';\n\n private const array ALL_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n private const string S3_DIR = 'reports';\n private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];\n private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];\n\n public function __construct(\n private readonly TeamRepository $teamRepository,\n private readonly GroupRepository $groupRepository,\n private readonly UserRepository $userRepository,\n private readonly StageRepository $stageRepository,\n private readonly DealStagesService $dealStagesService,\n private readonly RecipientsService $recipientsService,\n private readonly AutomatedReportsRepository $automatedReportsRepository,\n private readonly Webhook $webhookService,\n private readonly BusDispatcher $dispatcher,\n private readonly ActivityTypeService $activityTypeService,\n private readonly PlaybookCategoryRepository $playbookCategoryRepository,\n private readonly AskAnythingPromptService $askAnythingPromptService,\n private readonly SearchRepository $activitySearchRepository,\n private readonly AskAnythingRepository $askAnythingRepository,\n ) {\n }\n\n public static function getTypes(): array\n {\n $types = self::TYPES;\n\n return array_map(static function ($type) {\n return $type['id'];\n }, $types);\n }\n\n public static function getCallTypes(): array\n {\n return array_map(static function ($callType) {\n return $callType['id'];\n }, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);\n }\n\n public static function getFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::FREQUENCIES);\n }\n\n // front-facing structure\n public function getReportEnabledFieldData(bool $value = false): array\n {\n return [\n 'id' => 'report_enabled',\n 'label' => '',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'value' => $value,\n ];\n }\n\n // Organizations = Teams\n public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array\n {\n $options = $this->getTeams();\n\n if ($shortVersion) {\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value,\n 'dependencies' => [\n 'teams',\n 'deal_stage_at_call',\n 'current_deal_stage',\n 'recipients',\n ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,\n ],\n 'dependsOn' => [],\n ];\n }\n\n // Teams = Groups\n public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array\n {\n if ($shortVersion) {\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value, // value should be an array of objects {id, name}\n 'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],\n 'dependsOn' => [],\n ];\n }\n\n public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array\n {\n $types = [];\n if ($team instanceof Team) {\n if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n $types = self::TYPES;\n }\n if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {\n $types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];\n }\n } else {\n $types = self::TYPES;\n }\n\n if ($shortVersion) {\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'options' => $types,\n ];\n }\n\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $types,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getFrequencyFieldData(?string $value = null): array\n {\n return [\n 'id' => 'frequency',\n 'label' => 'Frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::FREQUENCIES,\n 'value' => $value,\n 'dependencies' => ['period'],\n 'dependsOn' => [],\n ];\n }\n\n public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array\n {\n return [\n 'id' => 'period',\n 'label' => 'Select one-off period',\n 'inputType' => InputTypeEnum::DATE_RANGE,\n 'required' => true,\n 'placeholder' => 'Select',\n 'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],\n 'queryParams' => [\n 'startDate' => 'start_date_period',\n 'endDate' => 'end_date_period',\n ],\n 'dependencies' => [],\n 'dependsOn' => ['frequency'],\n ];\n }\n\n public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array\n {\n return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);\n }\n\n public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);\n }\n\n public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);\n }\n\n public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'deal_value',\n 'label' => 'Deal Value',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_deal_value',\n 'max' => 'max_deal_value',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array\n {\n $value = [];\n $conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;\n $dialerOn && $value[] = self::CALL_TYPE_DIALER;\n\n return [\n 'id' => 'call_type',\n 'label' => 'Call Type',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => [\n self::CALL_TYPE_CONFERENCE,\n self::CALL_TYPE_DIALER,\n ],\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getMediaTypeFieldData(?AutomatedReport $report = null): array\n {\n $value = [];\n\n if ($report) {\n $value = $this->transformMediaTypes($report);\n }\n\n return [\n 'id' => 'media_types',\n 'label' => 'Export as',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => self::MEDIA_TYPE_OBJECTS,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'call_duration',\n 'label' => 'Call Duration',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_call_duration',\n 'max' => 'max_call_duration',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getRecipientsFieldData(?Team $team = null, array $value = []): array\n {\n return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);\n }\n\n public function getJiminnyRecipientsFieldData(array $value = []): array\n {\n return $this->recipientsService->getJiminnyRecipientsFieldData($value);\n }\n\n public function getAdditionalPromptInputFieldData(?string $value = null): array\n {\n return [\n 'id' => 'additional_prompt_input',\n 'label' => 'Special requirements',\n 'inputType' => InputTypeEnum::TEXTAREA,\n 'required' => false,\n 'placeholder' => 'What should be the focus of the report?',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCustomReportNameFieldData(?string $value = null): array\n {\n return [\n 'id' => 'custom_name',\n 'label' => 'Custom report name',\n 'inputType' => InputTypeEnum::TEXT,\n 'required' => false,\n 'placeholder' => 'Enter custom name',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n // data providers\n public function getTeams(): array\n {\n $teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);\n\n $teamData = [];\n foreach ($teams as $team) {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n continue;\n }\n\n $teamData[] = $this->transformTeam($team);\n }\n\n return $teamData;\n }\n\n public function getTeamGroups(string $teamUuid): array\n {\n $data = [];\n $team = $this->getTeam($teamUuid);\n\n if ($team !== null) {\n $groups = $team->groups()->get();\n\n foreach ($groups as $group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n public function getTeamsGroupsOptions(array $filterTeamUuids = []): array\n {\n $data = [];\n $teams = $this->getTeams();\n\n foreach ($teams as $team) {\n if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {\n continue;\n }\n\n $data[] = [\n 'label' => $team['name'],\n 'groups' => $this->getTeamGroups($team['id']),\n ];\n }\n\n return $data;\n }\n\n public function getTeam(string $teamUuid): ?Team\n {\n return $this->teamRepository->idOrUuid($teamUuid);\n }\n\n public function getTeamById(int $teamId): ?Team\n {\n return $this->teamRepository->find($teamId);\n }\n\n public function getGroupsUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportGroups = $report->getGroups();\n foreach ($reportGroups as $groupId) {\n if ($group = $this->groupRepository->find($groupId)) {\n $uuids[] = $group->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getPlaybookCategoriesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $playbookCategories = $report->getPlaybookCategories();\n foreach ($playbookCategories as $id) {\n if ($category = $this->playbookCategoryRepository->find($id)) {\n $uuids[] = $category->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getDealAtCallStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getDealAtCallStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getCurrentDealStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getCurrentDealStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getRecipients());\n }\n\n public function getJiminnyUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function extractUserUuids(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => $user->getUuid())\n ->values()\n ->all();\n }\n\n // get mail data\n public function getRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getRecipients());\n }\n\n /**\n * @return array<UserContract>\n */\n public function getRecipientUserObjects(AutomatedReport $report): array\n {\n $userIds = $report->getRecipients()['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->values()\n ->all();\n }\n\n private function getJiminnyRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function buildRecipientUsers(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => [\n 'email' => $user->getEmailAddress(),\n 'name' => $user->getName(),\n 'timezone' => $user->getTimezone()->getName(),\n ])\n ->values()\n ->all();\n }\n\n public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array\n {\n if ($report->isAskJiminnyReport()) {\n $recipients = $this->resolveAskJiminnyRecipients($report);\n } else {\n $recipients = $this->getRecipientUsers($report);\n if ($includeJiminny) {\n $recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));\n }\n }\n\n $emails = [];\n\n return array_values(array_filter(\n $recipients,\n static function ($recipient) use (&$emails) {\n if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {\n return false;\n }\n $emails[] = $recipient['email'];\n\n return true;\n }\n ));\n }\n\n private function resolveAskJiminnyRecipients(AutomatedReport $report): array\n {\n $recipients = [];\n\n $creator = $report->getCreator();\n if ($creator !== null) {\n $recipients[] = [\n 'email' => $creator->getEmailAddress(),\n 'name' => $creator->getName(),\n 'timezone' => $creator->getTimezone()->getName(),\n ];\n }\n\n return array_merge(\n $recipients,\n $this->buildRecipientUsers($report->getRecipients()),\n $this->getGroupRecipientUsers($report),\n );\n }\n\n private function getGroupRecipientUsers(AutomatedReport $report): array\n {\n $users = [];\n foreach ($report->getGroups() as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group === null) {\n continue;\n }\n foreach ($group->getMembers() as $member) {\n $users[] = [\n 'email' => $member->getEmailAddress(),\n 'name' => $member->getName(),\n 'timezone' => $member->getTimezone()->getName(),\n ];\n }\n }\n\n return $users;\n }\n\n public function getReportTypeName(AutomatedReportResult $report): string\n {\n $type = $report->getReport()->getType();\n\n $getType = $this->transformReportType($type);\n\n return $getType['name'];\n }\n\n public function getReportPeriodName(AutomatedReportResult $report): string\n {\n $from = $report->getFromDate();\n $to = $report->getToDate();\n $frequency = $report->getReport()->getFrequency();\n\n if ($from === null || $to === null) {\n if (! $report->getReport()->isAskJiminnyReport()) {\n $invalidPeriod = $from === null ? 'from' : 'to';\n\n throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);\n }\n\n $period = $this->calculateFromAndToDatePeriod($frequency);\n $from = $period['fromDate'];\n $to = $period['toDate'];\n }\n\n return $this->formatReportPeriodName($frequency, $from, $to);\n }\n\n private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string\n {\n $fromYear = $from->format('Y');\n $toYear = $to->format('Y');\n $differentYears = $fromYear !== $toYear;\n\n switch ($frequency) {\n case self::FREQUENCY_DAILY:\n return $from->format('j M Y');\n\n case self::FREQUENCY_QUARTERLY:\n // 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ\n $startMonth = $from->format('M');\n $endMonth = $to->copy()->subMonth();\n $endMonthName = $endMonth->format('M');\n $endMonthYear = $endMonth->format('Y');\n\n if ($differentYears) {\n return \"{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}\";\n }\n\n return \"{$startMonth} - {$endMonthName} {$toYear}\";\n\n case self::FREQUENCY_MONTHLY:\n // 'May 2025' - monthly reports are always within the same year\n return $from->format('M Y');\n\n case self::FREQUENCY_WEEKLY:\n // '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ\n $startDay = $from->format('j');\n $endDay = $to->format('j');\n $startMonth = $from->format('M');\n $endMonth = $to->format('M');\n\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n if ($startMonth !== $endMonth) {\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n return \"{$startDay} - {$endDay} {$endMonth} {$toYear}\";\n\n case self::FREQUENCY_ONE_OFF:\n // '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ\n $startDay = $from->format('j');\n $startMonth = $from->format('M');\n $endDay = $to->format('j');\n $endMonth = $to->format('M');\n\n // If same month and year, use a format like '2-31 May 2025'\n if ($startMonth === $endMonth && ! $differentYears) {\n return \"{$startDay} - {$endDay} {$startMonth} {$toYear}\";\n }\n\n // If different years, include both years\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n // Same year but different months\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n\n default:\n // Default format for unknown frequencies\n return $from->format('j M Y') . ' - ' . $to->format('j M Y');\n }\n }\n\n public function getReportTeamsName(AutomatedReportResult $report): string\n {\n $groups = $report->getGroups();\n\n if (empty($groups)) {\n return 'All';\n }\n\n // Get group names from repository\n $groupNames = [];\n foreach ($groups as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group) {\n $groupNames[] = $group->getName();\n }\n }\n\n if (count($groupNames) === 1) {\n // Single team format\n $teamsName = $groupNames[0];\n } else {\n // Multiple teams format\n $teamsName = implode(', ', $groupNames);\n }\n\n return $teamsName;\n }\n\n public function getReportFileName(AutomatedReportResult $report): string\n {\n $customName = $report->getReport()->getCustomName();\n $periodName = $this->getReportPeriodName($report);\n $filenameSuffix = $this->getFilenameSuffix($report);\n\n if ($customName) {\n if ($filenameSuffix) {\n $customName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$customName} - {$periodName}\");\n }\n\n $baseName = $this->getReportTypeName($report);\n\n if ($filenameSuffix) {\n $baseName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}\");\n }\n\n public function getReportFileNameWithExtension(AutomatedReportResult $result): string\n {\n $extension = $this->getMediaTypeMetadata($result)['extension'];\n\n return $this->getReportFileName($result) . '.' . $extension;\n }\n\n public function sanitizeFileName(string $fileName): string\n {\n return str_replace(['/', '\\\\'], '-', $fileName);\n }\n\n public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool\n {\n $recipients = array_map('intval', $report->getRecipients()['users'] ?? []);\n\n return in_array($user->getId(), $recipients);\n }\n\n public function transformReportResults(Collection $automatedReportResults): array\n {\n $data = [];\n foreach ($automatedReportResults as $automatedReportResult) {\n /** @var AutomatedReportResult $automatedReportResult */\n\n $report = $automatedReportResult->getReport();\n\n $createdBy = $report->getCreator();\n $creator = [\n 'id' => $createdBy?->getUuid(),\n 'name' => $createdBy?->getName(),\n 'email' => $createdBy?->getEmailAddress(),\n 'photoUrl' => $createdBy?->getPhotoUrl(),\n ];\n\n $recipients = $this->buildRecipients($report);\n\n $data[] = [\n 'id' => $automatedReportResult->getUuid(),\n 'name' => $automatedReportResult->getName(),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n 'recipients' => $recipients,\n 'recipients' => [\n ...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),\n ...array_values($this->transformRecipients($report->getRecipients())),\n ],\n 'report_type' => $this->transformReportType($report->getType()),\n 'media_type' => $automatedReportResult->getMediaType(),\n 'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),\n 'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),\n 'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),\n 'creator' => $creator,\n ];\n \n \n }\n\n return $data;\n }\n\n private function buildRecipients(AutomatedReport $report)\n {\n \n }\n\n public function hasCallTypeConference(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);\n }\n\n public function hasCallTypeDialer(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);\n }\n\n // transformers\n private function transformTeam(Team $team): array\n {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n return [];\n }\n\n return [\n 'id' => $team->getUuid(),\n 'name' => $team->getName(),\n ];\n }\n\n private function transformReportFullView(AutomatedReport $report): array\n {\n $base = $this->transformReportBase($report);\n\n return $report->getType() === self::TYPE_ASK_JIMINNY\n ? $base + $this->transformAskJiminnyFields($report)\n : $base + $this->transformStandardReportFields($report);\n }\n\n private function transformReportBase(AutomatedReport $report): array\n {\n return [\n 'id' => $report->getUuid(),\n 'organization' => $this->transformOrganization(team: $report->getTeam()),\n 'report_type' => $this->transformReportType($report->getType()),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n ];\n }\n\n private function transformStandardReportFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n\n return [\n 'report_enabled' => $report->getStatus(),\n 'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),\n 'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),\n 'deal_value_min' => $report->getDealValueMin(),\n 'deal_value_max' => $report->getDealValueMax(),\n 'call_types' => $this->transformCallType($report->getCallTypes()),\n 'media_types' => $this->transformMediaTypes($report),\n 'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),\n 'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),\n 'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),\n 'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),\n 'recipients' => $this->transformRecipients($report->getRecipients()),\n 'created_by' => $this->transformCreator($report->getCreator()),\n 'additional_prompt_input' => $report->getAdditionalPromptInput(),\n 'custom_name' => $report->getCustomName(),\n 'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),\n 'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),\n 'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),\n ];\n }\n\n private function transformAskJiminnyFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n $creatorId = $report->getAttribute('created_by');\n $explicitUserIds = array_values(array_filter(\n $report->getRecipients()['users'] ?? [],\n static fn ($id) => $id !== $creatorId\n ));\n\n return [\n 'report_name' => $report->getCustomName(),\n 'enabled' => $report->getStatus(),\n 'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),\n 'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),\n 'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),\n 'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),\n ];\n }\n\n private function transformOrganization(?Team $team): array\n {\n return [\n 'id' => $team?->getUuid(),\n 'name' => $team?->getName(),\n ];\n }\n\n private function transformReportType(string $type): array\n {\n foreach (self::ALL_TYPES as $typeItem) {\n if ($typeItem['id'] === $type) {\n return $typeItem;\n }\n }\n\n return [];\n }\n\n private function transformCallType(array $types): array\n {\n $result = [];\n $callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];\n\n foreach ($types as $type) {\n foreach ($callTypes as $callTypeItem) {\n if ($callTypeItem['id'] === $type) {\n $result[] = $callTypeItem;\n\n break;\n }\n }\n }\n\n return $result;\n }\n\n private function transformMediaTypes(AutomatedReport $report): array\n {\n $values = [];\n\n foreach ($report->getMediaTypes() as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n continue;\n }\n\n $values[] = match ($mediaType) {\n self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,\n self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,\n };\n }\n\n return $values;\n }\n\n private function transformFrequency(string $frequency): array\n {\n foreach (self::ALL_FREQUENCIES as $frequencyItem) {\n if ($frequencyItem['id'] === $frequency) {\n return $frequencyItem;\n }\n }\n\n return [];\n }\n\n public function transformDurationToMinutes(?int $duration): ?int\n {\n if (! $duration) {\n return null;\n }\n\n return (int) ($duration / 60);\n }\n\n private function transformGroups(?Team $team, array $groupsIds): array\n {\n if (empty($groupsIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($groupsIds as $groupId) {\n $group = $team->groups()->where('id', $groupId)->first();\n\n if ($group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n 'photoUrl' => $group->getPhotoUrl(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformStages(?Team $team, array $stagesIds): array\n {\n if (empty($stagesIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($stagesIds as $stageId) {\n $stage = $team->stages()->where('id', $stageId)->first();\n\n if ($stage) {\n $data[] = [\n 'id' => $stage->getUuid(),\n 'name' => $stage->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformRecipients(array $recipients): array\n {\n $users = [];\n foreach ($recipients['users'] ?? [] as $userId) {\n $users[] = $this->transformUser($userId);\n }\n\n return $users;\n }\n\n private function transformCreator(?User $user): ?array\n {\n if ($user === null) {\n return null;\n }\n\n return $this->transformUser($user->getId());\n }\n\n private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array\n {\n if ($prompt === null) {\n return null;\n }\n\n return [\n 'id' => $prompt->getUuid(),\n 'name' => $prompt->getTitle(),\n ];\n }\n\n private function transformSafeSearch(?Search $search): ?array\n {\n if ($search === null) {\n return null;\n }\n\n return [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ];\n }\n\n private function transformUser(int $userId): array\n {\n /* @var ?User $user */\n $user = $this->userRepository->find($userId);\n\n return [\n 'id' => $user?->getUuid(),\n 'name' => $user?->getName(),\n 'email' => $user?->getEmailAddress(),\n 'photoUrl' => $user?->getPhotoUrl(),\n ];\n }\n\n public function create(array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $validatedData['created_by'] = auth()->id();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function update(string $uuid, array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $report = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $report) {\n throw new InvalidArgumentException('Report not found');\n }\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Create an Ask Jiminny report.\n */\n public function createAskJiminnyReport(array $data, User $creator): array\n {\n $validatedData = $this->validateAskJiminnyReportData($data, $creator);\n $validatedData['created_by'] = $creator->getId();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Update an Ask Jiminny report.\n */\n public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array\n {\n if (! $report->isAskJiminnyReport()) {\n throw new InvalidArgumentException('Report is not an Ask Jiminny report');\n }\n\n $validatedData = $this->validateAskJiminnyReportData($data, $user);\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array\n {\n $this->automatedReportsRepository->update($report, ['status' => $status]);\n\n return $this->transformReportFullView($report->fresh());\n }\n\n /**\n * Validate and transform data for Ask Jiminny reports.\n */\n private function validateAskJiminnyReportData(array $data, User $user): array\n {\n // Validate name\n $name = trim($data['report_name'] ?? '');\n if (empty($name)) {\n throw new InvalidArgumentException('Report name is required');\n }\n if (mb_strlen($name) > 50) {\n throw new InvalidArgumentException('Report name must be 50 characters or less');\n }\n\n // Validate frequency (only daily, weekly, monthly for Ask Jiminny)\n $frequency = $data['frequency'] ?? null;\n $askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];\n if (! in_array($frequency, $askJiminnyFrequencies, true)) {\n throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');\n }\n\n // Validate expiration date\n $expiresAt = $data['expires_on'] ?? null;\n if (empty($expiresAt)) {\n throw new InvalidArgumentException('Expiration date is required');\n }\n\n try {\n $expiresAtDate = Carbon::parse($expiresAt);\n } catch (InvalidFormatException $e) {\n throw new InvalidArgumentException('Expiration date format is invalid');\n }\n $maxExpiration = Carbon::now()->addYear()->endOfDay();\n if ($expiresAtDate->gt($maxExpiration)) {\n throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');\n }\n if ($expiresAtDate->isPast()) {\n throw new InvalidArgumentException('Expiration date cannot be in the past');\n }\n\n // Validate saved search\n $activitySearchId = $data['saved_search'] ?? null;\n if (empty($activitySearchId)) {\n throw new InvalidArgumentException('Saved search is required');\n }\n $savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);\n if (! $savedSearch) {\n throw new InvalidArgumentException('Saved search not found or does not belong to you');\n }\n\n // Validate saved prompt\n $askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;\n if (empty($askAnythingPromptId)) {\n throw new InvalidArgumentException('Ask Jiminny prompt is required');\n }\n $prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);\n if (! $prompt) {\n throw new InvalidArgumentException('Ask Jiminny prompt not found');\n }\n\n // Validate status\n $status = $data['enabled'] ?? false;\n\n $recipientUserIds = [$user->getId()];\n\n if (! empty($data['share_users'])) {\n $sharedUserIds = $this->validateAndGetUserIdsByTeam(\n $user->team,\n (array) $data['share_users']\n );\n $recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);\n }\n\n $sharedGroupIds = [];\n if (! empty($data['share_teams'])) {\n $sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);\n }\n\n $recipientUserIds = array_values(array_unique($recipientUserIds));\n\n return [\n 'team_id' => $user->getTeamId(),\n 'type' => self::TYPE_ASK_JIMINNY,\n 'status' => (bool) $status,\n 'frequency' => $frequency,\n 'custom_name' => $name,\n 'activity_search_id' => $savedSearch->getId(),\n 'ask_anything_prompt_id' => $prompt->getId(),\n 'expires_at' => $expiresAtDate->toDateString(),\n 'media_types' => [self::MEDIA_TYPE_PDF],\n 'call_types' => [],\n 'recipients' => ['users' => $recipientUserIds],\n 'groups' => $sharedGroupIds,\n ];\n }\n\n public static function getAskJiminnyFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::ASK_JIMINNY_FREQUENCIES);\n }\n\n public function getAskJiminnyReportFilters(User $user): array\n {\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n return [\n [\n 'id' => 'prompt',\n 'label' => 'Prompt',\n 'options' => $prompts,\n ],\n [\n 'id' => 'saved_search',\n 'label' => 'Saved Search',\n 'options' => $savedSearches,\n ],\n ];\n }\n\n public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array\n {\n $team = $user->getTeam();\n $userTimezone = $user->getTimezone();\n\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n $teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ])->values()->all();\n\n $shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];\n\n $sharedTeamsValue = [];\n $sharedUsersValue = [];\n if ($report) {\n $sharedTeamsValue = $this->transformGroups($team, $report->getGroups());\n\n $recipientUserIds = $report->getRecipients()['users'] ?? [];\n $creatorId = $report->getAttribute('created_by');\n $sharedUserIds = array_values(array_filter(\n $recipientUserIds,\n static fn ($id) => $id !== $creatorId\n ));\n $sharedUsersValue = collect($sharedUserIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (User $u) => [\n 'id' => $u->getUuid(),\n 'name' => $u->getName(),\n ])\n ->values()\n ->all();\n }\n\n return [\n 'fields' => [\n [\n 'id' => 'enabled',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'label' => '',\n 'value' => $report?->getStatus() ?? false,\n ],\n [\n 'id' => 'report_name',\n 'inputType' => InputTypeEnum::TEXT,\n 'label' => 'Name',\n 'placeholder' => 'Enter name',\n 'required' => true,\n 'validation' => ['maxLength' => 50],\n 'value' => $report?->getCustomName() ?? '',\n ],\n [\n 'id' => 'frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Frequency',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::ASK_JIMINNY_FREQUENCIES,\n 'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,\n ],\n [\n 'id' => 'expires_on',\n 'inputType' => InputTypeEnum::DATE,\n 'label' => 'Expires on',\n 'required' => true,\n 'placeholder' => 'Select',\n 'validation' => [\n 'minDate' => now($userTimezone)->toDateString(),\n 'maxDate' => now($userTimezone)->addYear()->toDateString(),\n ],\n 'value' => $report?->getExpiresAt()?->toDateString(),\n ],\n [\n 'id' => 'share_teams',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team',\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $teamGroups,\n 'value' => $sharedTeamsValue,\n ],\n [\n 'id' => 'share_users',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team member',\n 'required' => false,\n 'placeholder' => 'Select',\n 'groupLabelKey' => 'label',\n 'groupValuesKey' => 'users',\n 'optionLabelKey' => 'name',\n 'optionValueKey' => 'id',\n 'options' => $shareUsers,\n 'value' => $sharedUsersValue,\n ],\n [\n 'id' => 'saved_search',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Saved search',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $savedSearches,\n 'value' => $report && $report->getSavedSearch() ? [\n 'id' => $report->getSavedSearch()->getUuid(),\n 'name' => $report->getSavedSearch()->getName(),\n ] : null,\n ],\n [\n 'id' => 'ask_jiminny_prompt',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Ask Jiminny prompt',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $prompts,\n 'value' => $report && $report->getAskAnythingPrompt() ? [\n 'id' => $report->getAskAnythingPrompt()->getUuid(),\n 'name' => $report->getAskAnythingPrompt()->getTitle(),\n ] : null,\n ],\n ],\n ];\n }\n\n private function updateResultNames(AutomatedReport $automatedReport): void\n {\n $results = $this->automatedReportsRepository->getResultsByReport($automatedReport);\n\n foreach ($results as $result) {\n $result->update(['name' => $this->getReportFileName($result)]);\n }\n }\n\n public function updateStatus(string $uuid, array $data): array\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $automatedReport->update([\n 'status' => $status,\n ]);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n private function generateOneOffReport(AutomatedReport $automatedReport): void\n {\n // the scheduler handles all the other frequency types\n if ($automatedReport->getStatus() === false || $automatedReport->getFrequency() !== self::FREQUENCY_ONE_OFF) {\n return;\n }\n\n $this->dispatcher->dispatch(new RequestGenerateReportJob($automatedReport->getUuid()));\n }\n\n public function getReport(string $uuid): AutomatedReport\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n return $automatedReport;\n }\n\n public function get(string $uuid): array\n {\n $automatedReport = $this->getReport($uuid);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function list(string $sortColumn = 'created_at', string $sortDirection = 'desc'): array\n {\n $results = [];\n $collection = $this->automatedReportsRepository->getAllStandardReports($sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function listAskJiminnyReports(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): array {\n $results = [];\n $collection = $this->automatedReportsRepository->getAskJiminnyReportsByUser($user, $sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function delete(string $uuid): void\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $automatedReport->delete();\n }\n\n public function createReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n return $this->automatedReportsRepository->createResult(\n array_merge(\n [\n 'report_id' => $automatedReport->getId(),\n 'status' => AutomatedReportResult::STATUS_DEFAULT,\n ],\n $data\n )\n );\n }\n\n public function getOrCreateReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n $existing = $this->automatedReportsRepository->findLatestDefaultOrFailedResult($automatedReport);\n\n if ($existing !== null) {\n $existing->update(['status' => AutomatedReportResult::STATUS_DEFAULT]);\n\n return $existing;\n }\n\n return $this->createReportResult($automatedReport, $data);\n }\n\n public function getReportResult(string $resultUuid): AutomatedReportResult\n {\n $report = $this->automatedReportsRepository->findResultByUuid($resultUuid);\n\n if (! $report) {\n throw new ModelNotFoundException('Report Result not found');\n }\n\n return $report;\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return $this->automatedReportsRepository->findChildResult($result, $type);\n }\n\n // prophet API calls\n /**\n * @throws ApplicationException\n */\n public function getGenerateReportPayload(AutomatedReport $automatedReport, string $reportResultUuid): array\n {\n $period = $this->calculateFromAndToDate($automatedReport);\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n return [\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResultUuid,\n 'report_type' => $automatedReport->getType(),\n 'media_types' => $automatedReport->getMediaTypes(),\n 'from_date' => $fromDate->startOfDay()->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->endOfDay()->format(DateTimeInterface::RFC3339),\n 'group_ids' => $automatedReport->getGroups(),\n 'call_deal_stage' => $automatedReport->getDealAtCallStages(),\n 'current_deal_stage' => $automatedReport->getCurrentDealStages(),\n 'deal_min_value' => $automatedReport->getDealValueMin(),\n 'deal_max_value' => $automatedReport->getDealValueMax(),\n 'call_types' => $automatedReport->getCallTypes(),\n 'call_duration_min_seconds' => $automatedReport->getCallDurationMin(),\n 'call_duration_max_seconds' => $automatedReport->getCallDurationMax(),\n 'special_requirements' => $automatedReport->getAdditionalPromptInput(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->formatReportPeriodName(\n $automatedReport->getFrequency(),\n $fromDate,\n $toDate,\n ),\n 'playbook_categories' => $automatedReport->getPlaybookCategories(),\n 'custom_name' => $automatedReport->getCustomName(),\n ];\n }\n\n // $inputPayload - FE payload structure\n public function getActivitiesCountPayload(array $inputPayload): array\n {\n // Use validateAndTransformData to validate and normalize input\n $validatedData = $this->validateAndTransformData($inputPayload);\n $period = $this->calculateFromAndToDatePeriod(\n $validatedData['frequency'],\n Carbon::parse($validatedData['from']),\n Carbon::parse($validatedData['to']),\n );\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n // Create payload similar to getGenerateReportPayload\n return [\n 'team_id' => $validatedData['team_id'],\n 'group_ids' => $validatedData['groups'] ?? [],\n 'report_type' => $validatedData['type'],\n 'from_date' => $fromDate->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->format(DateTimeInterface::RFC3339),\n 'call_deal_stage' => $validatedData['deal_at_call_stages'] ?? [],\n 'current_deal_stage' => $validatedData['current_deal_stages'] ?? [],\n 'deal_min_value' => $validatedData['deal_value_min'] ?? null,\n 'deal_max_value' => $validatedData['deal_value_max'] ?? null,\n 'call_types' => $validatedData['call_types'],\n 'call_duration_min_seconds' => $validatedData['call_duration_min'] ?? null,\n 'call_duration_max_seconds' => $validatedData['call_duration_max'] ?? null,\n 'special_requirements' => $validatedData['additional_prompt_input'] ?? null,\n 'playbook_categories' => $validatedData['playbook_categories'] ?? [],\n 'request_id' => null,\n 'callback_url' => null,\n ];\n }\n\n public function shouldSendReport(array $users, ?CarbonInterface $generatedAt = null): bool\n {\n if (empty($users)) {\n return false;\n }\n\n $earliestTz = collect($users)\n ->mapWithKeys(function (array $user) {\n $tz = new DateTimeZone($user['timezone']);\n $nowUtc = new DateTime('now', new DateTimeZone('UTC'));\n $offset = $tz->getOffset($nowUtc);\n\n return [$user['timezone'] => $offset];\n })\n ->sortDesc()\n ->keys()\n ->first();\n\n $now = Carbon::now($earliestTz);\n $isScheduledTime = (int) $now->format('H') === self::SENT_REPORT_AT_HOURS;\n\n if ($isScheduledTime) {\n return true;\n }\n\n return $this->hasPassedScheduledTime($generatedAt, $earliestTz);\n }\n\n public function hasPassedScheduledTime(?CarbonInterface $generatedAt, string $timezone): bool\n {\n if ($generatedAt === null) {\n return false;\n }\n\n $now = Carbon::now($timezone);\n $scheduledTime = $now->copy()->setTime(self::SENT_REPORT_AT_HOURS, 0, 0);\n\n if ($now->hour < self::SENT_REPORT_AT_HOURS) {\n $scheduledTime = $scheduledTime->subDay();\n }\n\n $scheduledTimeUtc = $scheduledTime->copy()->utc();\n $generatedAtUtc = $generatedAt->copy()->utc();\n $nowUtc = $now->copy()->utc();\n\n return $generatedAtUtc->lt($scheduledTimeUtc) && $nowUtc->gt($scheduledTimeUtc);\n }\n\n public function calculateFromAndToDatePeriod(\n string $frequency,\n ?Carbon $fromDate = null,\n ?Carbon $toDate = null\n ): array {\n if ($frequency === self::FREQUENCY_ONE_OFF) {\n return [\n 'fromDate' => $fromDate,\n 'toDate' => $toDate,\n ];\n }\n\n $now = Carbon::now();\n\n return match ($frequency) {\n self::FREQUENCY_DAILY => [\n 'fromDate' => $now->copy()->subDay()->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_WEEKLY => [\n 'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_MONTHLY => [\n 'fromDate' => $now->copy()->subMonths(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_QUARTERLY => [\n 'fromDate' => $now->copy()->subMonths(3)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n default => throw new InvalidArgumentException(\"Unsupported frequency: {$frequency}\"),\n };\n }\n\n private function calculateFromAndToDate(AutomatedReport $automatedReport): array\n {\n return $this->calculateFromAndToDatePeriod(\n $automatedReport->getFrequency(),\n $automatedReport->getFrom(),\n $automatedReport->getTo()\n );\n }\n\n public function getAskJiminnyGenerateReportPayload(\n AutomatedReport $automatedReport,\n AutomatedReportResult $reportResult,\n array $activityIds,\n ): array {\n return [\n 'user_question' => $automatedReport->getAskAnythingPrompt()?->getContent(),\n 'call_ids' => array_map('strval', $activityIds),\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResult->getUuid(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->getReportPeriodName($reportResult),\n 'report_name' => $automatedReport->getCustomName(),\n ];\n }\n\n private function getCallbackUrl(): string\n {\n return $this->webhookService->route('jiminny.webhook.reports.ready');\n }\n\n /**\n * Validate and transform payload data for automated reports\n *\n * @param array $data\n *\n * @throws InvalidArgumentException\n *\n * @return array\n */\n private function validateAndTransformData(array $data): array\n {\n // Validate organization (team) and check feature\n $team = $this->validateOrganization($data['organization'] ?? null);\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $type = $this->validateReportType($data['report_type'] ?? null);\n $frequency = $this->validateFrequency($data['frequency'] ?? null);\n $additionalPromptInput = $this->validateAdditionalPromptInput(\n $data['additional_prompt_input'] ?? null\n );\n $customReportName = $this->validateCustomReportName($data['custom_name'] ?? null);\n\n // Prepare data for the database\n $reportData = [\n 'team_id' => $team->getId(),\n 'type' => $type,\n 'status' => $status,\n 'frequency' => $frequency,\n 'additional_prompt_input' => $additionalPromptInput,\n 'custom_name' => $customReportName,\n ];\n\n // Validate deal values\n $reportData = $this->validateDealValues($data, $reportData);\n\n // Validate date range\n $reportData = $this->validateDateRange($data, $reportData, $frequency);\n\n // Validate call durations\n $reportData = $this->validateCallDurations($data, $reportData);\n\n // Validate call types\n $reportData = $this->validateCallTypes($data, $reportData);\n\n // Validate media types\n $reportData = $this->validateMediaTypes($data, $reportData);\n\n // Validate groups\n if (isset($data['teams'])) {\n $reportData['groups'] = $this->validateAndGetGroupIds($team, $data['teams']);\n }\n\n // Validate deal stages\n $reportData = $this->validateDealStages($data, $reportData, $team, $type);\n\n // Validate playbook categories\n $reportData = $this->validatePlaybookCategories($data, $reportData, $team);\n\n // Validate recipients\n $reportData['recipients'] = [\n 'users' => $this->validateAndGetUserIdsByTeam($team, $data['recipients'] ?? []),\n ];\n\n if (isset($data['jiminny_recipients'])) {\n // Validate Jiminny recipients\n $reportData['jiminny_recipients'] = [\n 'users' => $this->validateAndGetJiminnyUserIds((array) $data['jiminny_recipients']),\n ];\n }\n\n return $reportData;\n }\n\n private function validateDealValues(array $data, array $reportData): array\n {\n if (isset($data['min_deal_value'])) {\n $reportData['deal_value_min'] = (int) $data['min_deal_value'];\n\n if ($reportData['deal_value_min'] > 4294967295 || $reportData['deal_value_min'] < 0) {\n throw new InvalidArgumentException('Min deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_deal_value'])) {\n $reportData['deal_value_max'] = (int) $data['max_deal_value'];\n\n if ($reportData['deal_value_max'] > 4294967295 || $reportData['deal_value_max'] < 0) {\n throw new InvalidArgumentException('Max deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['min_deal_value'], $data['max_deal_value'])\n && $data['min_deal_value'] > $data['max_deal_value']\n ) {\n throw new InvalidArgumentException('Min deal value cannot be greater than max deal value');\n }\n\n return $reportData;\n }\n\n private function validateDateRange(array $data, array $reportData, string $frequency): array\n {\n // Set date range only for one_off frequency\n if ($frequency === 'one_off') {\n if (isset($data['start_date_period'])) {\n $reportData['from'] = $this->parseDate($data['start_date_period']);\n }\n\n if (isset($data['end_date_period'])) {\n $reportData['to'] = $this->parseDate($data['end_date_period']);\n }\n\n if (empty($reportData['from']) || empty($reportData['to'])) {\n throw new InvalidArgumentException(\n 'Start date and end date are required for one_off frequency'\n );\n }\n } else {\n $reportData['from'] = null;\n $reportData['to'] = null;\n }\n\n return $reportData;\n }\n\n private function validateCallDurations(array $data, array $reportData): array\n {\n // Convert call durations from minutes to seconds\n if (isset($data['min_call_duration'])) {\n $reportData['call_duration_min'] = (int) $data['min_call_duration'] * 60;\n\n if ($reportData['call_duration_min'] > 4294967295 || $reportData['call_duration_min'] < 0) {\n throw new InvalidArgumentException('Min call duration should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_call_duration'])) {\n $reportData['call_duration_max'] = (int) $data['max_call_duration'] * 60;\n\n if ($reportData['call_duration_max'] > 4294967295 || $reportData['call_duration_max'] < 0) {\n throw new InvalidArgumentException('Max call duration should be between 0 and 4294967295');\n }\n }\n\n return $reportData;\n }\n\n private function validateCallTypes(array $data, array $reportData): array\n {\n // Set call types\n $reportData['call_types'] = $data['call_type'] ?? [];\n if (empty($reportData['call_types'])) {\n $reportData['call_types'] = self::getCallTypes();\n }\n\n foreach ($reportData['call_types'] as $callType) {\n if (! in_array($callType, self::getCallTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Call type %s is invalid', $callType));\n }\n }\n\n return $reportData;\n }\n\n private function validateMediaTypes(array $data, array $reportData): array\n {\n // Set media types from input data\n $reportData['media_types'] = $data['media_types'] ?? [];\n\n if (empty($reportData['media_types'])) {\n throw new InvalidArgumentException('Media types are required');\n }\n\n foreach ($reportData['media_types'] as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n throw new InvalidArgumentException(sprintf('Media type %s is invalid', $mediaType));\n }\n }\n\n return $reportData;\n }\n\n private function validateDealStages(array $data, array $reportData, Team $team, string $reportType): array\n {\n // Validate and set deal stages\n if (isset($data['deal_stage_at_call'])) {\n $reportData['deal_at_call_stages'] =\n $this->validateAndGetDealStageIds($team, $data['deal_stage_at_call'], 'Deal stage at call');\n }\n\n if (isset($data['current_deal_stage'])) {\n $reportData['current_deal_stages'] =\n $this->validateAndGetDealStageIds($team, $data['current_deal_stage'], 'Current deal stage');\n }\n\n // Ensure current_deal_stage is not provided for loss_analysis report type\n if ($reportType === self::TYPE_LOSS_ANALYSIS && ! empty($data['current_deal_stage'])) {\n throw new InvalidArgumentException('Current deal stage is not applicable for Loss Analysis reports');\n }\n\n return $reportData;\n }\n\n // transform uuid to id\n private function validatePlaybookCategories(array $data, array $reportData, Team $team): array\n {\n $key = 'playbook_categories';\n\n if (isset($data[$key])) {\n $payloadIds = $data[$key];\n $ids = [];\n\n foreach ($payloadIds as $uuid) {\n $uuid = (string) $uuid;\n\n try {\n $playbookCategory = $this->playbookCategoryRepository->findByUuid($uuid);\n } catch (Throwable $throwable) {\n Log::error(__METHOD__ . ' ' . $throwable->getMessage());\n\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory) {\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory->hasPlaybook()) {\n throw new InvalidArgumentException(sprintf('Playbook category %s has no playbook', $uuid));\n }\n\n if ($playbookCategory->getPlaybook()->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Playbook category %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $ids[] = $playbookCategory->getId();\n }\n\n $reportData[$key] = $ids;\n }\n\n return $reportData;\n }\n\n private function validateReportStatus($status): bool\n {\n if (! in_array($status, [true, false], true)) {\n throw new InvalidArgumentException('Report status is invalid');\n }\n\n return $status;\n }\n\n private function validateReportType($type): string\n {\n if (! in_array($type, self::getTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Report type is invalid: %s', $type));\n }\n\n return $type;\n }\n\n private function validateFrequency($frequency): string\n {\n if (! in_array($frequency, self::getFrequencies(), true)) {\n throw new InvalidArgumentException('Frequency is invalid');\n }\n\n return $frequency;\n }\n\n private function validateAdditionalPromptInput(?string $additionalPromptInput): ?string\n {\n if ($additionalPromptInput && strlen($additionalPromptInput) > 5000) {\n throw new InvalidArgumentException('Additional Prompt Input should be less than 5000 characters');\n }\n\n return $additionalPromptInput;\n }\n\n private function validateCustomReportName(?string $customReportName): ?string\n {\n if ($customReportName === null || $customReportName === '') {\n return null;\n }\n\n if (strlen($customReportName) > 70) {\n throw new InvalidArgumentException('Custom report name should be less than 70 characters');\n }\n\n return $customReportName;\n }\n\n private function validateOrganization(?string $organizationUuid): Team\n {\n if (! $organizationUuid) {\n throw new InvalidArgumentException('Organization is required');\n }\n\n $team = $this->teamRepository->idOrUuid($organizationUuid);\n\n if (! $team) {\n throw new InvalidArgumentException('Organization not found');\n }\n\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n throw new InvalidArgumentException('Organization does not have the Automated Reports feature');\n }\n\n return $team;\n }\n\n private function validateAndGetGroupIds(Team $team, array $teamUuids): array\n {\n $groupIds = [];\n\n foreach ($teamUuids as $uuid) {\n $group = $this->groupRepository->findByUuid($uuid);\n\n if ($group === null || $group->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Group %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $groupIds[] = $group->getId();\n\n }\n\n return $groupIds;\n }\n\n private function validateAndGetDealStageIds(Team $team, array $stageUuids, string $propertyLabel): array\n {\n $stageIds = [];\n\n foreach ($stageUuids as $uuid) {\n $stage = $this->stageRepository->findByUuid($uuid);\n\n if ($stage === null || $stage->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Stage %s not found for team %s for %s', $uuid, $team->getUuid(), $propertyLabel)\n );\n }\n\n $stageIds[] = $stage->getId();\n }\n\n return $stageIds;\n }\n\n private function validateAndGetUserIds(array $userUuids, callable $teamCheck): array\n {\n if (empty($userUuids)) {\n return [];\n }\n\n $userIds = [];\n\n foreach ($userUuids as $uuid) {\n $user = $this->userRepository->findByUuid($uuid);\n\n if (! $user || ! $user->isStatusActive()) {\n throw new InvalidArgumentException(\n sprintf('User %s not found or is not active', $uuid)\n );\n }\n\n if (! $teamCheck($user)) {\n throw new InvalidArgumentException(\n sprintf('User %s does not belong to the allowed team(s)', $uuid)\n );\n }\n\n $userIds[] = $user->getId();\n }\n\n return $userIds;\n }\n\n private function validateAndGetUserIdsByTeam(Team $team, array $userUuids): array\n {\n return $this->validateAndGetUserIds($userUuids, fn ($user) => $user->getTeamId() === $team->getId());\n }\n\n private function validateAndGetJiminnyUserIds(array $userUuids): array\n {\n $allowedTeamIds = config('kiosk.teamIds', []);\n\n return $this->validateAndGetUserIds($userUuids, fn ($user) => in_array($user->getTeamId(), $allowedTeamIds, true));\n }\n\n private function parseDate(string $dateString): string\n {\n return date('Y-m-d H:i:s', strtotime($dateString));\n }\n\n private function generateReportResultViewUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.view', ['uuid' => $result->getUuid()]);\n }\n\n private function generateReportResultDownloadUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.download', ['uuid' => $result->getUuid()]);\n }\n\n private function getReportMediaRouteResource(AutomatedReportResult $result): string\n {\n if ($result->getMediaType() === self::MEDIA_TYPE_PDF) {\n return self::PDF_KEY;\n } elseif ($result->getMediaType() === self::MEDIA_TYPE_PODCAST) {\n return self::AUDIO_KEY;\n }\n\n throw new \\InvalidArgumentException('Unknown media type.');\n }\n\n public function getMediaPath(AutomatedReportResult $result): ?string\n {\n $url = match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => $result->getPdfUrl(),\n self::MEDIA_TYPE_PODCAST => $result->getPodcastAudioUrl(),\n default => null,\n };\n\n if ($url === null) {\n return null;\n }\n\n $path = parse_url(trim($url, '\"\\''), PHP_URL_PATH);\n\n return $path ?: null;\n }\n\n public function getFilenameSuffix(AutomatedReportResult $result): ?string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => 'Podcast',\n default => null,\n };\n }\n\n public function getMailSubjectSuffix(AutomatedReportResult $result): string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => 'report',\n self::MEDIA_TYPE_PODCAST => 'podcast',\n default => '',\n };\n }\n\n public function getMediaTypeMetadata(AutomatedReportResult $result): array\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => ['extension' => 'mp3', 'mime' => 'audio/mpeg'],\n self::MEDIA_TYPE_PDF => ['extension' => 'pdf', 'mime' => 'application/pdf'],\n default => ['extension' => null, 'mime' => null],\n };\n }\n\n public function deleteS3Files(AutomatedReportResult $result): void\n {\n $teamUuid = $result->getReport()->getTeam()->getUuid();\n $reportUuid = $result->getUuid();\n\n // delete all files for a report uuid no mather of pdf, podcast, or both\n // in case of both - the podcast files are linked to the pdf (parent) uuid\n // pdf and podcast date times should be close\n $path = sprintf('%s/%s/%s', $teamUuid, self::S3_DIR, $reportUuid);\n\n foreach (self::FILE_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted S3 file', [\n 'path' => $file,\n ]);\n }\n }\n\n foreach (self::FILE_PODCAST_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '_podcast.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted Podcast S3 file', [\n 'path' => $file,\n ]);\n }\n }\n }\n\n /**\n *\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): Collection\n {\n return $this->automatedReportsRepository->getTeamIdsWithReportsResults($teamId);\n }\n\n /**\n * Core delete logic for report results using a query\n *\n * @param Builder $query\n * @param array $logContext\n *\n * @return int\n */\n private function deleteReportResultsByQuery(Builder $query, array $logContext = []): int\n {\n $deletedCount = 0;\n\n if ($query->exists()) {\n Log::info(\n 'Run delete report results',\n array_merge(\n $logContext,\n [\n 'service' => 'AutomatedReportsService',\n ]\n )\n );\n\n $query->chunkById(50, function ($results) use (&$deletedCount, $logContext) {\n foreach ($results as $result) {\n $this->deleteReportResult($result);\n $deletedCount++;\n\n Log::info(\n 'Deleted a report result',\n array_merge(\n $logContext,\n [\n 'result_id' => $result->getId(),\n 'report_id' => $result->getReportId(),\n ]\n )\n );\n }\n });\n }\n\n return $deletedCount;\n }\n\n /**\n * Delete report results for a team by retention period\n *\n * @param Team $team\n * @param CarbonImmutable $retentionDate\n *\n * @return int Number of deleted report results\n */\n public function deleteReportsResultsInRetentionPeriod(Team $team, CarbonImmutable $retentionDate): int\n {\n $reportIds = $this->automatedReportsRepository->getReportIdsByTeam($team);\n\n if ($reportIds->isEmpty()) {\n return 0;\n }\n\n $query = $this->automatedReportsRepository\n ->getReportResultsQueryForRetention($team, $retentionDate);\n\n return $this->deleteReportResultsByQuery($query, [\n 'team_id' => $team->getId(),\n 'retention_date' => $retentionDate->toDateTimeString(),\n ]);\n }\n\n /**\n * Delete ALL report results for a specific automated report\n *\n * @param string $uuid\n *\n * @return int\n */\n public function deleteReportResults(string $uuid): int\n {\n $report = $this->getReport($uuid);\n\n $query = $this->automatedReportsRepository->getResultsByReportQuery($report);\n\n return $this->deleteReportResultsByQuery($query, [\n 'report_uuid' => $uuid,\n 'report_id' => $report->getId(),\n ]);\n }\n\n public function deleteReportResult(AutomatedReportResult $result): void\n {\n $this->deleteS3Files($result);\n\n $result->delete();\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getTeamReports(Team $team): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getReportsByTeam($team);\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getReportResults(AutomatedReport $report): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getResultsByReport($report);\n }\n\n public function deleteAllReportResults(AutomatedReport $report): void\n {\n $results = $this->getReportResults($report);\n\n /** @var AutomatedReportResult $result */\n foreach ($results as $result) {\n Log::info('Deleting result', [\n 'report' => $report->getId(),\n 'result' => $result->getId(),\n ]);\n\n $this->deleteReportResult($result);\n }\n }\n\n public function deleteAllData(Team $team): void\n {\n Log::info('Deleting automated report and results for team', [\n 'team' => $team->getId(),\n ]);\n\n $reports = $this->getTeamReports($team);\n\n /** @var AutomatedReport $report */\n foreach ($reports as $report) {\n Log::info('Deleting report', [\n 'team' => $team->getId(),\n 'report' => $report->getId(),\n ]);\n\n $this->deleteAllReportResults($report);\n\n $report->delete();\n }\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"18","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"14","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"2","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"4","depth":4,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o\nJOIN activities a ON o.id = a.opportunity_id\nWHERE a.crm_configuration_id = 39\nAND a.actual_start_time > '2025-10-13'\nAND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM activities\nWHERE crm_configuration_id = 39 and user_id = 143\nand actual_start_time >= '2025-10-13'\nAND type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM opportunities WHERE account_id IN (178);\nselect * from activities where id IN (620137, 620187, 620188, 620189, 620230);\n\n# HS\nSELECT * FROM opportunities WHERE id IN (238);\nselect * from activities where id IN (477,2076);\n\nselect * from users;\n\nSELECT COUNT(*) FROM users;\nSELECT COUNT(*) FROM activities;\nSELECT COUNT(*) FROM opportunities;\n\nUPDATE activities\nSET\n actual_start_time = '2025-12-19 09:00:00',\n actual_end_time = '2025-12-19 10:30:00',\n scheduled_start_time = '2025-12-19 09:00:00',\n scheduled_end_time = '2025-12-19 10:30:00'\nWHERE id IN (407509,407375);\n\nselect * from partners;\n\nSELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id\nFROM activities\nWHERE user_id = 143\nAND actual_start_time >= '2025-10-13 00:00:00'\nAND actual_start_time <= '2026-01-13 23:59:59'\nORDER BY actual_start_time DESC;\n\nSELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;\nSELECT * FROM crm_layouts where crm_configuration_id = 39;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;\n# lead_id\n# account_id 177\n# contact_id 3969\n# opportunity_id\n# stage_id 203\n\nSELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;\n\nSELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'\nAND user_id = 143 and actual_start_time >= '2025-10-13';\n\nSELECT * FROM activities a\n# JOIN opportunities o ON a.opportunity_id = o.id\nWHERE a.crm_configuration_id = 39 AND a.type = 'conference'\nand status = 'completed' and recording_state = 'recorded'\nand a.actual_start_time >= '2025-10-13'\nAND a.user_id = 143\n;\n\nselect * from leads\nwhere crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707\n\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310);\nSELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198\nSELECT * FROM activities WHERE id IN (356001, 356008); # contacts:\n\nSELECT * FROM opportunities WHERE id IN (1707);\nSELECT * FROM stages where id IN (204, 198);\nSELECT * FROM opportunities WHERE account_id IN (178);\nSELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';\nSELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal\n\nSELECT * FROM activities where crm_configuration_id = 39\nAND opportunity_id IS NULL\nAND is_internal = false\nand status = 'completed' and recording_state = 'recorded'\nAND actual_start_time >= '2025-10-13'\nAND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)\n# AND lead_id IN (112, 109)\n;\n\nSELECT * FROM crm_profiles WHERE user_id = 143;\n\nselect * from inboxes; # 212\nselect * from users where id = 143; # 143\nselect * from inbox_email_batches where inbox_id = 212\nand updated_at >= '2026-01-28 00:00:00' order by id desc;\nselect * from inbox_emails where inbox_id = 212\nand batch_id = 95885 order by id desc;\nselect * from email_messages where origin_user_id = 143;\nselect * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';\nselect * from participants where activity_id = 620247;\n\nselect * from crm_profiles where user_id = 143;\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001\nselect * from transcription where activity_id = 356001; # 6943\nselect * from ai_prompts where transcription_id = 6943;\nSELECT * FROM activity_summary_logs where activity_id = 356001;\n\nSELECT * FROM social_accounts WHERE sociable_id = 143;\n\n# ************************************************************************************\nSELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;\n# 422515 softphone tr. 8100\n\nSELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;\n# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS\n\nselect * from ai_prompts where transcription_id IN (8100, 7670);\nselect * from activity_summary_logs where activity_id = 407509;\n\nselect * from sidekick_settings;\nselect * from default_activity_types;\n\nSELECT * FROM contacts WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\nSELECT * FROM leads WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\n\nSELECT * FROM activity_searches where user_id = 143;\nSELECT * FROM groups where team_id = 1;\n\nselect * from teams where id = 1;\nselect * from groups where team_id = 1; # 1150 - 7e75f8025c22\nselect id, name, group_id, status, deleted_at, email\nfrom users where team_id = 1 order by group_id desc ;\n\nselect * from activity_searches where id in (1977, 1978, 1979);\nselect * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);\nselect * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277\nselect * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879\n\nINSERT INTO `activity_search_filters`\n(`activity_search_id`, `filter`, `value`) VALUES\n(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')\n;\n\nselect * from crm_configurations where id = 39;\n\n\nselect sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id\nwhere u.team_id = 1;\nSELECT * FROM social_accounts WHERE sociable_id = 1635;\nSELECT * FROM users WHERE id = 1635;\n\nselect * from teams where id = 1;\nselect * from users where team_id = 1;\nselect * from team_features where team_id = 1;\nselect * from features;\n\nSELECT * FROM activity_searches where id = 1982; # 1981\nSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;\n\nSELECT * FROM automated_reports where id = 68;\nUPDATE automated_reports set playbook_categories = NULL where id = 68;\nSELECT * FROM automated_report_results where id = 275;\n\nSELECT * FROM automated_reports order by id desc;\nSELECT * FROM automated_report_results order by id desc;\nselect * from activity_searches where user_id = 143;\nselect * from ask_anything_prompts;\n\nSELECT * FROM groups WHERE id = 1439;\nSELECT * FROM users WHERE group_id = 1439;\n\nselect * from permissions; # 158\nselect * from roles;\nselect * from permission_role\n\nselect * from teams where id = 1;\nselect * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;\nselect * from groups where id = 28;\nselect * from playbooks where team_id = 1;\nselect * from playbooks where id = 179;\nselect * from playbook_categories where id = 1391;\nselect * from users where id = 143;\nselect * from crm_profiles where user_id = 143;\nselect * from activities where crm_configuration_id = 39 and type = 'conference'\nand crm_provider_id IS NOT NULL ORDER by id desc;\nselect * from activities where id = 422003; # 00UO400000pB6fpMAC\n\nSELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type\nFROM automated_report_results ar\nJOIN automated_reports a ON a.id = ar.report_id\nWHERE a.type = 'ask_jiminny'\nLIMIT 10;\n\nSELECT `automated_report_results`.* FROM `automated_report_results`\nINNER JOIN `automated_reports`\n ON `automated_report_results`.`report_id` = `automated_reports`.`id`\nWHERE `automated_report_results`.`generated_at` IS NOT NULL\n AND `automated_reports`.`team_id` = 1\n AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$.\"users\"')\n;\n\n\nselect * from teams where id = 3143;\nselect * from crm_configurations where id = 500;\nselect * from users where name = 'Integration Account'; # 1695\nSELECT * FROM social_accounts WHERE sociable_id = 1695;\n\nselect * from activities where crm_configuration_id = 39\nand recording_state = 'recorded' and duration > 60\nand status = 'completed' and actual_start_time >= '2025-12-01';\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;\n\nselect * from leads;","depth":4,"value":"SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o\nJOIN activities a ON o.id = a.opportunity_id\nWHERE a.crm_configuration_id = 39\nAND a.actual_start_time > '2025-10-13'\nAND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM activities\nWHERE crm_configuration_id = 39 and user_id = 143\nand actual_start_time >= '2025-10-13'\nAND type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM opportunities WHERE account_id IN (178);\nselect * from activities where id IN (620137, 620187, 620188, 620189, 620230);\n\n# HS\nSELECT * FROM opportunities WHERE id IN (238);\nselect * from activities where id IN (477,2076);\n\nselect * from users;\n\nSELECT COUNT(*) FROM users;\nSELECT COUNT(*) FROM activities;\nSELECT COUNT(*) FROM opportunities;\n\nUPDATE activities\nSET\n actual_start_time = '2025-12-19 09:00:00',\n actual_end_time = '2025-12-19 10:30:00',\n scheduled_start_time = '2025-12-19 09:00:00',\n scheduled_end_time = '2025-12-19 10:30:00'\nWHERE id IN (407509,407375);\n\nselect * from partners;\n\nSELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id\nFROM activities\nWHERE user_id = 143\nAND actual_start_time >= '2025-10-13 00:00:00'\nAND actual_start_time <= '2026-01-13 23:59:59'\nORDER BY actual_start_time DESC;\n\nSELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;\nSELECT * FROM crm_layouts where crm_configuration_id = 39;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;\n# lead_id\n# account_id 177\n# contact_id 3969\n# opportunity_id\n# stage_id 203\n\nSELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;\n\nSELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'\nAND user_id = 143 and actual_start_time >= '2025-10-13';\n\nSELECT * FROM activities a\n# JOIN opportunities o ON a.opportunity_id = o.id\nWHERE a.crm_configuration_id = 39 AND a.type = 'conference'\nand status = 'completed' and recording_state = 'recorded'\nand a.actual_start_time >= '2025-10-13'\nAND a.user_id = 143\n;\n\nselect * from leads\nwhere crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707\n\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310);\nSELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198\nSELECT * FROM activities WHERE id IN (356001, 356008); # contacts:\n\nSELECT * FROM opportunities WHERE id IN (1707);\nSELECT * FROM stages where id IN (204, 198);\nSELECT * FROM opportunities WHERE account_id IN (178);\nSELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';\nSELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal\n\nSELECT * FROM activities where crm_configuration_id = 39\nAND opportunity_id IS NULL\nAND is_internal = false\nand status = 'completed' and recording_state = 'recorded'\nAND actual_start_time >= '2025-10-13'\nAND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)\n# AND lead_id IN (112, 109)\n;\n\nSELECT * FROM crm_profiles WHERE user_id = 143;\n\nselect * from inboxes; # 212\nselect * from users where id = 143; # 143\nselect * from inbox_email_batches where inbox_id = 212\nand updated_at >= '2026-01-28 00:00:00' order by id desc;\nselect * from inbox_emails where inbox_id = 212\nand batch_id = 95885 order by id desc;\nselect * from email_messages where origin_user_id = 143;\nselect * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';\nselect * from participants where activity_id = 620247;\n\nselect * from crm_profiles where user_id = 143;\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001\nselect * from transcription where activity_id = 356001; # 6943\nselect * from ai_prompts where transcription_id = 6943;\nSELECT * FROM activity_summary_logs where activity_id = 356001;\n\nSELECT * FROM social_accounts WHERE sociable_id = 143;\n\n# ************************************************************************************\nSELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;\n# 422515 softphone tr. 8100\n\nSELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;\n# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS\n\nselect * from ai_prompts where transcription_id IN (8100, 7670);\nselect * from activity_summary_logs where activity_id = 407509;\n\nselect * from sidekick_settings;\nselect * from default_activity_types;\n\nSELECT * FROM contacts WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\nSELECT * FROM leads WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\n\nSELECT * FROM activity_searches where user_id = 143;\nSELECT * FROM groups where team_id = 1;\n\nselect * from teams where id = 1;\nselect * from groups where team_id = 1; # 1150 - 7e75f8025c22\nselect id, name, group_id, status, deleted_at, email\nfrom users where team_id = 1 order by group_id desc ;\n\nselect * from activity_searches where id in (1977, 1978, 1979);\nselect * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);\nselect * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277\nselect * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879\n\nINSERT INTO `activity_search_filters`\n(`activity_search_id`, `filter`, `value`) VALUES\n(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')\n;\n\nselect * from crm_configurations where id = 39;\n\n\nselect sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id\nwhere u.team_id = 1;\nSELECT * FROM social_accounts WHERE sociable_id = 1635;\nSELECT * FROM users WHERE id = 1635;\n\nselect * from teams where id = 1;\nselect * from users where team_id = 1;\nselect * from team_features where team_id = 1;\nselect * from features;\n\nSELECT * FROM activity_searches where id = 1982; # 1981\nSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;\n\nSELECT * FROM automated_reports where id = 68;\nUPDATE automated_reports set playbook_categories = NULL where id = 68;\nSELECT * FROM automated_report_results where id = 275;\n\nSELECT * FROM automated_reports order by id desc;\nSELECT * FROM automated_report_results order by id desc;\nselect * from activity_searches where user_id = 143;\nselect * from ask_anything_prompts;\n\nSELECT * FROM groups WHERE id = 1439;\nSELECT * FROM users WHERE group_id = 1439;\n\nselect * from permissions; # 158\nselect * from roles;\nselect * from permission_role\n\nselect * from teams where id = 1;\nselect * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;\nselect * from groups where id = 28;\nselect * from playbooks where team_id = 1;\nselect * from playbooks where id = 179;\nselect * from playbook_categories where id = 1391;\nselect * from users where id = 143;\nselect * from crm_profiles where user_id = 143;\nselect * from activities where crm_configuration_id = 39 and type = 'conference'\nand crm_provider_id IS NOT NULL ORDER by id desc;\nselect * from activities where id = 422003; # 00UO400000pB6fpMAC\n\nSELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type\nFROM automated_report_results ar\nJOIN automated_reports a ON a.id = ar.report_id\nWHERE a.type = 'ask_jiminny'\nLIMIT 10;\n\nSELECT `automated_report_results`.* FROM `automated_report_results`\nINNER JOIN `automated_reports`\n ON `automated_report_results`.`report_id` = `automated_reports`.`id`\nWHERE `automated_report_results`.`generated_at` IS NOT NULL\n AND `automated_reports`.`team_id` = 1\n AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$.\"users\"')\n;\n\n\nselect * from teams where id = 3143;\nselect * from crm_configurations where id = 500;\nselect * from users where name = 'Integration Account'; # 1695\nSELECT * FROM social_accounts WHERE sociable_id = 1695;\n\nselect * from activities where crm_configuration_id = 39\nand recording_state = 'recorded' and duration > 60\nand status = 'completed' and actual_start_time >= '2025-12-01';\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;\n\nselect * from leads;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-3163136488953525261
|
1126710648141684156
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsRepositoryTest
Run 'AutomatedReportsRepositoryTest'
Debug 'AutomatedReportsRepositoryTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
3
102
3
34
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Kiosk\AutomatedReports;
use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Carbon\Exceptions\InvalidFormatException;
use DateTime;
use DateTimeInterface;
use DateTimeZone;
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcher;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Jiminny\Component\ActivitySearch\FilterDefinition\InputTypeEnum;
use Jiminny\Component\AskAnything\AskAnythingPromptService;
use Jiminny\Component\AskAnything\Dtos\AskAnythingPromptDto;
use Jiminny\Component\UrlGenerator\Webhook;
use Jiminny\Contracts\Repositories\PlaybookCategoryRepository;
use Jiminny\Contracts\Repositories\TeamRepository;
use Jiminny\Contracts\Repositories\UserRepository;
use Jiminny\Exceptions\ApplicationException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Exceptions\ModelNotFoundException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateReportJob;
use Jiminny\Models\Activity\Search;
use Jiminny\Models\AskAnything\AskAnythingPrompt;
use Jiminny\Models\AskAnything\AskAnythingPromptTarget;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Contracts\UserContract;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AskAnythingRepository;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Repositories\GroupRepository;
use Jiminny\Repositories\SearchRepository;
use Jiminny\Repositories\StageRepository;
use Throwable;
class AutomatedReportsService
{
public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';
public const string TYPE_ASK_JIMINNY = 'ask_jiminny';
/**
* Standard report types (used by kiosk for existing automated reports).
*/
// @TODO this will add filter, however if we need to control feature by FF we need conditional logic
public const array TYPES = [
['id' => 'exec_summary', 'name' => 'Exec Summary'],
['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],
['id' => 'product_feedback', 'name' => 'Product Feedback'],
['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],
// ['id' => 'questions', 'name' => 'Questions'],
// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],
];
public const array ALL_TYPES = [
...self::TYPES,
['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],
];
public const string FREQUENCY_DAILY = 'daily';
public const string FREQUENCY_WEEKLY = 'weekly';
public const string FREQUENCY_MONTHLY = 'monthly';
public const string FREQUENCY_QUARTERLY = 'quarterly';
public const string FREQUENCY_ONE_OFF = 'one_off';
/**
* Frequencies for standard (non-Ask Jiminny) reports.
*/
public const array FREQUENCIES = [
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
/**
* Frequencies for Ask Jiminny reports.
*/
public const array ASK_JIMINNY_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
];
public const string MEDIA_TYPE_PDF = 'pdf';
public const string MEDIA_TYPE_PODCAST = 'podcast';
public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];
public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];
public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];
public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];
public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];
public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];
public const int SENT_REPORT_AT_HOURS = 5;
public const string PDF_KEY = 'pdf';
public const string AUDIO_KEY = 'audio';
private const array ALL_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
private const string S3_DIR = 'reports';
private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];
private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];
public function __construct(
private readonly TeamRepository $teamRepository,
private readonly GroupRepository $groupRepository,
private readonly UserRepository $userRepository,
private readonly StageRepository $stageRepository,
private readonly DealStagesService $dealStagesService,
private readonly RecipientsService $recipientsService,
private readonly AutomatedReportsRepository $automatedReportsRepository,
private readonly Webhook $webhookService,
private readonly BusDispatcher $dispatcher,
private readonly ActivityTypeService $activityTypeService,
private readonly PlaybookCategoryRepository $playbookCategoryRepository,
private readonly AskAnythingPromptService $askAnythingPromptService,
private readonly SearchRepository $activitySearchRepository,
private readonly AskAnythingRepository $askAnythingRepository,
) {
}
public static function getTypes(): array
{
$types = self::TYPES;
return array_map(static function ($type) {
return $type['id'];
}, $types);
}
public static function getCallTypes(): array
{
return array_map(static function ($callType) {
return $callType['id'];
}, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);
}
public static function getFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::FREQUENCIES);
}
// front-facing structure
public function getReportEnabledFieldData(bool $value = false): array
{
return [
'id' => 'report_enabled',
'label' => '',
'inputType' => InputTypeEnum::TOGGLE,
'value' => $value,
];
}
// Organizations = Teams
public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array
{
$options = $this->getTeams();
if ($shortVersion) {
return [
'id' => 'organization',
'label' => 'Organization',
'options' => $options,
];
}
return [
'id' => 'organization',
'label' => 'Organization',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $options,
'value' => $value,
'dependencies' => [
'teams',
'deal_stage_at_call',
'current_deal_stage',
'recipients',
ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,
],
'dependsOn' => [],
];
}
// Teams = Groups
public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array
{
if ($shortVersion) {
return [
'id' => 'teams',
'label' => 'Team',
'options' => $options,
];
}
return [
'id' => 'teams',
'label' => 'Team',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => false,
'placeholder' => 'Select',
'options' => $options,
'value' => $value, // value should be an array of objects {id, name}
'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],
'dependsOn' => [],
];
}
public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array
{
$types = [];
if ($team instanceof Team) {
if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
$types = self::TYPES;
}
if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {
$types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];
}
} else {
$types = self::TYPES;
}
if ($shortVersion) {
return [
'id' => 'report_type',
'label' => 'Report Type',
'options' => $types,
];
}
return [
'id' => 'report_type',
'label' => 'Report Type',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $types,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getFrequencyFieldData(?string $value = null): array
{
return [
'id' => 'frequency',
'label' => 'Frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => self::FREQUENCIES,
'value' => $value,
'dependencies' => ['period'],
'dependsOn' => [],
];
}
public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array
{
return [
'id' => 'period',
'label' => 'Select one-off period',
'inputType' => InputTypeEnum::DATE_RANGE,
'required' => true,
'placeholder' => 'Select',
'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],
'queryParams' => [
'startDate' => 'start_date_period',
'endDate' => 'end_date_period',
],
'dependencies' => [],
'dependsOn' => ['frequency'],
];
}
public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array
{
return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);
}
public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);
}
public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);
}
public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'deal_value',
'label' => 'Deal Value',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_deal_value',
'max' => 'max_deal_value',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array
{
$value = [];
$conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;
$dialerOn && $value[] = self::CALL_TYPE_DIALER;
return [
'id' => 'call_type',
'label' => 'Call Type',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => [
self::CALL_TYPE_CONFERENCE,
self::CALL_TYPE_DIALER,
],
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getMediaTypeFieldData(?AutomatedReport $report = null): array
{
$value = [];
if ($report) {
$value = $this->transformMediaTypes($report);
}
return [
'id' => 'media_types',
'label' => 'Export as',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => self::MEDIA_TYPE_OBJECTS,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'call_duration',
'label' => 'Call Duration',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_call_duration',
'max' => 'max_call_duration',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getRecipientsFieldData(?Team $team = null, array $value = []): array
{
return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);
}
public function getJiminnyRecipientsFieldData(array $value = []): array
{
return $this->recipientsService->getJiminnyRecipientsFieldData($value);
}
public function getAdditionalPromptInputFieldData(?string $value = null): array
{
return [
'id' => 'additional_prompt_input',
'label' => 'Special requirements',
'inputType' => InputTypeEnum::TEXTAREA,
'required' => false,
'placeholder' => 'What should be the focus of the report?',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCustomReportNameFieldData(?string $value = null): array
{
return [
'id' => 'custom_name',
'label' => 'Custom report name',
'inputType' => InputTypeEnum::TEXT,
'required' => false,
'placeholder' => 'Enter custom name',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
// data providers
public function getTeams(): array
{
$teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);
$teamData = [];
foreach ($teams as $team) {
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
continue;
}
$teamData[] = $this->transformTeam($team);
}
return $teamData;
}
public function getTeamGroups(string $teamUuid): array
{
$data = [];
$team = $this->getTeam($teamUuid);
if ($team !== null) {
$groups = $team->groups()->get();
foreach ($groups as $group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
];
}
}
return $data;
}
public function getTeamsGroupsOptions(array $filterTeamUuids = []): array
{
$data = [];
$teams = $this->getTeams();
foreach ($teams as $team) {
if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {
continue;
}
$data[] = [
'label' => $team['name'],
'groups' => $this->getTeamGroups($team['id']),
];
}
return $data;
}
public function getTeam(string $teamUuid): ?Team
{
return $this->teamRepository->idOrUuid($teamUuid);
}
public function getTeamById(int $teamId): ?Team
{
return $this->teamRepository->find($teamId);
}
public function getGroupsUuids(AutomatedReport $report): array
{
$uuids = [];
$reportGroups = $report->getGroups();
foreach ($reportGroups as $groupId) {
if ($group = $this->groupRepository->find($groupId)) {
$uuids[] = $group->getUuid();
}
}
return $uuids;
}
public function getPlaybookCategoriesUuids(AutomatedReport $report): array
{
$uuids = [];
$playbookCategories = $report->getPlaybookCategories();
foreach ($playbookCategories as $id) {
if ($category = $this->playbookCategoryRepository->find($id)) {
$uuids[] = $category->getUuid();
}
}
return $uuids;
}
public function getDealAtCallStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getDealAtCallStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getCurrentDealStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getCurrentDealStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getRecipients());
}
public function getJiminnyUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function extractUserUuids(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => $user->getUuid())
->values()
->all();
}
// get mail data
public function getRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getRecipients());
}
/**
* @return array<UserContract>
*/
public function getRecipientUserObjects(AutomatedReport $report): array
{
$userIds = $report->getRecipients()['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->values()
->all();
}
private function getJiminnyRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function buildRecipientUsers(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => [
'email' => $user->getEmailAddress(),
'name' => $user->getName(),
'timezone' => $user->getTimezone()->getName(),
])
->values()
->all();
}
public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array
{
if ($report->isAskJiminnyReport()) {
$recipients = $this->resolveAskJiminnyRecipients($report);
} else {
$recipients = $this->getRecipientUsers($report);
if ($includeJiminny) {
$recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));
}
}
$emails = [];
return array_values(array_filter(
$recipients,
static function ($recipient) use (&$emails) {
if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {
return false;
}
$emails[] = $recipient['email'];
return true;
}
));
}
private function resolveAskJiminnyRecipients(AutomatedReport $report): array
{
$recipients = [];
$creator = $report->getCreator();
if ($creator !== null) {
$recipients[] = [
'email' => $creator->getEmailAddress(),
'name' => $creator->getName(),
'timezone' => $creator->getTimezone()->getName(),
];
}
return array_merge(
$recipients,
$this->buildRecipientUsers($report->getRecipients()),
$this->getGroupRecipientUsers($report),
);
}
private function getGroupRecipientUsers(AutomatedReport $report): array
{
$users = [];
foreach ($report->getGroups() as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group === null) {
continue;
}
foreach ($group->getMembers() as $member) {
$users[] = [
'email' => $member->getEmailAddress(),
'name' => $member->getName(),
'timezone' => $member->getTimezone()->getName(),
];
}
}
return $users;
}
public function getReportTypeName(AutomatedReportResult $report): string
{
$type = $report->getReport()->getType();
$getType = $this->transformReportType($type);
return $getType['name'];
}
public function getReportPeriodName(AutomatedReportResult $report): string
{
$from = $report->getFromDate();
$to = $report->getToDate();
$frequency = $report->getReport()->getFrequency();
if ($from === null || $to === null) {
if (! $report->getReport()->isAskJiminnyReport()) {
$invalidPeriod = $from === null ? 'from' : 'to';
throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);
}
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
}
return $this->formatReportPeriodName($frequency, $from, $to);
}
private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string
{
$fromYear = $from->format('Y');
$toYear = $to->format('Y');
$differentYears = $fromYear !== $toYear;
switch ($frequency) {
case self::FREQUENCY_DAILY:
return $from->format('j M Y');
case self::FREQUENCY_QUARTERLY:
// 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ
$startMonth = $from->format('M');
$endMonth = $to->copy()->subMonth();
$endMonthName = $endMonth->format('M');
$endMonthYear = $endMonth->format('Y');
if ($differentYears) {
return "{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}";
}
return "{$startMonth} - {$endMonthName} {$toYear}";
case self::FREQUENCY_MONTHLY:
// 'May 2025' - monthly reports are always within the same year
return $from->format('M Y');
case self::FREQUENCY_WEEKLY:
// '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ
$startDay = $from->format('j');
$endDay = $to->format('j');
$startMonth = $from->format('M');
$endMonth = $to->format('M');
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
if ($startMonth !== $endMonth) {
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
}
return "{$startDay} - {$endDay} {$endMonth} {$toYear}";
case self::FREQUENCY_ONE_OFF:
// '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ
$startDay = $from->format('j');
$startMonth = $from->format('M');
$endDay = $to->format('j');
$endMonth = $to->format('M');
// If same month and year, use a format like '2-31 May 2025'
if ($startMonth === $endMonth && ! $differentYears) {
return "{$startDay} - {$endDay} {$startMonth} {$toYear}";
}
// If different years, include both years
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
// Same year but different months
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
default:
// Default format for unknown frequencies
return $from->format('j M Y') . ' - ' . $to->format('j M Y');
}
}
public function getReportTeamsName(AutomatedReportResult $report): string
{
$groups = $report->getGroups();
if (empty($groups)) {
return 'All';
}
// Get group names from repository
$groupNames = [];
foreach ($groups as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group) {
$groupNames[] = $group->getName();
}
}
if (count($groupNames) === 1) {
// Single team format
$teamsName = $groupNames[0];
} else {
// Multiple teams format
$teamsName = implode(', ', $groupNames);
}
return $teamsName;
}
public function getReportFileName(AutomatedReportResult $report): string
{
$customName = $report->getReport()->getCustomName();
$periodName = $this->getReportPeriodName($report);
$filenameSuffix = $this->getFilenameSuffix($report);
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$customName} - {$periodName}");
}
$baseName = $this->getReportTypeName($report);
if ($filenameSuffix) {
$baseName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}");
}
public function getReportFileNameWithExtension(AutomatedReportResult $result): string
{
$extension = $this->getMediaTypeMetadata($result)['extension'];
return $this->getReportFileName($result) . '.' . $extension;
}
public function sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool
{
$recipients = array_map('intval', $report->getRecipients()['users'] ?? []);
return in_array($user->getId(), $recipients);
}
public function transformReportResults(Collection $automatedReportResults): array
{
$data = [];
foreach ($automatedReportResults as $automatedReportResult) {
/** @var AutomatedReportResult $automatedReportResult */
$report = $automatedReportResult->getReport();
$createdBy = $report->getCreator();
$creator = [
'id' => $createdBy?->getUuid(),
'name' => $createdBy?->getName(),
'email' => $createdBy?->getEmailAddress(),
'photoUrl' => $createdBy?->getPhotoUrl(),
];
$recipients = $this->buildRecipients($report);
$data[] = [
'id' => $automatedReportResult->getUuid(),
'name' => $automatedReportResult->getName(),
'frequency' => $this->transformFrequency($report->getFrequency()),
'recipients' => $recipients,
'recipients' => [
...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),
...array_values($this->transformRecipients($report->getRecipients())),
],
'report_type' => $this->transformReportType($report->getType()),
'media_type' => $automatedReportResult->getMediaType(),
'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),
'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),
'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),
'creator' => $creator,
];
}
return $data;
}
private function buildRecipients(AutomatedReport $report)
{
}
public function hasCallTypeConference(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);
}
public function hasCallTypeDialer(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);
}
// transformers
private function transformTeam(Team $team): array
{
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
return [];
}
return [
'id' => $team->getUuid(),
'name' => $team->getName(),
];
}
private function transformReportFullView(AutomatedReport $report): array
{
$base = $this->transformReportBase($report);
return $report->getType() === self::TYPE_ASK_JIMINNY
? $base + $this->transformAskJiminnyFields($report)
: $base + $this->transformStandardReportFields($report);
}
private function transformReportBase(AutomatedReport $report): array
{
return [
'id' => $report->getUuid(),
'organization' => $this->transformOrganization(team: $report->getTeam()),
'report_type' => $this->transformReportType($report->getType()),
'frequency' => $this->transformFrequency($report->getFrequency()),
];
}
private function transformStandardReportFields(AutomatedReport $report): array
{
$team = $report->getTeam();
return [
'report_enabled' => $report->getStatus(),
'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),
'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),
'deal_value_min' => $report->getDealValueMin(),
'deal_value_max' => $report->getDealValueMax(),
'call_types' => $this->transformCallType($report->getCallTypes()),
'media_types' => $this->transformMediaTypes($report),
'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),
'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),
'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),
'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),
'recipients' => $this->transformRecipients($report->getRecipients()),
'created_by' => $this->transformCreator($report->getCreator()),
'additional_prompt_input' => $report->getAdditionalPromptInput(),
'custom_name' => $report->getCustomName(),
'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),
'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),
'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),
];
}
private function transformAskJiminnyFields(AutomatedReport $report): array
{
$team = $report->getTeam();
$creatorId = $report->getAttribute('created_by');
$explicitUserIds = array_values(array_filter(
$report->getRecipients()['users'] ?? [],
static fn ($id) => $id !== $creatorId
));
return [
'report_name' => $report->getCustomName(),
'enabled' => $report->getStatus(),
'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),
'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),
'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),
'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),
];
}
private function transformOrganization(?Team $team): array
{
return [
'id' => $team?->getUuid(),
'name' => $team?->getName(),
];
}
private function transformReportType(string $type): array
{
foreach (self::ALL_TYPES as $typeItem) {
if ($typeItem['id'] === $type) {
return $typeItem;
}
}
return [];
}
private function transformCallType(array $types): array
{
$result = [];
$callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];
foreach ($types as $type) {
foreach ($callTypes as $callTypeItem) {
if ($callTypeItem['id'] === $type) {
$result[] = $callTypeItem;
break;
}
}
}
return $result;
}
private function transformMediaTypes(AutomatedReport $report): array
{
$values = [];
foreach ($report->getMediaTypes() as $mediaType) {
if (! in_array($mediaType, self::MEDIA_TYPES, true)) {
continue;
}
$values[] = match ($mediaType) {
self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,
self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,
};
}
return $values;
}
private function transformFrequency(string $frequency): array
{
foreach (self::ALL_FREQUENCIES as $frequencyItem) {
if ($frequencyItem['id'] === $frequency) {
return $frequencyItem;
}
}
return [];
}
public function transformDurationToMinutes(?int $duration): ?int
{
if (! $duration) {
return null;
}
return (int) ($duration / 60);
}
private function transformGroups(?Team $team, array $groupsIds): array
{
if (empty($groupsIds) || ! $team) {
return [];
}
$data = [];
foreach ($groupsIds as $groupId) {
$group = $team->groups()->where('id', $groupId)->first();
if ($group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
'photoUrl' => $group->getPhotoUrl(),
];
}
}
return $data;
}
private function transformStages(?Team $team, array $stagesIds): array
{
if (empty($stagesIds) || ! $team) {
return [];
}
$data = [];
foreach ($stagesIds as $stageId) {
$stage = $team->stages()->where('id', $stageId)->first();
if ($stage) {
$data[] = [
'id' => $stage->getUuid(),
'name' => $stage->getName(),
];
}
}
return $data;
}
private function transformRecipients(array $recipients): array
{
$users = [];
foreach ($recipients['users'] ?? [] as $userId) {
$users[] = $this->transformUser($userId);
}
return $users;
}
private function transformCreator(?User $user): ?array
{
if ($user === null) {
return null;
}
return $this->transformUser($user->getId());
}
private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array
{
if ($prompt === null) {
return null;
}
return [
'id' => $prompt->getUuid(),
'name' => $prompt->getTitle(),
];
}
private function transformSafeSearch(?Search $search): ?array
{
if ($search === null) {
return null;
}
return [
'id' => $search->getUuid(),
'name' => $search->getName(),
];
}
private function transformUser(int $userId): array
{
/* @var ?User $user */
$user = $this->userRepository->find($userId);
return [
'id' => $user?->getUuid(),
'name' => $user?->getName(),
'email' => $user?->getEmailAddress(),
'photoUrl' => $user?->getPhotoUrl(),
];
}
public function create(array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$validatedData['created_by'] = auth()->id();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
public function update(string $uuid, array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$report = $this->automatedReportsRepository->findByUuid($uuid);
if (! $report) {
throw new InvalidArgumentException('Report not found');
}
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
/**
* Create an Ask Jiminny report.
*/
public function createAskJiminnyReport(array $data, User $creator): array
{
$validatedData = $this->validateAskJiminnyReportData($data, $creator);
$validatedData['created_by'] = $creator->getId();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
return $this->transformReportFullView($automatedReport);
}
/**
* Update an Ask Jiminny report.
*/
public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array
{
if (! $report->isAskJiminnyReport()) {
throw new InvalidArgumentException('Report is not an Ask Jiminny report');
}
$validatedData = $this->validateAskJiminnyReportData($data, $user);
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
return $this->transformReportFullView($automatedReport);
}
public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array
{
$this->automatedReportsRepository->update($report, ['status' => $status]);
return $this->transformReportFullView($report->fresh());
}
/**
* Validate and transform data for Ask Jiminny reports.
*/
private function validateAskJiminnyReportData(array $data, User $user): array
{
// Validate name
$name = trim($data['report_name'] ?? '');
if (empty($name)) {
throw new InvalidArgumentException('Report name is required');
}
if (mb_strlen($name) > 50) {
throw new InvalidArgumentException('Report name must be 50 characters or less');
}
// Validate frequency (only daily, weekly, monthly for Ask Jiminny)
$frequency = $data['frequency'] ?? null;
$askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];
if (! in_array($frequency, $askJiminnyFrequencies, true)) {
throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');
}
// Validate expiration date
$expiresAt = $data['expires_on'] ?? null;
if (empty($expiresAt)) {
throw new InvalidArgumentException('Expiration date is required');
}
try {
$expiresAtDate = Carbon::parse($expiresAt);
} catch (InvalidFormatException $e) {
throw new InvalidArgumentException('Expiration date format is invalid');
}
$maxExpiration = Carbon::now()->addYear()->endOfDay();
if ($expiresAtDate->gt($maxExpiration)) {
throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');
}
if ($expiresAtDate->isPast()) {
throw new InvalidArgumentException('Expiration date cannot be in the past');
}
// Validate saved search
$activitySearchId = $data['saved_search'] ?? null;
if (empty($activitySearchId)) {
throw new InvalidArgumentException('Saved search is required');
}
$savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);
if (! $savedSearch) {
throw new InvalidArgumentException('Saved search not found or does not belong to you');
}
// Validate saved prompt
$askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;
if (empty($askAnythingPromptId)) {
throw new InvalidArgumentException('Ask Jiminny prompt is required');
}
$prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);
if (! $prompt) {
throw new InvalidArgumentException('Ask Jiminny prompt not found');
}
// Validate status
$status = $data['enabled'] ?? false;
$recipientUserIds = [$user->getId()];
if (! empty($data['share_users'])) {
$sharedUserIds = $this->validateAndGetUserIdsByTeam(
$user->team,
(array) $data['share_users']
);
$recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);
}
$sharedGroupIds = [];
if (! empty($data['share_teams'])) {
$sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);
}
$recipientUserIds = array_values(array_unique($recipientUserIds));
return [
'team_id' => $user->getTeamId(),
'type' => self::TYPE_ASK_JIMINNY,
'status' => (bool) $status,
'frequency' => $frequency,
'custom_name' => $name,
'activity_search_id' => $savedSearch->getId(),
'ask_anything_prompt_id' => $prompt->getId(),
'expires_at' => $expiresAtDate->toDateString(),
'media_types' => [self::MEDIA_TYPE_PDF],
'call_types' => [],
'recipients' => ['users' => $recipientUserIds],
'groups' => $sharedGroupIds,
];
}
public static function getAskJiminnyFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::ASK_JIMINNY_FREQUENCIES);
}
public function getAskJiminnyReportFilters(User $user): array
{
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
return [
[
'id' => 'prompt',
'label' => 'Prompt',
'options' => $prompts,
],
[
'id' => 'saved_search',
'label' => 'Saved Search',
'options' => $savedSearches,
],
];
}
public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array
{
$team = $user->getTeam();
$userTimezone = $user->getTimezone();
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
$teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [
'id' => $group->getUuid(),
'name' => $group->getName(),
])->values()->all();
$shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];
$sharedTeamsValue = [];
$sharedUsersValue = [];
if ($report) {
$sharedTeamsValue = $this->transformGroups($team, $report->getGroups());
$recipientUserIds = $report->getRecipients()['users'] ?? [];
$creatorId = $report->getAttribute('created_by');
$sharedUserIds = array_values(array_filter(
$recipientUserIds,
static fn ($id) => $id !== $creatorId
));
$sharedUsersValue = collect($sharedUserIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (User $u) => [
'id' => $u->getUuid(),
'name' => $u->getName(),
])
->values()
->all();
}
return [
'fields' => [
[
'id' => 'enabled',
'inputType' => InputTypeEnum::TOGGLE,
'label' => '',
'value' => $report?->getStatus() ?? false,
],
[
'id' => 'report_name',
'inputType' => InputTypeEnum::TEXT,
'label' => 'Name',
'placeholder' => 'Enter name',
'required' => true,
'validation' => ['maxLength' => 50],
'value' => $report?->getCustomName() ?? '',
],
[
'id' => 'frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'label' => 'Frequency',
'required' => true,
'placeholder' => 'Select',
'options' => self::ASK_JIMINNY_FREQUENCIES,
'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,
],
[
'id' => 'expires_on',
'inputType' => InputTypeEnum::DATE,
'label' => 'Expires on',
'required' => true,
'placeholder' => 'Select',
'validation' => [
'minDate' => now($userTimezone)->toDateString(),
'maxDate' => now($userTimezone)->addYear()->toDateString(),
],
'value' => $report?->getExpiresAt()?->toDateString(),
],
[
...
|
NULL
|
|
66591
|
NULL
|
0
|
2026-04-21T14:48:30.680379+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776782910680_m2.jpg...
|
PhpStorm
|
faVsco.js – AutomatedReportsService.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsRepositoryTest
Run 'AutomatedReportsRepositoryTest'
Debug 'AutomatedReportsRepositoryTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
3
102
3
34
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Kiosk\AutomatedReports;
use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Carbon\Exceptions\InvalidFormatException;
use DateTime;
use DateTimeInterface;
use DateTimeZone;
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcher;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Jiminny\Component\ActivitySearch\FilterDefinition\InputTypeEnum;
use Jiminny\Component\AskAnything\AskAnythingPromptService;
use Jiminny\Component\AskAnything\Dtos\AskAnythingPromptDto;
use Jiminny\Component\UrlGenerator\Webhook;
use Jiminny\Contracts\Repositories\PlaybookCategoryRepository;
use Jiminny\Contracts\Repositories\TeamRepository;
use Jiminny\Contracts\Repositories\UserRepository;
use Jiminny\Exceptions\ApplicationException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Exceptions\ModelNotFoundException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateReportJob;
use Jiminny\Models\Activity\Search;
use Jiminny\Models\AskAnything\AskAnythingPrompt;
use Jiminny\Models\AskAnything\AskAnythingPromptTarget;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Contracts\UserContract;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AskAnythingRepository;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Repositories\GroupRepository;
use Jiminny\Repositories\SearchRepository;
use Jiminny\Repositories\StageRepository;
use Throwable;
class AutomatedReportsService
{
public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';
public const string TYPE_ASK_JIMINNY = 'ask_jiminny';
/**
* Standard report types (used by kiosk for existing automated reports).
*/
// @TODO this will add filter, however if we need to control feature by FF we need conditional logic
public const array TYPES = [
['id' => 'exec_summary', 'name' => 'Exec Summary'],
['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],
['id' => 'product_feedback', 'name' => 'Product Feedback'],
['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],
// ['id' => 'questions', 'name' => 'Questions'],
// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],
];
public const array ALL_TYPES = [
...self::TYPES,
['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],
];
public const string FREQUENCY_DAILY = 'daily';
public const string FREQUENCY_WEEKLY = 'weekly';
public const string FREQUENCY_MONTHLY = 'monthly';
public const string FREQUENCY_QUARTERLY = 'quarterly';
public const string FREQUENCY_ONE_OFF = 'one_off';
/**
* Frequencies for standard (non-Ask Jiminny) reports.
*/
public const array FREQUENCIES = [
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
/**
* Frequencies for Ask Jiminny reports.
*/
public const array ASK_JIMINNY_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
];
public const string MEDIA_TYPE_PDF = 'pdf';
public const string MEDIA_TYPE_PODCAST = 'podcast';
public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];
public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];
public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];
public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];
public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];
public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];
public const int SENT_REPORT_AT_HOURS = 5;
public const string PDF_KEY = 'pdf';
public const string AUDIO_KEY = 'audio';
private const array ALL_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
private const string S3_DIR = 'reports';
private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];
private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];
public function __construct(
private readonly TeamRepository $teamRepository,
private readonly GroupRepository $groupRepository,
private readonly UserRepository $userRepository,
private readonly StageRepository $stageRepository,
private readonly DealStagesService $dealStagesService,
private readonly RecipientsService $recipientsService,
private readonly AutomatedReportsRepository $automatedReportsRepository,
private readonly Webhook $webhookService,
private readonly BusDispatcher $dispatcher,
private readonly ActivityTypeService $activityTypeService,
private readonly PlaybookCategoryRepository $playbookCategoryRepository,
private readonly AskAnythingPromptService $askAnythingPromptService,
private readonly SearchRepository $activitySearchRepository,
private readonly AskAnythingRepository $askAnythingRepository,
) {
}
public static function getTypes(): array
{
$types = self::TYPES;
return array_map(static function ($type) {
return $type['id'];
}, $types);
}
public static function getCallTypes(): array
{
return array_map(static function ($callType) {
return $callType['id'];
}, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);
}
public static function getFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::FREQUENCIES);
}
// front-facing structure
public function getReportEnabledFieldData(bool $value = false): array
{
return [
'id' => 'report_enabled',
'label' => '',
'inputType' => InputTypeEnum::TOGGLE,
'value' => $value,
];
}
// Organizations = Teams
public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array
{
$options = $this->getTeams();
if ($shortVersion) {
return [
'id' => 'organization',
'label' => 'Organization',
'options' => $options,
];
}
return [
'id' => 'organization',
'label' => 'Organization',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $options,
'value' => $value,
'dependencies' => [
'teams',
'deal_stage_at_call',
'current_deal_stage',
'recipients',
ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,
],
'dependsOn' => [],
];
}
// Teams = Groups
public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array
{
if ($shortVersion) {
return [
'id' => 'teams',
'label' => 'Team',
'options' => $options,
];
}
return [
'id' => 'teams',
'label' => 'Team',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => false,
'placeholder' => 'Select',
'options' => $options,
'value' => $value, // value should be an array of objects {id, name}
'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],
'dependsOn' => [],
];
}
public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array
{
$types = [];
if ($team instanceof Team) {
if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
$types = self::TYPES;
}
if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {
$types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];
}
} else {
$types = self::TYPES;
}
if ($shortVersion) {
return [
'id' => 'report_type',
'label' => 'Report Type',
'options' => $types,
];
}
return [
'id' => 'report_type',
'label' => 'Report Type',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $types,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getFrequencyFieldData(?string $value = null): array
{
return [
'id' => 'frequency',
'label' => 'Frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => self::FREQUENCIES,
'value' => $value,
'dependencies' => ['period'],
'dependsOn' => [],
];
}
public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array
{
return [
'id' => 'period',
'label' => 'Select one-off period',
'inputType' => InputTypeEnum::DATE_RANGE,
'required' => true,
'placeholder' => 'Select',
'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],
'queryParams' => [
'startDate' => 'start_date_period',
'endDate' => 'end_date_period',
],
'dependencies' => [],
'dependsOn' => ['frequency'],
];
}
public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array
{
return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);
}
public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);
}
public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);
}
public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'deal_value',
'label' => 'Deal Value',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_deal_value',
'max' => 'max_deal_value',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array
{
$value = [];
$conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;
$dialerOn && $value[] = self::CALL_TYPE_DIALER;
return [
'id' => 'call_type',
'label' => 'Call Type',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => [
self::CALL_TYPE_CONFERENCE,
self::CALL_TYPE_DIALER,
],
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getMediaTypeFieldData(?AutomatedReport $report = null): array
{
$value = [];
if ($report) {
$value = $this->transformMediaTypes($report);
}
return [
'id' => 'media_types',
'label' => 'Export as',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => self::MEDIA_TYPE_OBJECTS,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'call_duration',
'label' => 'Call Duration',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_call_duration',
'max' => 'max_call_duration',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getRecipientsFieldData(?Team $team = null, array $value = []): array
{
return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);
}
public function getJiminnyRecipientsFieldData(array $value = []): array
{
return $this->recipientsService->getJiminnyRecipientsFieldData($value);
}
public function getAdditionalPromptInputFieldData(?string $value = null): array
{
return [
'id' => 'additional_prompt_input',
'label' => 'Special requirements',
'inputType' => InputTypeEnum::TEXTAREA,
'required' => false,
'placeholder' => 'What should be the focus of the report?',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCustomReportNameFieldData(?string $value = null): array
{
return [
'id' => 'custom_name',
'label' => 'Custom report name',
'inputType' => InputTypeEnum::TEXT,
'required' => false,
'placeholder' => 'Enter custom name',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
// data providers
public function getTeams(): array
{
$teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);
$teamData = [];
foreach ($teams as $team) {
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
continue;
}
$teamData[] = $this->transformTeam($team);
}
return $teamData;
}
public function getTeamGroups(string $teamUuid): array
{
$data = [];
$team = $this->getTeam($teamUuid);
if ($team !== null) {
$groups = $team->groups()->get();
foreach ($groups as $group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
];
}
}
return $data;
}
public function getTeamsGroupsOptions(array $filterTeamUuids = []): array
{
$data = [];
$teams = $this->getTeams();
foreach ($teams as $team) {
if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {
continue;
}
$data[] = [
'label' => $team['name'],
'groups' => $this->getTeamGroups($team['id']),
];
}
return $data;
}
public function getTeam(string $teamUuid): ?Team
{
return $this->teamRepository->idOrUuid($teamUuid);
}
public function getTeamById(int $teamId): ?Team
{
return $this->teamRepository->find($teamId);
}
public function getGroupsUuids(AutomatedReport $report): array
{
$uuids = [];
$reportGroups = $report->getGroups();
foreach ($reportGroups as $groupId) {
if ($group = $this->groupRepository->find($groupId)) {
$uuids[] = $group->getUuid();
}
}
return $uuids;
}
public function getPlaybookCategoriesUuids(AutomatedReport $report): array
{
$uuids = [];
$playbookCategories = $report->getPlaybookCategories();
foreach ($playbookCategories as $id) {
if ($category = $this->playbookCategoryRepository->find($id)) {
$uuids[] = $category->getUuid();
}
}
return $uuids;
}
public function getDealAtCallStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getDealAtCallStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getCurrentDealStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getCurrentDealStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getRecipients());
}
public function getJiminnyUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function extractUserUuids(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => $user->getUuid())
->values()
->all();
}
// get mail data
public function getRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getRecipients());
}
/**
* @return array<UserContract>
*/
public function getRecipientUserObjects(AutomatedReport $report): array
{
$userIds = $report->getRecipients()['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->values()
->all();
}
private function getJiminnyRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function buildRecipientUsers(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => [
'email' => $user->getEmailAddress(),
'name' => $user->getName(),
'timezone' => $user->getTimezone()->getName(),
])
->values()
->all();
}
public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array
{
if ($report->isAskJiminnyReport()) {
$recipients = $this->resolveAskJiminnyRecipients($report);
} else {
$recipients = $this->getRecipientUsers($report);
if ($includeJiminny) {
$recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));
}
}
$emails = [];
return array_values(array_filter(
$recipients,
static function ($recipient) use (&$emails) {
if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {
return false;
}
$emails[] = $recipient['email'];
return true;
}
));
}
private function resolveAskJiminnyRecipients(AutomatedReport $report): array
{
$recipients = [];
$creator = $report->getCreator();
if ($creator !== null) {
$recipients[] = [
'email' => $creator->getEmailAddress(),
'name' => $creator->getName(),
'timezone' => $creator->getTimezone()->getName(),
];
}
return array_merge(
$recipients,
$this->buildRecipientUsers($report->getRecipients()),
$this->getGroupRecipientUsers($report),
);
}
private function getGroupRecipientUsers(AutomatedReport $report): array
{
$users = [];
foreach ($report->getGroups() as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group === null) {
continue;
}
foreach ($group->getMembers() as $member) {
$users[] = [
'email' => $member->getEmailAddress(),
'name' => $member->getName(),
'timezone' => $member->getTimezone()->getName(),
];
}
}
return $users;
}
public function getReportTypeName(AutomatedReportResult $report): string
{
$type = $report->getReport()->getType();
$getType = $this->transformReportType($type);
return $getType['name'];
}
public function getReportPeriodName(AutomatedReportResult $report): string
{
$from = $report->getFromDate();
$to = $report->getToDate();
$frequency = $report->getReport()->getFrequency();
if ($from === null || $to === null) {
if (! $report->getReport()->isAskJiminnyReport()) {
$invalidPeriod = $from === null ? 'from' : 'to';
throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);
}
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
}
return $this->formatReportPeriodName($frequency, $from, $to);
}
private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string
{
$fromYear = $from->format('Y');
$toYear = $to->format('Y');
$differentYears = $fromYear !== $toYear;
switch ($frequency) {
case self::FREQUENCY_DAILY:
return $from->format('j M Y');
case self::FREQUENCY_QUARTERLY:
// 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ
$startMonth = $from->format('M');
$endMonth = $to->copy()->subMonth();
$endMonthName = $endMonth->format('M');
$endMonthYear = $endMonth->format('Y');
if ($differentYears) {
return "{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}";
}
return "{$startMonth} - {$endMonthName} {$toYear}";
case self::FREQUENCY_MONTHLY:
// 'May 2025' - monthly reports are always within the same year
return $from->format('M Y');
case self::FREQUENCY_WEEKLY:
// '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ
$startDay = $from->format('j');
$endDay = $to->format('j');
$startMonth = $from->format('M');
$endMonth = $to->format('M');
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
if ($startMonth !== $endMonth) {
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
}
return "{$startDay} - {$endDay} {$endMonth} {$toYear}";
case self::FREQUENCY_ONE_OFF:
// '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ
$startDay = $from->format('j');
$startMonth = $from->format('M');
$endDay = $to->format('j');
$endMonth = $to->format('M');
// If same month and year, use a format like '2-31 May 2025'
if ($startMonth === $endMonth && ! $differentYears) {
return "{$startDay} - {$endDay} {$startMonth} {$toYear}";
}
// If different years, include both years
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
// Same year but different months
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
default:
// Default format for unknown frequencies
return $from->format('j M Y') . ' - ' . $to->format('j M Y');
}
}
public function getReportTeamsName(AutomatedReportResult $report): string
{
$groups = $report->getGroups();
if (empty($groups)) {
return 'All';
}
// Get group names from repository
$groupNames = [];
foreach ($groups as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group) {
$groupNames[] = $group->getName();
}
}
if (count($groupNames) === 1) {
// Single team format
$teamsName = $groupNames[0];
} else {
// Multiple teams format
$teamsName = implode(', ', $groupNames);
}
return $teamsName;
}
public function getReportFileName(AutomatedReportResult $report): string
{
$customName = $report->getReport()->getCustomName();
$periodName = $this->getReportPeriodName($report);
$filenameSuffix = $this->getFilenameSuffix($report);
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$customName} - {$periodName}");
}
$baseName = $this->getReportTypeName($report);
if ($filenameSuffix) {
$baseName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}");
}
public function getReportFileNameWithExtension(AutomatedReportResult $result): string
{
$extension = $this->getMediaTypeMetadata($result)['extension'];
return $this->getReportFileName($result) . '.' . $extension;
}
public function sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool
{
$recipients = array_map('intval', $report->getRecipients()['users'] ?? []);
return in_array($user->getId(), $recipients);
}
public function transformReportResults(Collection $automatedReportResults): array
{
$data = [];
foreach ($automatedReportResults as $automatedReportResult) {
/** @var AutomatedReportResult $automatedReportResult */
$report = $automatedReportResult->getReport();
$createdBy = $report->getCreator();
$creator = [
'id' => $createdBy?->getUuid(),
'name' => $createdBy?->getName(),
'email' => $createdBy?->getEmailAddress(),
'photoUrl' => $createdBy?->getPhotoUrl(),
];
$recipients = $this->buildRecipients($report);
$data[] = [
'id' => $automatedReportResult->getUuid(),
'name' => $automatedReportResult->getName(),
'frequency' => $this->transformFrequency($report->getFrequency()),
'recipients' => $recipients,
'recipients' => [
...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),
...array_values($this->transformRecipients($report->getRecipients())),
],
'report_type' => $this->transformReportType($report->getType()),
'media_type' => $automatedReportResult->getMediaType(),
'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),
'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),
'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),
'creator' => $creator,
];
}
return $data;
}
private function buildRecipients(AutomatedReport $report)
{
}
public function hasCallTypeConference(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);
}
public function hasCallTypeDialer(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);
}
// transformers
private function transformTeam(Team $team): array
{
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
return [];
}
return [
'id' => $team->getUuid(),
'name' => $team->getName(),
];
}
private function transformReportFullView(AutomatedReport $report): array
{
$base = $this->transformReportBase($report);
return $report->getType() === self::TYPE_ASK_JIMINNY
? $base + $this->transformAskJiminnyFields($report)
: $base + $this->transformStandardReportFields($report);
}
private function transformReportBase(AutomatedReport $report): array
{
return [
'id' => $report->getUuid(),
'organization' => $this->transformOrganization(team: $report->getTeam()),
'report_type' => $this->transformReportType($report->getType()),
'frequency' => $this->transformFrequency($report->getFrequency()),
];
}
private function transformStandardReportFields(AutomatedReport $report): array
{
$team = $report->getTeam();
return [
'report_enabled' => $report->getStatus(),
'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),
'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),
'deal_value_min' => $report->getDealValueMin(),
'deal_value_max' => $report->getDealValueMax(),
'call_types' => $this->transformCallType($report->getCallTypes()),
'media_types' => $this->transformMediaTypes($report),
'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),
'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),
'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),
'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),
'recipients' => $this->transformRecipients($report->getRecipients()),
'created_by' => $this->transformCreator($report->getCreator()),
'additional_prompt_input' => $report->getAdditionalPromptInput(),
'custom_name' => $report->getCustomName(),
'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),
'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),
'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),
];
}
private function transformAskJiminnyFields(AutomatedReport $report): array
{
$team = $report->getTeam();
$creatorId = $report->getAttribute('created_by');
$explicitUserIds = array_values(array_filter(
$report->getRecipients()['users'] ?? [],
static fn ($id) => $id !== $creatorId
));
return [
'report_name' => $report->getCustomName(),
'enabled' => $report->getStatus(),
'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),
'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),
'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),
'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),
];
}
private function transformOrganization(?Team $team): array
{
return [
'id' => $team?->getUuid(),
'name' => $team?->getName(),
];
}
private function transformReportType(string $type): array
{
foreach (self::ALL_TYPES as $typeItem) {
if ($typeItem['id'] === $type) {
return $typeItem;
}
}
return [];
}
private function transformCallType(array $types): array
{
$result = [];
$callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];
foreach ($types as $type) {
foreach ($callTypes as $callTypeItem) {
if ($callTypeItem['id'] === $type) {
$result[] = $callTypeItem;
break;
}
}
}
return $result;
}
private function transformMediaTypes(AutomatedReport $report): array
{
$values = [];
foreach ($report->getMediaTypes() as $mediaType) {
if (! in_array($mediaType, self::MEDIA_TYPES, true)) {
continue;
}
$values[] = match ($mediaType) {
self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,
self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,
};
}
return $values;
}
private function transformFrequency(string $frequency): array
{
foreach (self::ALL_FREQUENCIES as $frequencyItem) {
if ($frequencyItem['id'] === $frequency) {
return $frequencyItem;
}
}
return [];
}
public function transformDurationToMinutes(?int $duration): ?int
{
if (! $duration) {
return null;
}
return (int) ($duration / 60);
}
private function transformGroups(?Team $team, array $groupsIds): array
{
if (empty($groupsIds) || ! $team) {
return [];
}
$data = [];
foreach ($groupsIds as $groupId) {
$group = $team->groups()->where('id', $groupId)->first();
if ($group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
'photoUrl' => $group->getPhotoUrl(),
];
}
}
return $data;
}
private function transformStages(?Team $team, array $stagesIds): array
{
if (empty($stagesIds) || ! $team) {
return [];
}
$data = [];
foreach ($stagesIds as $stageId) {
$stage = $team->stages()->where('id', $stageId)->first();
if ($stage) {
$data[] = [
'id' => $stage->getUuid(),
'name' => $stage->getName(),
];
}
}
return $data;
}
private function transformRecipients(array $recipients): array
{
$users = [];
foreach ($recipients['users'] ?? [] as $userId) {
$users[] = $this->transformUser($userId);
}
return $users;
}
private function transformCreator(?User $user): ?array
{
if ($user === null) {
return null;
}
return $this->transformUser($user->getId());
}
private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array
{
if ($prompt === null) {
return null;
}
return [
'id' => $prompt->getUuid(),
'name' => $prompt->getTitle(),
];
}
private function transformSafeSearch(?Search $search): ?array
{
if ($search === null) {
return null;
}
return [
'id' => $search->getUuid(),
'name' => $search->getName(),
];
}
private function transformUser(int $userId): array
{
/* @var ?User $user */
$user = $this->userRepository->find($userId);
return [
'id' => $user?->getUuid(),
'name' => $user?->getName(),
'email' => $user?->getEmailAddress(),
'photoUrl' => $user?->getPhotoUrl(),
];
}
public function create(array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$validatedData['created_by'] = auth()->id();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
public function update(string $uuid, array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$report = $this->automatedReportsRepository->findByUuid($uuid);
if (! $report) {
throw new InvalidArgumentException('Report not found');
}
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
/**
* Create an Ask Jiminny report.
*/
public function createAskJiminnyReport(array $data, User $creator): array
{
$validatedData = $this->validateAskJiminnyReportData($data, $creator);
$validatedData['created_by'] = $creator->getId();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
return $this->transformReportFullView($automatedReport);
}
/**
* Update an Ask Jiminny report.
*/
public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array
{
if (! $report->isAskJiminnyReport()) {
throw new InvalidArgumentException('Report is not an Ask Jiminny report');
}
$validatedData = $this->validateAskJiminnyReportData($data, $user);
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
return $this->transformReportFullView($automatedReport);
}
public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array
{
$this->automatedReportsRepository->update($report, ['status' => $status]);
return $this->transformReportFullView($report->fresh());
}
/**
* Validate and transform data for Ask Jiminny reports.
*/
private function validateAskJiminnyReportData(array $data, User $user): array
{
// Validate name
$name = trim($data['report_name'] ?? '');
if (empty($name)) {
throw new InvalidArgumentException('Report name is required');
}
if (mb_strlen($name) > 50) {
throw new InvalidArgumentException('Report name must be 50 characters or less');
}
// Validate frequency (only daily, weekly, monthly for Ask Jiminny)
$frequency = $data['frequency'] ?? null;
$askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];
if (! in_array($frequency, $askJiminnyFrequencies, true)) {
throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');
}
// Validate expiration date
$expiresAt = $data['expires_on'] ?? null;
if (empty($expiresAt)) {
throw new InvalidArgumentException('Expiration date is required');
}
try {
$expiresAtDate = Carbon::parse($expiresAt);
} catch (InvalidFormatException $e) {
throw new InvalidArgumentException('Expiration date format is invalid');
}
$maxExpiration = Carbon::now()->addYear()->endOfDay();
if ($expiresAtDate->gt($maxExpiration)) {
throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');
}
if ($expiresAtDate->isPast()) {
throw new InvalidArgumentException('Expiration date cannot be in the past');
}
// Validate saved search
$activitySearchId = $data['saved_search'] ?? null;
if (empty($activitySearchId)) {
throw new InvalidArgumentException('Saved search is required');
}
$savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);
if (! $savedSearch) {
throw new InvalidArgumentException('Saved search not found or does not belong to you');
}
// Validate saved prompt
$askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;
if (empty($askAnythingPromptId)) {
throw new InvalidArgumentException('Ask Jiminny prompt is required');
}
$prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);
if (! $prompt) {
throw new InvalidArgumentException('Ask Jiminny prompt not found');
}
// Validate status
$status = $data['enabled'] ?? false;
$recipientUserIds = [$user->getId()];
if (! empty($data['share_users'])) {
$sharedUserIds = $this->validateAndGetUserIdsByTeam(
$user->team,
(array) $data['share_users']
);
$recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);
}
$sharedGroupIds = [];
if (! empty($data['share_teams'])) {
$sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);
}
$recipientUserIds = array_values(array_unique($recipientUserIds));
return [
'team_id' => $user->getTeamId(),
'type' => self::TYPE_ASK_JIMINNY,
'status' => (bool) $status,
'frequency' => $frequency,
'custom_name' => $name,
'activity_search_id' => $savedSearch->getId(),
'ask_anything_prompt_id' => $prompt->getId(),
'expires_at' => $expiresAtDate->toDateString(),
'media_types' => [self::MEDIA_TYPE_PDF],
'call_types' => [],
'recipients' => ['users' => $recipientUserIds],
'groups' => $sharedGroupIds,
];
}
public static function getAskJiminnyFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::ASK_JIMINNY_FREQUENCIES);
}
public function getAskJiminnyReportFilters(User $user): array
{
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
return [
[
'id' => 'prompt',
'label' => 'Prompt',
'options' => $prompts,
],
[
'id' => 'saved_search',
'label' => 'Saved Search',
'options' => $savedSearches,
],
];
}
public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array
{
$team = $user->getTeam();
$userTimezone = $user->getTimezone();
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
$teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [
'id' => $group->getUuid(),
'name' => $group->getName(),
])->values()->all();
$shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];
$sharedTeamsValue = [];
$sharedUsersValue = [];
if ($report) {
$sharedTeamsValue = $this->transformGroups($team, $report->getGroups());
$recipientUserIds = $report->getRecipients()['users'] ?? [];
$creatorId = $report->getAttribute('created_by');
$sharedUserIds = array_values(array_filter(
$recipientUserIds,
static fn ($id) => $id !== $creatorId
));
$sharedUsersValue = collect($sharedUserIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (User $u) => [
'id' => $u->getUuid(),
'name' => $u->getName(),
])
->values()
->all();
}
return [
'fields' => [
[
'id' => 'enabled',
'inputType' => InputTypeEnum::TOGGLE,
'label' => '',
'value' => $report?->getStatus() ?? false,
],
[
'id' => 'report_name',
'inputType' => InputTypeEnum::TEXT,
'label' => 'Name',
'placeholder' => 'Enter name',
'required' => true,
'validation' => ['maxLength' => 50],
'value' => $report?->getCustomName() ?? '',
],
[
'id' => 'frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'label' => 'Frequency',
'required' => true,
'placeholder' => 'Select',
'options' => self::ASK_JIMINNY_FREQUENCIES,
'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,
],
[
'id' => 'expires_on',
'inputType' => InputTypeEnum::DATE,
'label' => 'Expires on',
'required' => true,
'placeholder' => 'Select',
'validation' => [
'minDate' => now($userTimezone)->toDateString(),
'maxDate' => now($userTimezone)->addYear()->toDateString(),
],
'value' => $report?->getExpiresAt()?->toDateString(),
],
[
...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"#11894 on JY-18909-automated-reports-ask-jiminny, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.12134308,"height":0.025538707},"help_text":"Pull request #11894 exists for current branch JY-18909-automated-reports-ask-jiminny","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8161569,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AutomatedReportsRepositoryTest","depth":6,"bounds":{"left":0.83144945,"top":0.019952115,"width":0.084109046,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AutomatedReportsRepositoryTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AutomatedReportsRepositoryTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"3","depth":4,"bounds":{"left":0.4325133,"top":0.17478053,"width":0.007978723,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"102","depth":4,"bounds":{"left":0.4424867,"top":0.17478053,"width":0.011968086,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"3","depth":4,"bounds":{"left":0.45644948,"top":0.17478053,"width":0.007978723,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"34","depth":4,"bounds":{"left":0.4664229,"top":0.17478053,"width":0.010305851,"height":0.015163607},"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.47839096,"top":0.17318435,"width":0.00731383,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.48570478,"top":0.17318435,"width":0.006981383,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Kiosk\\AutomatedReports;\n\nuse Carbon\\CarbonImmutable;\nuse Carbon\\CarbonInterface;\nuse Carbon\\Exceptions\\InvalidFormatException;\nuse DateTime;\nuse DateTimeInterface;\nuse DateTimeZone;\nuse Illuminate\\Contracts\\Bus\\Dispatcher as BusDispatcher;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Support\\Facades\\Log;\nuse Illuminate\\Support\\Facades\\Storage;\nuse Jiminny\\Component\\ActivitySearch\\FilterDefinition\\InputTypeEnum;\nuse Jiminny\\Component\\AskAnything\\AskAnythingPromptService;\nuse Jiminny\\Component\\AskAnything\\Dtos\\AskAnythingPromptDto;\nuse Jiminny\\Component\\UrlGenerator\\Webhook;\nuse Jiminny\\Contracts\\Repositories\\PlaybookCategoryRepository;\nuse Jiminny\\Contracts\\Repositories\\TeamRepository;\nuse Jiminny\\Contracts\\Repositories\\UserRepository;\nuse Jiminny\\Exceptions\\ApplicationException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Exceptions\\ModelNotFoundException;\nuse Jiminny\\Jobs\\AutomatedReports\\RequestGenerateReportJob;\nuse Jiminny\\Models\\Activity\\Search;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPrompt;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPromptTarget;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Contracts\\UserContract;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Repositories\\AskAnythingRepository;\nuse Jiminny\\Repositories\\AutomatedReportsRepository;\nuse Jiminny\\Repositories\\GroupRepository;\nuse Jiminny\\Repositories\\SearchRepository;\nuse Jiminny\\Repositories\\StageRepository;\nuse Throwable;\n\nclass AutomatedReportsService\n{\n public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';\n public const string TYPE_ASK_JIMINNY = 'ask_jiminny';\n\n /**\n * Standard report types (used by kiosk for existing automated reports).\n */\n // @TODO this will add filter, however if we need to control feature by FF we need conditional logic\n public const array TYPES = [\n ['id' => 'exec_summary', 'name' => 'Exec Summary'],\n ['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],\n ['id' => 'product_feedback', 'name' => 'Product Feedback'],\n ['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],\n// ['id' => 'questions', 'name' => 'Questions'],\n// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],\n ];\n\n public const array ALL_TYPES = [\n ...self::TYPES,\n ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],\n ];\n\n public const string FREQUENCY_DAILY = 'daily';\n public const string FREQUENCY_WEEKLY = 'weekly';\n public const string FREQUENCY_MONTHLY = 'monthly';\n public const string FREQUENCY_QUARTERLY = 'quarterly';\n public const string FREQUENCY_ONE_OFF = 'one_off';\n\n /**\n * Frequencies for standard (non-Ask Jiminny) reports.\n */\n public const array FREQUENCIES = [\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n\n /**\n * Frequencies for Ask Jiminny reports.\n */\n public const array ASK_JIMINNY_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ];\n\n public const string MEDIA_TYPE_PDF = 'pdf';\n public const string MEDIA_TYPE_PODCAST = 'podcast';\n public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];\n public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];\n public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];\n public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];\n\n public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];\n public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];\n public const int SENT_REPORT_AT_HOURS = 5;\n public const string PDF_KEY = 'pdf';\n public const string AUDIO_KEY = 'audio';\n\n private const array ALL_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n private const string S3_DIR = 'reports';\n private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];\n private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];\n\n public function __construct(\n private readonly TeamRepository $teamRepository,\n private readonly GroupRepository $groupRepository,\n private readonly UserRepository $userRepository,\n private readonly StageRepository $stageRepository,\n private readonly DealStagesService $dealStagesService,\n private readonly RecipientsService $recipientsService,\n private readonly AutomatedReportsRepository $automatedReportsRepository,\n private readonly Webhook $webhookService,\n private readonly BusDispatcher $dispatcher,\n private readonly ActivityTypeService $activityTypeService,\n private readonly PlaybookCategoryRepository $playbookCategoryRepository,\n private readonly AskAnythingPromptService $askAnythingPromptService,\n private readonly SearchRepository $activitySearchRepository,\n private readonly AskAnythingRepository $askAnythingRepository,\n ) {\n }\n\n public static function getTypes(): array\n {\n $types = self::TYPES;\n\n return array_map(static function ($type) {\n return $type['id'];\n }, $types);\n }\n\n public static function getCallTypes(): array\n {\n return array_map(static function ($callType) {\n return $callType['id'];\n }, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);\n }\n\n public static function getFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::FREQUENCIES);\n }\n\n // front-facing structure\n public function getReportEnabledFieldData(bool $value = false): array\n {\n return [\n 'id' => 'report_enabled',\n 'label' => '',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'value' => $value,\n ];\n }\n\n // Organizations = Teams\n public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array\n {\n $options = $this->getTeams();\n\n if ($shortVersion) {\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value,\n 'dependencies' => [\n 'teams',\n 'deal_stage_at_call',\n 'current_deal_stage',\n 'recipients',\n ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,\n ],\n 'dependsOn' => [],\n ];\n }\n\n // Teams = Groups\n public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array\n {\n if ($shortVersion) {\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value, // value should be an array of objects {id, name}\n 'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],\n 'dependsOn' => [],\n ];\n }\n\n public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array\n {\n $types = [];\n if ($team instanceof Team) {\n if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n $types = self::TYPES;\n }\n if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {\n $types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];\n }\n } else {\n $types = self::TYPES;\n }\n\n if ($shortVersion) {\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'options' => $types,\n ];\n }\n\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $types,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getFrequencyFieldData(?string $value = null): array\n {\n return [\n 'id' => 'frequency',\n 'label' => 'Frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::FREQUENCIES,\n 'value' => $value,\n 'dependencies' => ['period'],\n 'dependsOn' => [],\n ];\n }\n\n public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array\n {\n return [\n 'id' => 'period',\n 'label' => 'Select one-off period',\n 'inputType' => InputTypeEnum::DATE_RANGE,\n 'required' => true,\n 'placeholder' => 'Select',\n 'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],\n 'queryParams' => [\n 'startDate' => 'start_date_period',\n 'endDate' => 'end_date_period',\n ],\n 'dependencies' => [],\n 'dependsOn' => ['frequency'],\n ];\n }\n\n public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array\n {\n return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);\n }\n\n public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);\n }\n\n public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);\n }\n\n public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'deal_value',\n 'label' => 'Deal Value',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_deal_value',\n 'max' => 'max_deal_value',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array\n {\n $value = [];\n $conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;\n $dialerOn && $value[] = self::CALL_TYPE_DIALER;\n\n return [\n 'id' => 'call_type',\n 'label' => 'Call Type',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => [\n self::CALL_TYPE_CONFERENCE,\n self::CALL_TYPE_DIALER,\n ],\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getMediaTypeFieldData(?AutomatedReport $report = null): array\n {\n $value = [];\n\n if ($report) {\n $value = $this->transformMediaTypes($report);\n }\n\n return [\n 'id' => 'media_types',\n 'label' => 'Export as',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => self::MEDIA_TYPE_OBJECTS,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'call_duration',\n 'label' => 'Call Duration',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_call_duration',\n 'max' => 'max_call_duration',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getRecipientsFieldData(?Team $team = null, array $value = []): array\n {\n return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);\n }\n\n public function getJiminnyRecipientsFieldData(array $value = []): array\n {\n return $this->recipientsService->getJiminnyRecipientsFieldData($value);\n }\n\n public function getAdditionalPromptInputFieldData(?string $value = null): array\n {\n return [\n 'id' => 'additional_prompt_input',\n 'label' => 'Special requirements',\n 'inputType' => InputTypeEnum::TEXTAREA,\n 'required' => false,\n 'placeholder' => 'What should be the focus of the report?',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCustomReportNameFieldData(?string $value = null): array\n {\n return [\n 'id' => 'custom_name',\n 'label' => 'Custom report name',\n 'inputType' => InputTypeEnum::TEXT,\n 'required' => false,\n 'placeholder' => 'Enter custom name',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n // data providers\n public function getTeams(): array\n {\n $teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);\n\n $teamData = [];\n foreach ($teams as $team) {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n continue;\n }\n\n $teamData[] = $this->transformTeam($team);\n }\n\n return $teamData;\n }\n\n public function getTeamGroups(string $teamUuid): array\n {\n $data = [];\n $team = $this->getTeam($teamUuid);\n\n if ($team !== null) {\n $groups = $team->groups()->get();\n\n foreach ($groups as $group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n public function getTeamsGroupsOptions(array $filterTeamUuids = []): array\n {\n $data = [];\n $teams = $this->getTeams();\n\n foreach ($teams as $team) {\n if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {\n continue;\n }\n\n $data[] = [\n 'label' => $team['name'],\n 'groups' => $this->getTeamGroups($team['id']),\n ];\n }\n\n return $data;\n }\n\n public function getTeam(string $teamUuid): ?Team\n {\n return $this->teamRepository->idOrUuid($teamUuid);\n }\n\n public function getTeamById(int $teamId): ?Team\n {\n return $this->teamRepository->find($teamId);\n }\n\n public function getGroupsUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportGroups = $report->getGroups();\n foreach ($reportGroups as $groupId) {\n if ($group = $this->groupRepository->find($groupId)) {\n $uuids[] = $group->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getPlaybookCategoriesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $playbookCategories = $report->getPlaybookCategories();\n foreach ($playbookCategories as $id) {\n if ($category = $this->playbookCategoryRepository->find($id)) {\n $uuids[] = $category->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getDealAtCallStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getDealAtCallStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getCurrentDealStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getCurrentDealStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getRecipients());\n }\n\n public function getJiminnyUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function extractUserUuids(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => $user->getUuid())\n ->values()\n ->all();\n }\n\n // get mail data\n public function getRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getRecipients());\n }\n\n /**\n * @return array<UserContract>\n */\n public function getRecipientUserObjects(AutomatedReport $report): array\n {\n $userIds = $report->getRecipients()['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->values()\n ->all();\n }\n\n private function getJiminnyRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function buildRecipientUsers(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => [\n 'email' => $user->getEmailAddress(),\n 'name' => $user->getName(),\n 'timezone' => $user->getTimezone()->getName(),\n ])\n ->values()\n ->all();\n }\n\n public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array\n {\n if ($report->isAskJiminnyReport()) {\n $recipients = $this->resolveAskJiminnyRecipients($report);\n } else {\n $recipients = $this->getRecipientUsers($report);\n if ($includeJiminny) {\n $recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));\n }\n }\n\n $emails = [];\n\n return array_values(array_filter(\n $recipients,\n static function ($recipient) use (&$emails) {\n if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {\n return false;\n }\n $emails[] = $recipient['email'];\n\n return true;\n }\n ));\n }\n\n private function resolveAskJiminnyRecipients(AutomatedReport $report): array\n {\n $recipients = [];\n\n $creator = $report->getCreator();\n if ($creator !== null) {\n $recipients[] = [\n 'email' => $creator->getEmailAddress(),\n 'name' => $creator->getName(),\n 'timezone' => $creator->getTimezone()->getName(),\n ];\n }\n\n return array_merge(\n $recipients,\n $this->buildRecipientUsers($report->getRecipients()),\n $this->getGroupRecipientUsers($report),\n );\n }\n\n private function getGroupRecipientUsers(AutomatedReport $report): array\n {\n $users = [];\n foreach ($report->getGroups() as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group === null) {\n continue;\n }\n foreach ($group->getMembers() as $member) {\n $users[] = [\n 'email' => $member->getEmailAddress(),\n 'name' => $member->getName(),\n 'timezone' => $member->getTimezone()->getName(),\n ];\n }\n }\n\n return $users;\n }\n\n public function getReportTypeName(AutomatedReportResult $report): string\n {\n $type = $report->getReport()->getType();\n\n $getType = $this->transformReportType($type);\n\n return $getType['name'];\n }\n\n public function getReportPeriodName(AutomatedReportResult $report): string\n {\n $from = $report->getFromDate();\n $to = $report->getToDate();\n $frequency = $report->getReport()->getFrequency();\n\n if ($from === null || $to === null) {\n if (! $report->getReport()->isAskJiminnyReport()) {\n $invalidPeriod = $from === null ? 'from' : 'to';\n\n throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);\n }\n\n $period = $this->calculateFromAndToDatePeriod($frequency);\n $from = $period['fromDate'];\n $to = $period['toDate'];\n }\n\n return $this->formatReportPeriodName($frequency, $from, $to);\n }\n\n private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string\n {\n $fromYear = $from->format('Y');\n $toYear = $to->format('Y');\n $differentYears = $fromYear !== $toYear;\n\n switch ($frequency) {\n case self::FREQUENCY_DAILY:\n return $from->format('j M Y');\n\n case self::FREQUENCY_QUARTERLY:\n // 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ\n $startMonth = $from->format('M');\n $endMonth = $to->copy()->subMonth();\n $endMonthName = $endMonth->format('M');\n $endMonthYear = $endMonth->format('Y');\n\n if ($differentYears) {\n return \"{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}\";\n }\n\n return \"{$startMonth} - {$endMonthName} {$toYear}\";\n\n case self::FREQUENCY_MONTHLY:\n // 'May 2025' - monthly reports are always within the same year\n return $from->format('M Y');\n\n case self::FREQUENCY_WEEKLY:\n // '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ\n $startDay = $from->format('j');\n $endDay = $to->format('j');\n $startMonth = $from->format('M');\n $endMonth = $to->format('M');\n\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n if ($startMonth !== $endMonth) {\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n return \"{$startDay} - {$endDay} {$endMonth} {$toYear}\";\n\n case self::FREQUENCY_ONE_OFF:\n // '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ\n $startDay = $from->format('j');\n $startMonth = $from->format('M');\n $endDay = $to->format('j');\n $endMonth = $to->format('M');\n\n // If same month and year, use a format like '2-31 May 2025'\n if ($startMonth === $endMonth && ! $differentYears) {\n return \"{$startDay} - {$endDay} {$startMonth} {$toYear}\";\n }\n\n // If different years, include both years\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n // Same year but different months\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n\n default:\n // Default format for unknown frequencies\n return $from->format('j M Y') . ' - ' . $to->format('j M Y');\n }\n }\n\n public function getReportTeamsName(AutomatedReportResult $report): string\n {\n $groups = $report->getGroups();\n\n if (empty($groups)) {\n return 'All';\n }\n\n // Get group names from repository\n $groupNames = [];\n foreach ($groups as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group) {\n $groupNames[] = $group->getName();\n }\n }\n\n if (count($groupNames) === 1) {\n // Single team format\n $teamsName = $groupNames[0];\n } else {\n // Multiple teams format\n $teamsName = implode(', ', $groupNames);\n }\n\n return $teamsName;\n }\n\n public function getReportFileName(AutomatedReportResult $report): string\n {\n $customName = $report->getReport()->getCustomName();\n $periodName = $this->getReportPeriodName($report);\n $filenameSuffix = $this->getFilenameSuffix($report);\n\n if ($customName) {\n if ($filenameSuffix) {\n $customName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$customName} - {$periodName}\");\n }\n\n $baseName = $this->getReportTypeName($report);\n\n if ($filenameSuffix) {\n $baseName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}\");\n }\n\n public function getReportFileNameWithExtension(AutomatedReportResult $result): string\n {\n $extension = $this->getMediaTypeMetadata($result)['extension'];\n\n return $this->getReportFileName($result) . '.' . $extension;\n }\n\n public function sanitizeFileName(string $fileName): string\n {\n return str_replace(['/', '\\\\'], '-', $fileName);\n }\n\n public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool\n {\n $recipients = array_map('intval', $report->getRecipients()['users'] ?? []);\n\n return in_array($user->getId(), $recipients);\n }\n\n public function transformReportResults(Collection $automatedReportResults): array\n {\n $data = [];\n foreach ($automatedReportResults as $automatedReportResult) {\n /** @var AutomatedReportResult $automatedReportResult */\n\n $report = $automatedReportResult->getReport();\n\n $createdBy = $report->getCreator();\n $creator = [\n 'id' => $createdBy?->getUuid(),\n 'name' => $createdBy?->getName(),\n 'email' => $createdBy?->getEmailAddress(),\n 'photoUrl' => $createdBy?->getPhotoUrl(),\n ];\n\n $recipients = $this->buildRecipients($report);\n\n $data[] = [\n 'id' => $automatedReportResult->getUuid(),\n 'name' => $automatedReportResult->getName(),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n 'recipients' => $recipients,\n 'recipients' => [\n ...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),\n ...array_values($this->transformRecipients($report->getRecipients())),\n ],\n 'report_type' => $this->transformReportType($report->getType()),\n 'media_type' => $automatedReportResult->getMediaType(),\n 'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),\n 'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),\n 'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),\n 'creator' => $creator,\n ];\n \n \n }\n\n return $data;\n }\n\n private function buildRecipients(AutomatedReport $report)\n {\n \n }\n\n public function hasCallTypeConference(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);\n }\n\n public function hasCallTypeDialer(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);\n }\n\n // transformers\n private function transformTeam(Team $team): array\n {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n return [];\n }\n\n return [\n 'id' => $team->getUuid(),\n 'name' => $team->getName(),\n ];\n }\n\n private function transformReportFullView(AutomatedReport $report): array\n {\n $base = $this->transformReportBase($report);\n\n return $report->getType() === self::TYPE_ASK_JIMINNY\n ? $base + $this->transformAskJiminnyFields($report)\n : $base + $this->transformStandardReportFields($report);\n }\n\n private function transformReportBase(AutomatedReport $report): array\n {\n return [\n 'id' => $report->getUuid(),\n 'organization' => $this->transformOrganization(team: $report->getTeam()),\n 'report_type' => $this->transformReportType($report->getType()),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n ];\n }\n\n private function transformStandardReportFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n\n return [\n 'report_enabled' => $report->getStatus(),\n 'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),\n 'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),\n 'deal_value_min' => $report->getDealValueMin(),\n 'deal_value_max' => $report->getDealValueMax(),\n 'call_types' => $this->transformCallType($report->getCallTypes()),\n 'media_types' => $this->transformMediaTypes($report),\n 'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),\n 'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),\n 'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),\n 'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),\n 'recipients' => $this->transformRecipients($report->getRecipients()),\n 'created_by' => $this->transformCreator($report->getCreator()),\n 'additional_prompt_input' => $report->getAdditionalPromptInput(),\n 'custom_name' => $report->getCustomName(),\n 'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),\n 'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),\n 'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),\n ];\n }\n\n private function transformAskJiminnyFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n $creatorId = $report->getAttribute('created_by');\n $explicitUserIds = array_values(array_filter(\n $report->getRecipients()['users'] ?? [],\n static fn ($id) => $id !== $creatorId\n ));\n\n return [\n 'report_name' => $report->getCustomName(),\n 'enabled' => $report->getStatus(),\n 'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),\n 'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),\n 'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),\n 'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),\n ];\n }\n\n private function transformOrganization(?Team $team): array\n {\n return [\n 'id' => $team?->getUuid(),\n 'name' => $team?->getName(),\n ];\n }\n\n private function transformReportType(string $type): array\n {\n foreach (self::ALL_TYPES as $typeItem) {\n if ($typeItem['id'] === $type) {\n return $typeItem;\n }\n }\n\n return [];\n }\n\n private function transformCallType(array $types): array\n {\n $result = [];\n $callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];\n\n foreach ($types as $type) {\n foreach ($callTypes as $callTypeItem) {\n if ($callTypeItem['id'] === $type) {\n $result[] = $callTypeItem;\n\n break;\n }\n }\n }\n\n return $result;\n }\n\n private function transformMediaTypes(AutomatedReport $report): array\n {\n $values = [];\n\n foreach ($report->getMediaTypes() as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n continue;\n }\n\n $values[] = match ($mediaType) {\n self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,\n self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,\n };\n }\n\n return $values;\n }\n\n private function transformFrequency(string $frequency): array\n {\n foreach (self::ALL_FREQUENCIES as $frequencyItem) {\n if ($frequencyItem['id'] === $frequency) {\n return $frequencyItem;\n }\n }\n\n return [];\n }\n\n public function transformDurationToMinutes(?int $duration): ?int\n {\n if (! $duration) {\n return null;\n }\n\n return (int) ($duration / 60);\n }\n\n private function transformGroups(?Team $team, array $groupsIds): array\n {\n if (empty($groupsIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($groupsIds as $groupId) {\n $group = $team->groups()->where('id', $groupId)->first();\n\n if ($group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n 'photoUrl' => $group->getPhotoUrl(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformStages(?Team $team, array $stagesIds): array\n {\n if (empty($stagesIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($stagesIds as $stageId) {\n $stage = $team->stages()->where('id', $stageId)->first();\n\n if ($stage) {\n $data[] = [\n 'id' => $stage->getUuid(),\n 'name' => $stage->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformRecipients(array $recipients): array\n {\n $users = [];\n foreach ($recipients['users'] ?? [] as $userId) {\n $users[] = $this->transformUser($userId);\n }\n\n return $users;\n }\n\n private function transformCreator(?User $user): ?array\n {\n if ($user === null) {\n return null;\n }\n\n return $this->transformUser($user->getId());\n }\n\n private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array\n {\n if ($prompt === null) {\n return null;\n }\n\n return [\n 'id' => $prompt->getUuid(),\n 'name' => $prompt->getTitle(),\n ];\n }\n\n private function transformSafeSearch(?Search $search): ?array\n {\n if ($search === null) {\n return null;\n }\n\n return [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ];\n }\n\n private function transformUser(int $userId): array\n {\n /* @var ?User $user */\n $user = $this->userRepository->find($userId);\n\n return [\n 'id' => $user?->getUuid(),\n 'name' => $user?->getName(),\n 'email' => $user?->getEmailAddress(),\n 'photoUrl' => $user?->getPhotoUrl(),\n ];\n }\n\n public function create(array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $validatedData['created_by'] = auth()->id();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function update(string $uuid, array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $report = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $report) {\n throw new InvalidArgumentException('Report not found');\n }\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Create an Ask Jiminny report.\n */\n public function createAskJiminnyReport(array $data, User $creator): array\n {\n $validatedData = $this->validateAskJiminnyReportData($data, $creator);\n $validatedData['created_by'] = $creator->getId();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Update an Ask Jiminny report.\n */\n public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array\n {\n if (! $report->isAskJiminnyReport()) {\n throw new InvalidArgumentException('Report is not an Ask Jiminny report');\n }\n\n $validatedData = $this->validateAskJiminnyReportData($data, $user);\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array\n {\n $this->automatedReportsRepository->update($report, ['status' => $status]);\n\n return $this->transformReportFullView($report->fresh());\n }\n\n /**\n * Validate and transform data for Ask Jiminny reports.\n */\n private function validateAskJiminnyReportData(array $data, User $user): array\n {\n // Validate name\n $name = trim($data['report_name'] ?? '');\n if (empty($name)) {\n throw new InvalidArgumentException('Report name is required');\n }\n if (mb_strlen($name) > 50) {\n throw new InvalidArgumentException('Report name must be 50 characters or less');\n }\n\n // Validate frequency (only daily, weekly, monthly for Ask Jiminny)\n $frequency = $data['frequency'] ?? null;\n $askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];\n if (! in_array($frequency, $askJiminnyFrequencies, true)) {\n throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');\n }\n\n // Validate expiration date\n $expiresAt = $data['expires_on'] ?? null;\n if (empty($expiresAt)) {\n throw new InvalidArgumentException('Expiration date is required');\n }\n\n try {\n $expiresAtDate = Carbon::parse($expiresAt);\n } catch (InvalidFormatException $e) {\n throw new InvalidArgumentException('Expiration date format is invalid');\n }\n $maxExpiration = Carbon::now()->addYear()->endOfDay();\n if ($expiresAtDate->gt($maxExpiration)) {\n throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');\n }\n if ($expiresAtDate->isPast()) {\n throw new InvalidArgumentException('Expiration date cannot be in the past');\n }\n\n // Validate saved search\n $activitySearchId = $data['saved_search'] ?? null;\n if (empty($activitySearchId)) {\n throw new InvalidArgumentException('Saved search is required');\n }\n $savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);\n if (! $savedSearch) {\n throw new InvalidArgumentException('Saved search not found or does not belong to you');\n }\n\n // Validate saved prompt\n $askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;\n if (empty($askAnythingPromptId)) {\n throw new InvalidArgumentException('Ask Jiminny prompt is required');\n }\n $prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);\n if (! $prompt) {\n throw new InvalidArgumentException('Ask Jiminny prompt not found');\n }\n\n // Validate status\n $status = $data['enabled'] ?? false;\n\n $recipientUserIds = [$user->getId()];\n\n if (! empty($data['share_users'])) {\n $sharedUserIds = $this->validateAndGetUserIdsByTeam(\n $user->team,\n (array) $data['share_users']\n );\n $recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);\n }\n\n $sharedGroupIds = [];\n if (! empty($data['share_teams'])) {\n $sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);\n }\n\n $recipientUserIds = array_values(array_unique($recipientUserIds));\n\n return [\n 'team_id' => $user->getTeamId(),\n 'type' => self::TYPE_ASK_JIMINNY,\n 'status' => (bool) $status,\n 'frequency' => $frequency,\n 'custom_name' => $name,\n 'activity_search_id' => $savedSearch->getId(),\n 'ask_anything_prompt_id' => $prompt->getId(),\n 'expires_at' => $expiresAtDate->toDateString(),\n 'media_types' => [self::MEDIA_TYPE_PDF],\n 'call_types' => [],\n 'recipients' => ['users' => $recipientUserIds],\n 'groups' => $sharedGroupIds,\n ];\n }\n\n public static function getAskJiminnyFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::ASK_JIMINNY_FREQUENCIES);\n }\n\n public function getAskJiminnyReportFilters(User $user): array\n {\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n return [\n [\n 'id' => 'prompt',\n 'label' => 'Prompt',\n 'options' => $prompts,\n ],\n [\n 'id' => 'saved_search',\n 'label' => 'Saved Search',\n 'options' => $savedSearches,\n ],\n ];\n }\n\n public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array\n {\n $team = $user->getTeam();\n $userTimezone = $user->getTimezone();\n\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n $teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ])->values()->all();\n\n $shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];\n\n $sharedTeamsValue = [];\n $sharedUsersValue = [];\n if ($report) {\n $sharedTeamsValue = $this->transformGroups($team, $report->getGroups());\n\n $recipientUserIds = $report->getRecipients()['users'] ?? [];\n $creatorId = $report->getAttribute('created_by');\n $sharedUserIds = array_values(array_filter(\n $recipientUserIds,\n static fn ($id) => $id !== $creatorId\n ));\n $sharedUsersValue = collect($sharedUserIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (User $u) => [\n 'id' => $u->getUuid(),\n 'name' => $u->getName(),\n ])\n ->values()\n ->all();\n }\n\n return [\n 'fields' => [\n [\n 'id' => 'enabled',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'label' => '',\n 'value' => $report?->getStatus() ?? false,\n ],\n [\n 'id' => 'report_name',\n 'inputType' => InputTypeEnum::TEXT,\n 'label' => 'Name',\n 'placeholder' => 'Enter name',\n 'required' => true,\n 'validation' => ['maxLength' => 50],\n 'value' => $report?->getCustomName() ?? '',\n ],\n [\n 'id' => 'frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Frequency',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::ASK_JIMINNY_FREQUENCIES,\n 'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,\n ],\n [\n 'id' => 'expires_on',\n 'inputType' => InputTypeEnum::DATE,\n 'label' => 'Expires on',\n 'required' => true,\n 'placeholder' => 'Select',\n 'validation' => [\n 'minDate' => now($userTimezone)->toDateString(),\n 'maxDate' => now($userTimezone)->addYear()->toDateString(),\n ],\n 'value' => $report?->getExpiresAt()?->toDateString(),\n ],\n [\n 'id' => 'share_teams',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team',\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $teamGroups,\n 'value' => $sharedTeamsValue,\n ],\n [\n 'id' => 'share_users',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team member',\n 'required' => false,\n 'placeholder' => 'Select',\n 'groupLabelKey' => 'label',\n 'groupValuesKey' => 'users',\n 'optionLabelKey' => 'name',\n 'optionValueKey' => 'id',\n 'options' => $shareUsers,\n 'value' => $sharedUsersValue,\n ],\n [\n 'id' => 'saved_search',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Saved search',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $savedSearches,\n 'value' => $report && $report->getSavedSearch() ? [\n 'id' => $report->getSavedSearch()->getUuid(),\n 'name' => $report->getSavedSearch()->getName(),\n ] : null,\n ],\n [\n 'id' => 'ask_jiminny_prompt',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Ask Jiminny prompt',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $prompts,\n 'value' => $report && $report->getAskAnythingPrompt() ? [\n 'id' => $report->getAskAnythingPrompt()->getUuid(),\n 'name' => $report->getAskAnythingPrompt()->getTitle(),\n ] : null,\n ],\n ],\n ];\n }\n\n private function updateResultNames(AutomatedReport $automatedReport): void\n {\n $results = $this->automatedReportsRepository->getResultsByReport($automatedReport);\n\n foreach ($results as $result) {\n $result->update(['name' => $this->getReportFileName($result)]);\n }\n }\n\n public function updateStatus(string $uuid, array $data): array\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $automatedReport->update([\n 'status' => $status,\n ]);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n private function generateOneOffReport(AutomatedReport $automatedReport): void\n {\n // the scheduler handles all the other frequency types\n if ($automatedReport->getStatus() === false || $automatedReport->getFrequency() !== self::FREQUENCY_ONE_OFF) {\n return;\n }\n\n $this->dispatcher->dispatch(new RequestGenerateReportJob($automatedReport->getUuid()));\n }\n\n public function getReport(string $uuid): AutomatedReport\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n return $automatedReport;\n }\n\n public function get(string $uuid): array\n {\n $automatedReport = $this->getReport($uuid);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function list(string $sortColumn = 'created_at', string $sortDirection = 'desc'): array\n {\n $results = [];\n $collection = $this->automatedReportsRepository->getAllStandardReports($sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function listAskJiminnyReports(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): array {\n $results = [];\n $collection = $this->automatedReportsRepository->getAskJiminnyReportsByUser($user, $sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function delete(string $uuid): void\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $automatedReport->delete();\n }\n\n public function createReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n return $this->automatedReportsRepository->createResult(\n array_merge(\n [\n 'report_id' => $automatedReport->getId(),\n 'status' => AutomatedReportResult::STATUS_DEFAULT,\n ],\n $data\n )\n );\n }\n\n public function getOrCreateReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n $existing = $this->automatedReportsRepository->findLatestDefaultOrFailedResult($automatedReport);\n\n if ($existing !== null) {\n $existing->update(['status' => AutomatedReportResult::STATUS_DEFAULT]);\n\n return $existing;\n }\n\n return $this->createReportResult($automatedReport, $data);\n }\n\n public function getReportResult(string $resultUuid): AutomatedReportResult\n {\n $report = $this->automatedReportsRepository->findResultByUuid($resultUuid);\n\n if (! $report) {\n throw new ModelNotFoundException('Report Result not found');\n }\n\n return $report;\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return $this->automatedReportsRepository->findChildResult($result, $type);\n }\n\n // prophet API calls\n /**\n * @throws ApplicationException\n */\n public function getGenerateReportPayload(AutomatedReport $automatedReport, string $reportResultUuid): array\n {\n $period = $this->calculateFromAndToDate($automatedReport);\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n return [\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResultUuid,\n 'report_type' => $automatedReport->getType(),\n 'media_types' => $automatedReport->getMediaTypes(),\n 'from_date' => $fromDate->startOfDay()->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->endOfDay()->format(DateTimeInterface::RFC3339),\n 'group_ids' => $automatedReport->getGroups(),\n 'call_deal_stage' => $automatedReport->getDealAtCallStages(),\n 'current_deal_stage' => $automatedReport->getCurrentDealStages(),\n 'deal_min_value' => $automatedReport->getDealValueMin(),\n 'deal_max_value' => $automatedReport->getDealValueMax(),\n 'call_types' => $automatedReport->getCallTypes(),\n 'call_duration_min_seconds' => $automatedReport->getCallDurationMin(),\n 'call_duration_max_seconds' => $automatedReport->getCallDurationMax(),\n 'special_requirements' => $automatedReport->getAdditionalPromptInput(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->formatReportPeriodName(\n $automatedReport->getFrequency(),\n $fromDate,\n $toDate,\n ),\n 'playbook_categories' => $automatedReport->getPlaybookCategories(),\n 'custom_name' => $automatedReport->getCustomName(),\n ];\n }\n\n // $inputPayload - FE payload structure\n public function getActivitiesCountPayload(array $inputPayload): array\n {\n // Use validateAndTransformData to validate and normalize input\n $validatedData = $this->validateAndTransformData($inputPayload);\n $period = $this->calculateFromAndToDatePeriod(\n $validatedData['frequency'],\n Carbon::parse($validatedData['from']),\n Carbon::parse($validatedData['to']),\n );\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n // Create payload similar to getGenerateReportPayload\n return [\n 'team_id' => $validatedData['team_id'],\n 'group_ids' => $validatedData['groups'] ?? [],\n 'report_type' => $validatedData['type'],\n 'from_date' => $fromDate->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->format(DateTimeInterface::RFC3339),\n 'call_deal_stage' => $validatedData['deal_at_call_stages'] ?? [],\n 'current_deal_stage' => $validatedData['current_deal_stages'] ?? [],\n 'deal_min_value' => $validatedData['deal_value_min'] ?? null,\n 'deal_max_value' => $validatedData['deal_value_max'] ?? null,\n 'call_types' => $validatedData['call_types'],\n 'call_duration_min_seconds' => $validatedData['call_duration_min'] ?? null,\n 'call_duration_max_seconds' => $validatedData['call_duration_max'] ?? null,\n 'special_requirements' => $validatedData['additional_prompt_input'] ?? null,\n 'playbook_categories' => $validatedData['playbook_categories'] ?? [],\n 'request_id' => null,\n 'callback_url' => null,\n ];\n }\n\n public function shouldSendReport(array $users, ?CarbonInterface $generatedAt = null): bool\n {\n if (empty($users)) {\n return false;\n }\n\n $earliestTz = collect($users)\n ->mapWithKeys(function (array $user) {\n $tz = new DateTimeZone($user['timezone']);\n $nowUtc = new DateTime('now', new DateTimeZone('UTC'));\n $offset = $tz->getOffset($nowUtc);\n\n return [$user['timezone'] => $offset];\n })\n ->sortDesc()\n ->keys()\n ->first();\n\n $now = Carbon::now($earliestTz);\n $isScheduledTime = (int) $now->format('H') === self::SENT_REPORT_AT_HOURS;\n\n if ($isScheduledTime) {\n return true;\n }\n\n return $this->hasPassedScheduledTime($generatedAt, $earliestTz);\n }\n\n public function hasPassedScheduledTime(?CarbonInterface $generatedAt, string $timezone): bool\n {\n if ($generatedAt === null) {\n return false;\n }\n\n $now = Carbon::now($timezone);\n $scheduledTime = $now->copy()->setTime(self::SENT_REPORT_AT_HOURS, 0, 0);\n\n if ($now->hour < self::SENT_REPORT_AT_HOURS) {\n $scheduledTime = $scheduledTime->subDay();\n }\n\n $scheduledTimeUtc = $scheduledTime->copy()->utc();\n $generatedAtUtc = $generatedAt->copy()->utc();\n $nowUtc = $now->copy()->utc();\n\n return $generatedAtUtc->lt($scheduledTimeUtc) && $nowUtc->gt($scheduledTimeUtc);\n }\n\n public function calculateFromAndToDatePeriod(\n string $frequency,\n ?Carbon $fromDate = null,\n ?Carbon $toDate = null\n ): array {\n if ($frequency === self::FREQUENCY_ONE_OFF) {\n return [\n 'fromDate' => $fromDate,\n 'toDate' => $toDate,\n ];\n }\n\n $now = Carbon::now();\n\n return match ($frequency) {\n self::FREQUENCY_DAILY => [\n 'fromDate' => $now->copy()->subDay()->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_WEEKLY => [\n 'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_MONTHLY => [\n 'fromDate' => $now->copy()->subMonths(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_QUARTERLY => [\n 'fromDate' => $now->copy()->subMonths(3)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n default => throw new InvalidArgumentException(\"Unsupported frequency: {$frequency}\"),\n };\n }\n\n private function calculateFromAndToDate(AutomatedReport $automatedReport): array\n {\n return $this->calculateFromAndToDatePeriod(\n $automatedReport->getFrequency(),\n $automatedReport->getFrom(),\n $automatedReport->getTo()\n );\n }\n\n public function getAskJiminnyGenerateReportPayload(\n AutomatedReport $automatedReport,\n AutomatedReportResult $reportResult,\n array $activityIds,\n ): array {\n return [\n 'user_question' => $automatedReport->getAskAnythingPrompt()?->getContent(),\n 'call_ids' => array_map('strval', $activityIds),\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResult->getUuid(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->getReportPeriodName($reportResult),\n 'report_name' => $automatedReport->getCustomName(),\n ];\n }\n\n private function getCallbackUrl(): string\n {\n return $this->webhookService->route('jiminny.webhook.reports.ready');\n }\n\n /**\n * Validate and transform payload data for automated reports\n *\n * @param array $data\n *\n * @throws InvalidArgumentException\n *\n * @return array\n */\n private function validateAndTransformData(array $data): array\n {\n // Validate organization (team) and check feature\n $team = $this->validateOrganization($data['organization'] ?? null);\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $type = $this->validateReportType($data['report_type'] ?? null);\n $frequency = $this->validateFrequency($data['frequency'] ?? null);\n $additionalPromptInput = $this->validateAdditionalPromptInput(\n $data['additional_prompt_input'] ?? null\n );\n $customReportName = $this->validateCustomReportName($data['custom_name'] ?? null);\n\n // Prepare data for the database\n $reportData = [\n 'team_id' => $team->getId(),\n 'type' => $type,\n 'status' => $status,\n 'frequency' => $frequency,\n 'additional_prompt_input' => $additionalPromptInput,\n 'custom_name' => $customReportName,\n ];\n\n // Validate deal values\n $reportData = $this->validateDealValues($data, $reportData);\n\n // Validate date range\n $reportData = $this->validateDateRange($data, $reportData, $frequency);\n\n // Validate call durations\n $reportData = $this->validateCallDurations($data, $reportData);\n\n // Validate call types\n $reportData = $this->validateCallTypes($data, $reportData);\n\n // Validate media types\n $reportData = $this->validateMediaTypes($data, $reportData);\n\n // Validate groups\n if (isset($data['teams'])) {\n $reportData['groups'] = $this->validateAndGetGroupIds($team, $data['teams']);\n }\n\n // Validate deal stages\n $reportData = $this->validateDealStages($data, $reportData, $team, $type);\n\n // Validate playbook categories\n $reportData = $this->validatePlaybookCategories($data, $reportData, $team);\n\n // Validate recipients\n $reportData['recipients'] = [\n 'users' => $this->validateAndGetUserIdsByTeam($team, $data['recipients'] ?? []),\n ];\n\n if (isset($data['jiminny_recipients'])) {\n // Validate Jiminny recipients\n $reportData['jiminny_recipients'] = [\n 'users' => $this->validateAndGetJiminnyUserIds((array) $data['jiminny_recipients']),\n ];\n }\n\n return $reportData;\n }\n\n private function validateDealValues(array $data, array $reportData): array\n {\n if (isset($data['min_deal_value'])) {\n $reportData['deal_value_min'] = (int) $data['min_deal_value'];\n\n if ($reportData['deal_value_min'] > 4294967295 || $reportData['deal_value_min'] < 0) {\n throw new InvalidArgumentException('Min deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_deal_value'])) {\n $reportData['deal_value_max'] = (int) $data['max_deal_value'];\n\n if ($reportData['deal_value_max'] > 4294967295 || $reportData['deal_value_max'] < 0) {\n throw new InvalidArgumentException('Max deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['min_deal_value'], $data['max_deal_value'])\n && $data['min_deal_value'] > $data['max_deal_value']\n ) {\n throw new InvalidArgumentException('Min deal value cannot be greater than max deal value');\n }\n\n return $reportData;\n }\n\n private function validateDateRange(array $data, array $reportData, string $frequency): array\n {\n // Set date range only for one_off frequency\n if ($frequency === 'one_off') {\n if (isset($data['start_date_period'])) {\n $reportData['from'] = $this->parseDate($data['start_date_period']);\n }\n\n if (isset($data['end_date_period'])) {\n $reportData['to'] = $this->parseDate($data['end_date_period']);\n }\n\n if (empty($reportData['from']) || empty($reportData['to'])) {\n throw new InvalidArgumentException(\n 'Start date and end date are required for one_off frequency'\n );\n }\n } else {\n $reportData['from'] = null;\n $reportData['to'] = null;\n }\n\n return $reportData;\n }\n\n private function validateCallDurations(array $data, array $reportData): array\n {\n // Convert call durations from minutes to seconds\n if (isset($data['min_call_duration'])) {\n $reportData['call_duration_min'] = (int) $data['min_call_duration'] * 60;\n\n if ($reportData['call_duration_min'] > 4294967295 || $reportData['call_duration_min'] < 0) {\n throw new InvalidArgumentException('Min call duration should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_call_duration'])) {\n $reportData['call_duration_max'] = (int) $data['max_call_duration'] * 60;\n\n if ($reportData['call_duration_max'] > 4294967295 || $reportData['call_duration_max'] < 0) {\n throw new InvalidArgumentException('Max call duration should be between 0 and 4294967295');\n }\n }\n\n return $reportData;\n }\n\n private function validateCallTypes(array $data, array $reportData): array\n {\n // Set call types\n $reportData['call_types'] = $data['call_type'] ?? [];\n if (empty($reportData['call_types'])) {\n $reportData['call_types'] = self::getCallTypes();\n }\n\n foreach ($reportData['call_types'] as $callType) {\n if (! in_array($callType, self::getCallTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Call type %s is invalid', $callType));\n }\n }\n\n return $reportData;\n }\n\n private function validateMediaTypes(array $data, array $reportData): array\n {\n // Set media types from input data\n $reportData['media_types'] = $data['media_types'] ?? [];\n\n if (empty($reportData['media_types'])) {\n throw new InvalidArgumentException('Media types are required');\n }\n\n foreach ($reportData['media_types'] as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n throw new InvalidArgumentException(sprintf('Media type %s is invalid', $mediaType));\n }\n }\n\n return $reportData;\n }\n\n private function validateDealStages(array $data, array $reportData, Team $team, string $reportType): array\n {\n // Validate and set deal stages\n if (isset($data['deal_stage_at_call'])) {\n $reportData['deal_at_call_stages'] =\n $this->validateAndGetDealStageIds($team, $data['deal_stage_at_call'], 'Deal stage at call');\n }\n\n if (isset($data['current_deal_stage'])) {\n $reportData['current_deal_stages'] =\n $this->validateAndGetDealStageIds($team, $data['current_deal_stage'], 'Current deal stage');\n }\n\n // Ensure current_deal_stage is not provided for loss_analysis report type\n if ($reportType === self::TYPE_LOSS_ANALYSIS && ! empty($data['current_deal_stage'])) {\n throw new InvalidArgumentException('Current deal stage is not applicable for Loss Analysis reports');\n }\n\n return $reportData;\n }\n\n // transform uuid to id\n private function validatePlaybookCategories(array $data, array $reportData, Team $team): array\n {\n $key = 'playbook_categories';\n\n if (isset($data[$key])) {\n $payloadIds = $data[$key];\n $ids = [];\n\n foreach ($payloadIds as $uuid) {\n $uuid = (string) $uuid;\n\n try {\n $playbookCategory = $this->playbookCategoryRepository->findByUuid($uuid);\n } catch (Throwable $throwable) {\n Log::error(__METHOD__ . ' ' . $throwable->getMessage());\n\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory) {\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory->hasPlaybook()) {\n throw new InvalidArgumentException(sprintf('Playbook category %s has no playbook', $uuid));\n }\n\n if ($playbookCategory->getPlaybook()->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Playbook category %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $ids[] = $playbookCategory->getId();\n }\n\n $reportData[$key] = $ids;\n }\n\n return $reportData;\n }\n\n private function validateReportStatus($status): bool\n {\n if (! in_array($status, [true, false], true)) {\n throw new InvalidArgumentException('Report status is invalid');\n }\n\n return $status;\n }\n\n private function validateReportType($type): string\n {\n if (! in_array($type, self::getTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Report type is invalid: %s', $type));\n }\n\n return $type;\n }\n\n private function validateFrequency($frequency): string\n {\n if (! in_array($frequency, self::getFrequencies(), true)) {\n throw new InvalidArgumentException('Frequency is invalid');\n }\n\n return $frequency;\n }\n\n private function validateAdditionalPromptInput(?string $additionalPromptInput): ?string\n {\n if ($additionalPromptInput && strlen($additionalPromptInput) > 5000) {\n throw new InvalidArgumentException('Additional Prompt Input should be less than 5000 characters');\n }\n\n return $additionalPromptInput;\n }\n\n private function validateCustomReportName(?string $customReportName): ?string\n {\n if ($customReportName === null || $customReportName === '') {\n return null;\n }\n\n if (strlen($customReportName) > 70) {\n throw new InvalidArgumentException('Custom report name should be less than 70 characters');\n }\n\n return $customReportName;\n }\n\n private function validateOrganization(?string $organizationUuid): Team\n {\n if (! $organizationUuid) {\n throw new InvalidArgumentException('Organization is required');\n }\n\n $team = $this->teamRepository->idOrUuid($organizationUuid);\n\n if (! $team) {\n throw new InvalidArgumentException('Organization not found');\n }\n\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n throw new InvalidArgumentException('Organization does not have the Automated Reports feature');\n }\n\n return $team;\n }\n\n private function validateAndGetGroupIds(Team $team, array $teamUuids): array\n {\n $groupIds = [];\n\n foreach ($teamUuids as $uuid) {\n $group = $this->groupRepository->findByUuid($uuid);\n\n if ($group === null || $group->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Group %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $groupIds[] = $group->getId();\n\n }\n\n return $groupIds;\n }\n\n private function validateAndGetDealStageIds(Team $team, array $stageUuids, string $propertyLabel): array\n {\n $stageIds = [];\n\n foreach ($stageUuids as $uuid) {\n $stage = $this->stageRepository->findByUuid($uuid);\n\n if ($stage === null || $stage->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Stage %s not found for team %s for %s', $uuid, $team->getUuid(), $propertyLabel)\n );\n }\n\n $stageIds[] = $stage->getId();\n }\n\n return $stageIds;\n }\n\n private function validateAndGetUserIds(array $userUuids, callable $teamCheck): array\n {\n if (empty($userUuids)) {\n return [];\n }\n\n $userIds = [];\n\n foreach ($userUuids as $uuid) {\n $user = $this->userRepository->findByUuid($uuid);\n\n if (! $user || ! $user->isStatusActive()) {\n throw new InvalidArgumentException(\n sprintf('User %s not found or is not active', $uuid)\n );\n }\n\n if (! $teamCheck($user)) {\n throw new InvalidArgumentException(\n sprintf('User %s does not belong to the allowed team(s)', $uuid)\n );\n }\n\n $userIds[] = $user->getId();\n }\n\n return $userIds;\n }\n\n private function validateAndGetUserIdsByTeam(Team $team, array $userUuids): array\n {\n return $this->validateAndGetUserIds($userUuids, fn ($user) => $user->getTeamId() === $team->getId());\n }\n\n private function validateAndGetJiminnyUserIds(array $userUuids): array\n {\n $allowedTeamIds = config('kiosk.teamIds', []);\n\n return $this->validateAndGetUserIds($userUuids, fn ($user) => in_array($user->getTeamId(), $allowedTeamIds, true));\n }\n\n private function parseDate(string $dateString): string\n {\n return date('Y-m-d H:i:s', strtotime($dateString));\n }\n\n private function generateReportResultViewUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.view', ['uuid' => $result->getUuid()]);\n }\n\n private function generateReportResultDownloadUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.download', ['uuid' => $result->getUuid()]);\n }\n\n private function getReportMediaRouteResource(AutomatedReportResult $result): string\n {\n if ($result->getMediaType() === self::MEDIA_TYPE_PDF) {\n return self::PDF_KEY;\n } elseif ($result->getMediaType() === self::MEDIA_TYPE_PODCAST) {\n return self::AUDIO_KEY;\n }\n\n throw new \\InvalidArgumentException('Unknown media type.');\n }\n\n public function getMediaPath(AutomatedReportResult $result): ?string\n {\n $url = match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => $result->getPdfUrl(),\n self::MEDIA_TYPE_PODCAST => $result->getPodcastAudioUrl(),\n default => null,\n };\n\n if ($url === null) {\n return null;\n }\n\n $path = parse_url(trim($url, '\"\\''), PHP_URL_PATH);\n\n return $path ?: null;\n }\n\n public function getFilenameSuffix(AutomatedReportResult $result): ?string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => 'Podcast',\n default => null,\n };\n }\n\n public function getMailSubjectSuffix(AutomatedReportResult $result): string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => 'report',\n self::MEDIA_TYPE_PODCAST => 'podcast',\n default => '',\n };\n }\n\n public function getMediaTypeMetadata(AutomatedReportResult $result): array\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => ['extension' => 'mp3', 'mime' => 'audio/mpeg'],\n self::MEDIA_TYPE_PDF => ['extension' => 'pdf', 'mime' => 'application/pdf'],\n default => ['extension' => null, 'mime' => null],\n };\n }\n\n public function deleteS3Files(AutomatedReportResult $result): void\n {\n $teamUuid = $result->getReport()->getTeam()->getUuid();\n $reportUuid = $result->getUuid();\n\n // delete all files for a report uuid no mather of pdf, podcast, or both\n // in case of both - the podcast files are linked to the pdf (parent) uuid\n // pdf and podcast date times should be close\n $path = sprintf('%s/%s/%s', $teamUuid, self::S3_DIR, $reportUuid);\n\n foreach (self::FILE_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted S3 file', [\n 'path' => $file,\n ]);\n }\n }\n\n foreach (self::FILE_PODCAST_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '_podcast.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted Podcast S3 file', [\n 'path' => $file,\n ]);\n }\n }\n }\n\n /**\n *\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): Collection\n {\n return $this->automatedReportsRepository->getTeamIdsWithReportsResults($teamId);\n }\n\n /**\n * Core delete logic for report results using a query\n *\n * @param Builder $query\n * @param array $logContext\n *\n * @return int\n */\n private function deleteReportResultsByQuery(Builder $query, array $logContext = []): int\n {\n $deletedCount = 0;\n\n if ($query->exists()) {\n Log::info(\n 'Run delete report results',\n array_merge(\n $logContext,\n [\n 'service' => 'AutomatedReportsService',\n ]\n )\n );\n\n $query->chunkById(50, function ($results) use (&$deletedCount, $logContext) {\n foreach ($results as $result) {\n $this->deleteReportResult($result);\n $deletedCount++;\n\n Log::info(\n 'Deleted a report result',\n array_merge(\n $logContext,\n [\n 'result_id' => $result->getId(),\n 'report_id' => $result->getReportId(),\n ]\n )\n );\n }\n });\n }\n\n return $deletedCount;\n }\n\n /**\n * Delete report results for a team by retention period\n *\n * @param Team $team\n * @param CarbonImmutable $retentionDate\n *\n * @return int Number of deleted report results\n */\n public function deleteReportsResultsInRetentionPeriod(Team $team, CarbonImmutable $retentionDate): int\n {\n $reportIds = $this->automatedReportsRepository->getReportIdsByTeam($team);\n\n if ($reportIds->isEmpty()) {\n return 0;\n }\n\n $query = $this->automatedReportsRepository\n ->getReportResultsQueryForRetention($team, $retentionDate);\n\n return $this->deleteReportResultsByQuery($query, [\n 'team_id' => $team->getId(),\n 'retention_date' => $retentionDate->toDateTimeString(),\n ]);\n }\n\n /**\n * Delete ALL report results for a specific automated report\n *\n * @param string $uuid\n *\n * @return int\n */\n public function deleteReportResults(string $uuid): int\n {\n $report = $this->getReport($uuid);\n\n $query = $this->automatedReportsRepository->getResultsByReportQuery($report);\n\n return $this->deleteReportResultsByQuery($query, [\n 'report_uuid' => $uuid,\n 'report_id' => $report->getId(),\n ]);\n }\n\n public function deleteReportResult(AutomatedReportResult $result): void\n {\n $this->deleteS3Files($result);\n\n $result->delete();\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getTeamReports(Team $team): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getReportsByTeam($team);\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getReportResults(AutomatedReport $report): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getResultsByReport($report);\n }\n\n public function deleteAllReportResults(AutomatedReport $report): void\n {\n $results = $this->getReportResults($report);\n\n /** @var AutomatedReportResult $result */\n foreach ($results as $result) {\n Log::info('Deleting result', [\n 'report' => $report->getId(),\n 'result' => $result->getId(),\n ]);\n\n $this->deleteReportResult($result);\n }\n }\n\n public function deleteAllData(Team $team): void\n {\n Log::info('Deleting automated report and results for team', [\n 'team' => $team->getId(),\n ]);\n\n $reports = $this->getTeamReports($team);\n\n /** @var AutomatedReport $report */\n foreach ($reports as $report) {\n Log::info('Deleting report', [\n 'team' => $team->getId(),\n 'report' => $report->getId(),\n ]);\n\n $this->deleteAllReportResults($report);\n\n $report->delete();\n }\n }\n}","depth":4,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Kiosk\\AutomatedReports;\n\nuse Carbon\\CarbonImmutable;\nuse Carbon\\CarbonInterface;\nuse Carbon\\Exceptions\\InvalidFormatException;\nuse DateTime;\nuse DateTimeInterface;\nuse DateTimeZone;\nuse Illuminate\\Contracts\\Bus\\Dispatcher as BusDispatcher;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Support\\Facades\\Log;\nuse Illuminate\\Support\\Facades\\Storage;\nuse Jiminny\\Component\\ActivitySearch\\FilterDefinition\\InputTypeEnum;\nuse Jiminny\\Component\\AskAnything\\AskAnythingPromptService;\nuse Jiminny\\Component\\AskAnything\\Dtos\\AskAnythingPromptDto;\nuse Jiminny\\Component\\UrlGenerator\\Webhook;\nuse Jiminny\\Contracts\\Repositories\\PlaybookCategoryRepository;\nuse Jiminny\\Contracts\\Repositories\\TeamRepository;\nuse Jiminny\\Contracts\\Repositories\\UserRepository;\nuse Jiminny\\Exceptions\\ApplicationException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Exceptions\\ModelNotFoundException;\nuse Jiminny\\Jobs\\AutomatedReports\\RequestGenerateReportJob;\nuse Jiminny\\Models\\Activity\\Search;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPrompt;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPromptTarget;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Contracts\\UserContract;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Repositories\\AskAnythingRepository;\nuse Jiminny\\Repositories\\AutomatedReportsRepository;\nuse Jiminny\\Repositories\\GroupRepository;\nuse Jiminny\\Repositories\\SearchRepository;\nuse Jiminny\\Repositories\\StageRepository;\nuse Throwable;\n\nclass AutomatedReportsService\n{\n public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';\n public const string TYPE_ASK_JIMINNY = 'ask_jiminny';\n\n /**\n * Standard report types (used by kiosk for existing automated reports).\n */\n // @TODO this will add filter, however if we need to control feature by FF we need conditional logic\n public const array TYPES = [\n ['id' => 'exec_summary', 'name' => 'Exec Summary'],\n ['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],\n ['id' => 'product_feedback', 'name' => 'Product Feedback'],\n ['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],\n// ['id' => 'questions', 'name' => 'Questions'],\n// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],\n ];\n\n public const array ALL_TYPES = [\n ...self::TYPES,\n ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],\n ];\n\n public const string FREQUENCY_DAILY = 'daily';\n public const string FREQUENCY_WEEKLY = 'weekly';\n public const string FREQUENCY_MONTHLY = 'monthly';\n public const string FREQUENCY_QUARTERLY = 'quarterly';\n public const string FREQUENCY_ONE_OFF = 'one_off';\n\n /**\n * Frequencies for standard (non-Ask Jiminny) reports.\n */\n public const array FREQUENCIES = [\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n\n /**\n * Frequencies for Ask Jiminny reports.\n */\n public const array ASK_JIMINNY_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ];\n\n public const string MEDIA_TYPE_PDF = 'pdf';\n public const string MEDIA_TYPE_PODCAST = 'podcast';\n public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];\n public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];\n public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];\n public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];\n\n public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];\n public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];\n public const int SENT_REPORT_AT_HOURS = 5;\n public const string PDF_KEY = 'pdf';\n public const string AUDIO_KEY = 'audio';\n\n private const array ALL_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n private const string S3_DIR = 'reports';\n private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];\n private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];\n\n public function __construct(\n private readonly TeamRepository $teamRepository,\n private readonly GroupRepository $groupRepository,\n private readonly UserRepository $userRepository,\n private readonly StageRepository $stageRepository,\n private readonly DealStagesService $dealStagesService,\n private readonly RecipientsService $recipientsService,\n private readonly AutomatedReportsRepository $automatedReportsRepository,\n private readonly Webhook $webhookService,\n private readonly BusDispatcher $dispatcher,\n private readonly ActivityTypeService $activityTypeService,\n private readonly PlaybookCategoryRepository $playbookCategoryRepository,\n private readonly AskAnythingPromptService $askAnythingPromptService,\n private readonly SearchRepository $activitySearchRepository,\n private readonly AskAnythingRepository $askAnythingRepository,\n ) {\n }\n\n public static function getTypes(): array\n {\n $types = self::TYPES;\n\n return array_map(static function ($type) {\n return $type['id'];\n }, $types);\n }\n\n public static function getCallTypes(): array\n {\n return array_map(static function ($callType) {\n return $callType['id'];\n }, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);\n }\n\n public static function getFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::FREQUENCIES);\n }\n\n // front-facing structure\n public function getReportEnabledFieldData(bool $value = false): array\n {\n return [\n 'id' => 'report_enabled',\n 'label' => '',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'value' => $value,\n ];\n }\n\n // Organizations = Teams\n public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array\n {\n $options = $this->getTeams();\n\n if ($shortVersion) {\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value,\n 'dependencies' => [\n 'teams',\n 'deal_stage_at_call',\n 'current_deal_stage',\n 'recipients',\n ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,\n ],\n 'dependsOn' => [],\n ];\n }\n\n // Teams = Groups\n public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array\n {\n if ($shortVersion) {\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value, // value should be an array of objects {id, name}\n 'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],\n 'dependsOn' => [],\n ];\n }\n\n public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array\n {\n $types = [];\n if ($team instanceof Team) {\n if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n $types = self::TYPES;\n }\n if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {\n $types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];\n }\n } else {\n $types = self::TYPES;\n }\n\n if ($shortVersion) {\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'options' => $types,\n ];\n }\n\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $types,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getFrequencyFieldData(?string $value = null): array\n {\n return [\n 'id' => 'frequency',\n 'label' => 'Frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::FREQUENCIES,\n 'value' => $value,\n 'dependencies' => ['period'],\n 'dependsOn' => [],\n ];\n }\n\n public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array\n {\n return [\n 'id' => 'period',\n 'label' => 'Select one-off period',\n 'inputType' => InputTypeEnum::DATE_RANGE,\n 'required' => true,\n 'placeholder' => 'Select',\n 'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],\n 'queryParams' => [\n 'startDate' => 'start_date_period',\n 'endDate' => 'end_date_period',\n ],\n 'dependencies' => [],\n 'dependsOn' => ['frequency'],\n ];\n }\n\n public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array\n {\n return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);\n }\n\n public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);\n }\n\n public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);\n }\n\n public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'deal_value',\n 'label' => 'Deal Value',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_deal_value',\n 'max' => 'max_deal_value',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array\n {\n $value = [];\n $conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;\n $dialerOn && $value[] = self::CALL_TYPE_DIALER;\n\n return [\n 'id' => 'call_type',\n 'label' => 'Call Type',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => [\n self::CALL_TYPE_CONFERENCE,\n self::CALL_TYPE_DIALER,\n ],\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getMediaTypeFieldData(?AutomatedReport $report = null): array\n {\n $value = [];\n\n if ($report) {\n $value = $this->transformMediaTypes($report);\n }\n\n return [\n 'id' => 'media_types',\n 'label' => 'Export as',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => self::MEDIA_TYPE_OBJECTS,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'call_duration',\n 'label' => 'Call Duration',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_call_duration',\n 'max' => 'max_call_duration',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getRecipientsFieldData(?Team $team = null, array $value = []): array\n {\n return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);\n }\n\n public function getJiminnyRecipientsFieldData(array $value = []): array\n {\n return $this->recipientsService->getJiminnyRecipientsFieldData($value);\n }\n\n public function getAdditionalPromptInputFieldData(?string $value = null): array\n {\n return [\n 'id' => 'additional_prompt_input',\n 'label' => 'Special requirements',\n 'inputType' => InputTypeEnum::TEXTAREA,\n 'required' => false,\n 'placeholder' => 'What should be the focus of the report?',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCustomReportNameFieldData(?string $value = null): array\n {\n return [\n 'id' => 'custom_name',\n 'label' => 'Custom report name',\n 'inputType' => InputTypeEnum::TEXT,\n 'required' => false,\n 'placeholder' => 'Enter custom name',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n // data providers\n public function getTeams(): array\n {\n $teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);\n\n $teamData = [];\n foreach ($teams as $team) {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n continue;\n }\n\n $teamData[] = $this->transformTeam($team);\n }\n\n return $teamData;\n }\n\n public function getTeamGroups(string $teamUuid): array\n {\n $data = [];\n $team = $this->getTeam($teamUuid);\n\n if ($team !== null) {\n $groups = $team->groups()->get();\n\n foreach ($groups as $group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n public function getTeamsGroupsOptions(array $filterTeamUuids = []): array\n {\n $data = [];\n $teams = $this->getTeams();\n\n foreach ($teams as $team) {\n if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {\n continue;\n }\n\n $data[] = [\n 'label' => $team['name'],\n 'groups' => $this->getTeamGroups($team['id']),\n ];\n }\n\n return $data;\n }\n\n public function getTeam(string $teamUuid): ?Team\n {\n return $this->teamRepository->idOrUuid($teamUuid);\n }\n\n public function getTeamById(int $teamId): ?Team\n {\n return $this->teamRepository->find($teamId);\n }\n\n public function getGroupsUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportGroups = $report->getGroups();\n foreach ($reportGroups as $groupId) {\n if ($group = $this->groupRepository->find($groupId)) {\n $uuids[] = $group->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getPlaybookCategoriesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $playbookCategories = $report->getPlaybookCategories();\n foreach ($playbookCategories as $id) {\n if ($category = $this->playbookCategoryRepository->find($id)) {\n $uuids[] = $category->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getDealAtCallStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getDealAtCallStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getCurrentDealStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getCurrentDealStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getRecipients());\n }\n\n public function getJiminnyUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function extractUserUuids(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => $user->getUuid())\n ->values()\n ->all();\n }\n\n // get mail data\n public function getRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getRecipients());\n }\n\n /**\n * @return array<UserContract>\n */\n public function getRecipientUserObjects(AutomatedReport $report): array\n {\n $userIds = $report->getRecipients()['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->values()\n ->all();\n }\n\n private function getJiminnyRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function buildRecipientUsers(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => [\n 'email' => $user->getEmailAddress(),\n 'name' => $user->getName(),\n 'timezone' => $user->getTimezone()->getName(),\n ])\n ->values()\n ->all();\n }\n\n public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array\n {\n if ($report->isAskJiminnyReport()) {\n $recipients = $this->resolveAskJiminnyRecipients($report);\n } else {\n $recipients = $this->getRecipientUsers($report);\n if ($includeJiminny) {\n $recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));\n }\n }\n\n $emails = [];\n\n return array_values(array_filter(\n $recipients,\n static function ($recipient) use (&$emails) {\n if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {\n return false;\n }\n $emails[] = $recipient['email'];\n\n return true;\n }\n ));\n }\n\n private function resolveAskJiminnyRecipients(AutomatedReport $report): array\n {\n $recipients = [];\n\n $creator = $report->getCreator();\n if ($creator !== null) {\n $recipients[] = [\n 'email' => $creator->getEmailAddress(),\n 'name' => $creator->getName(),\n 'timezone' => $creator->getTimezone()->getName(),\n ];\n }\n\n return array_merge(\n $recipients,\n $this->buildRecipientUsers($report->getRecipients()),\n $this->getGroupRecipientUsers($report),\n );\n }\n\n private function getGroupRecipientUsers(AutomatedReport $report): array\n {\n $users = [];\n foreach ($report->getGroups() as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group === null) {\n continue;\n }\n foreach ($group->getMembers() as $member) {\n $users[] = [\n 'email' => $member->getEmailAddress(),\n 'name' => $member->getName(),\n 'timezone' => $member->getTimezone()->getName(),\n ];\n }\n }\n\n return $users;\n }\n\n public function getReportTypeName(AutomatedReportResult $report): string\n {\n $type = $report->getReport()->getType();\n\n $getType = $this->transformReportType($type);\n\n return $getType['name'];\n }\n\n public function getReportPeriodName(AutomatedReportResult $report): string\n {\n $from = $report->getFromDate();\n $to = $report->getToDate();\n $frequency = $report->getReport()->getFrequency();\n\n if ($from === null || $to === null) {\n if (! $report->getReport()->isAskJiminnyReport()) {\n $invalidPeriod = $from === null ? 'from' : 'to';\n\n throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);\n }\n\n $period = $this->calculateFromAndToDatePeriod($frequency);\n $from = $period['fromDate'];\n $to = $period['toDate'];\n }\n\n return $this->formatReportPeriodName($frequency, $from, $to);\n }\n\n private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string\n {\n $fromYear = $from->format('Y');\n $toYear = $to->format('Y');\n $differentYears = $fromYear !== $toYear;\n\n switch ($frequency) {\n case self::FREQUENCY_DAILY:\n return $from->format('j M Y');\n\n case self::FREQUENCY_QUARTERLY:\n // 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ\n $startMonth = $from->format('M');\n $endMonth = $to->copy()->subMonth();\n $endMonthName = $endMonth->format('M');\n $endMonthYear = $endMonth->format('Y');\n\n if ($differentYears) {\n return \"{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}\";\n }\n\n return \"{$startMonth} - {$endMonthName} {$toYear}\";\n\n case self::FREQUENCY_MONTHLY:\n // 'May 2025' - monthly reports are always within the same year\n return $from->format('M Y');\n\n case self::FREQUENCY_WEEKLY:\n // '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ\n $startDay = $from->format('j');\n $endDay = $to->format('j');\n $startMonth = $from->format('M');\n $endMonth = $to->format('M');\n\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n if ($startMonth !== $endMonth) {\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n return \"{$startDay} - {$endDay} {$endMonth} {$toYear}\";\n\n case self::FREQUENCY_ONE_OFF:\n // '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ\n $startDay = $from->format('j');\n $startMonth = $from->format('M');\n $endDay = $to->format('j');\n $endMonth = $to->format('M');\n\n // If same month and year, use a format like '2-31 May 2025'\n if ($startMonth === $endMonth && ! $differentYears) {\n return \"{$startDay} - {$endDay} {$startMonth} {$toYear}\";\n }\n\n // If different years, include both years\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n // Same year but different months\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n\n default:\n // Default format for unknown frequencies\n return $from->format('j M Y') . ' - ' . $to->format('j M Y');\n }\n }\n\n public function getReportTeamsName(AutomatedReportResult $report): string\n {\n $groups = $report->getGroups();\n\n if (empty($groups)) {\n return 'All';\n }\n\n // Get group names from repository\n $groupNames = [];\n foreach ($groups as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group) {\n $groupNames[] = $group->getName();\n }\n }\n\n if (count($groupNames) === 1) {\n // Single team format\n $teamsName = $groupNames[0];\n } else {\n // Multiple teams format\n $teamsName = implode(', ', $groupNames);\n }\n\n return $teamsName;\n }\n\n public function getReportFileName(AutomatedReportResult $report): string\n {\n $customName = $report->getReport()->getCustomName();\n $periodName = $this->getReportPeriodName($report);\n $filenameSuffix = $this->getFilenameSuffix($report);\n\n if ($customName) {\n if ($filenameSuffix) {\n $customName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$customName} - {$periodName}\");\n }\n\n $baseName = $this->getReportTypeName($report);\n\n if ($filenameSuffix) {\n $baseName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}\");\n }\n\n public function getReportFileNameWithExtension(AutomatedReportResult $result): string\n {\n $extension = $this->getMediaTypeMetadata($result)['extension'];\n\n return $this->getReportFileName($result) . '.' . $extension;\n }\n\n public function sanitizeFileName(string $fileName): string\n {\n return str_replace(['/', '\\\\'], '-', $fileName);\n }\n\n public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool\n {\n $recipients = array_map('intval', $report->getRecipients()['users'] ?? []);\n\n return in_array($user->getId(), $recipients);\n }\n\n public function transformReportResults(Collection $automatedReportResults): array\n {\n $data = [];\n foreach ($automatedReportResults as $automatedReportResult) {\n /** @var AutomatedReportResult $automatedReportResult */\n\n $report = $automatedReportResult->getReport();\n\n $createdBy = $report->getCreator();\n $creator = [\n 'id' => $createdBy?->getUuid(),\n 'name' => $createdBy?->getName(),\n 'email' => $createdBy?->getEmailAddress(),\n 'photoUrl' => $createdBy?->getPhotoUrl(),\n ];\n\n $recipients = $this->buildRecipients($report);\n\n $data[] = [\n 'id' => $automatedReportResult->getUuid(),\n 'name' => $automatedReportResult->getName(),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n 'recipients' => $recipients,\n 'recipients' => [\n ...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),\n ...array_values($this->transformRecipients($report->getRecipients())),\n ],\n 'report_type' => $this->transformReportType($report->getType()),\n 'media_type' => $automatedReportResult->getMediaType(),\n 'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),\n 'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),\n 'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),\n 'creator' => $creator,\n ];\n \n \n }\n\n return $data;\n }\n\n private function buildRecipients(AutomatedReport $report)\n {\n \n }\n\n public function hasCallTypeConference(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);\n }\n\n public function hasCallTypeDialer(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);\n }\n\n // transformers\n private function transformTeam(Team $team): array\n {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n return [];\n }\n\n return [\n 'id' => $team->getUuid(),\n 'name' => $team->getName(),\n ];\n }\n\n private function transformReportFullView(AutomatedReport $report): array\n {\n $base = $this->transformReportBase($report);\n\n return $report->getType() === self::TYPE_ASK_JIMINNY\n ? $base + $this->transformAskJiminnyFields($report)\n : $base + $this->transformStandardReportFields($report);\n }\n\n private function transformReportBase(AutomatedReport $report): array\n {\n return [\n 'id' => $report->getUuid(),\n 'organization' => $this->transformOrganization(team: $report->getTeam()),\n 'report_type' => $this->transformReportType($report->getType()),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n ];\n }\n\n private function transformStandardReportFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n\n return [\n 'report_enabled' => $report->getStatus(),\n 'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),\n 'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),\n 'deal_value_min' => $report->getDealValueMin(),\n 'deal_value_max' => $report->getDealValueMax(),\n 'call_types' => $this->transformCallType($report->getCallTypes()),\n 'media_types' => $this->transformMediaTypes($report),\n 'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),\n 'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),\n 'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),\n 'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),\n 'recipients' => $this->transformRecipients($report->getRecipients()),\n 'created_by' => $this->transformCreator($report->getCreator()),\n 'additional_prompt_input' => $report->getAdditionalPromptInput(),\n 'custom_name' => $report->getCustomName(),\n 'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),\n 'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),\n 'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),\n ];\n }\n\n private function transformAskJiminnyFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n $creatorId = $report->getAttribute('created_by');\n $explicitUserIds = array_values(array_filter(\n $report->getRecipients()['users'] ?? [],\n static fn ($id) => $id !== $creatorId\n ));\n\n return [\n 'report_name' => $report->getCustomName(),\n 'enabled' => $report->getStatus(),\n 'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),\n 'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),\n 'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),\n 'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),\n ];\n }\n\n private function transformOrganization(?Team $team): array\n {\n return [\n 'id' => $team?->getUuid(),\n 'name' => $team?->getName(),\n ];\n }\n\n private function transformReportType(string $type): array\n {\n foreach (self::ALL_TYPES as $typeItem) {\n if ($typeItem['id'] === $type) {\n return $typeItem;\n }\n }\n\n return [];\n }\n\n private function transformCallType(array $types): array\n {\n $result = [];\n $callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];\n\n foreach ($types as $type) {\n foreach ($callTypes as $callTypeItem) {\n if ($callTypeItem['id'] === $type) {\n $result[] = $callTypeItem;\n\n break;\n }\n }\n }\n\n return $result;\n }\n\n private function transformMediaTypes(AutomatedReport $report): array\n {\n $values = [];\n\n foreach ($report->getMediaTypes() as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n continue;\n }\n\n $values[] = match ($mediaType) {\n self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,\n self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,\n };\n }\n\n return $values;\n }\n\n private function transformFrequency(string $frequency): array\n {\n foreach (self::ALL_FREQUENCIES as $frequencyItem) {\n if ($frequencyItem['id'] === $frequency) {\n return $frequencyItem;\n }\n }\n\n return [];\n }\n\n public function transformDurationToMinutes(?int $duration): ?int\n {\n if (! $duration) {\n return null;\n }\n\n return (int) ($duration / 60);\n }\n\n private function transformGroups(?Team $team, array $groupsIds): array\n {\n if (empty($groupsIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($groupsIds as $groupId) {\n $group = $team->groups()->where('id', $groupId)->first();\n\n if ($group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n 'photoUrl' => $group->getPhotoUrl(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformStages(?Team $team, array $stagesIds): array\n {\n if (empty($stagesIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($stagesIds as $stageId) {\n $stage = $team->stages()->where('id', $stageId)->first();\n\n if ($stage) {\n $data[] = [\n 'id' => $stage->getUuid(),\n 'name' => $stage->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformRecipients(array $recipients): array\n {\n $users = [];\n foreach ($recipients['users'] ?? [] as $userId) {\n $users[] = $this->transformUser($userId);\n }\n\n return $users;\n }\n\n private function transformCreator(?User $user): ?array\n {\n if ($user === null) {\n return null;\n }\n\n return $this->transformUser($user->getId());\n }\n\n private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array\n {\n if ($prompt === null) {\n return null;\n }\n\n return [\n 'id' => $prompt->getUuid(),\n 'name' => $prompt->getTitle(),\n ];\n }\n\n private function transformSafeSearch(?Search $search): ?array\n {\n if ($search === null) {\n return null;\n }\n\n return [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ];\n }\n\n private function transformUser(int $userId): array\n {\n /* @var ?User $user */\n $user = $this->userRepository->find($userId);\n\n return [\n 'id' => $user?->getUuid(),\n 'name' => $user?->getName(),\n 'email' => $user?->getEmailAddress(),\n 'photoUrl' => $user?->getPhotoUrl(),\n ];\n }\n\n public function create(array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $validatedData['created_by'] = auth()->id();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function update(string $uuid, array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $report = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $report) {\n throw new InvalidArgumentException('Report not found');\n }\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Create an Ask Jiminny report.\n */\n public function createAskJiminnyReport(array $data, User $creator): array\n {\n $validatedData = $this->validateAskJiminnyReportData($data, $creator);\n $validatedData['created_by'] = $creator->getId();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Update an Ask Jiminny report.\n */\n public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array\n {\n if (! $report->isAskJiminnyReport()) {\n throw new InvalidArgumentException('Report is not an Ask Jiminny report');\n }\n\n $validatedData = $this->validateAskJiminnyReportData($data, $user);\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array\n {\n $this->automatedReportsRepository->update($report, ['status' => $status]);\n\n return $this->transformReportFullView($report->fresh());\n }\n\n /**\n * Validate and transform data for Ask Jiminny reports.\n */\n private function validateAskJiminnyReportData(array $data, User $user): array\n {\n // Validate name\n $name = trim($data['report_name'] ?? '');\n if (empty($name)) {\n throw new InvalidArgumentException('Report name is required');\n }\n if (mb_strlen($name) > 50) {\n throw new InvalidArgumentException('Report name must be 50 characters or less');\n }\n\n // Validate frequency (only daily, weekly, monthly for Ask Jiminny)\n $frequency = $data['frequency'] ?? null;\n $askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];\n if (! in_array($frequency, $askJiminnyFrequencies, true)) {\n throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');\n }\n\n // Validate expiration date\n $expiresAt = $data['expires_on'] ?? null;\n if (empty($expiresAt)) {\n throw new InvalidArgumentException('Expiration date is required');\n }\n\n try {\n $expiresAtDate = Carbon::parse($expiresAt);\n } catch (InvalidFormatException $e) {\n throw new InvalidArgumentException('Expiration date format is invalid');\n }\n $maxExpiration = Carbon::now()->addYear()->endOfDay();\n if ($expiresAtDate->gt($maxExpiration)) {\n throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');\n }\n if ($expiresAtDate->isPast()) {\n throw new InvalidArgumentException('Expiration date cannot be in the past');\n }\n\n // Validate saved search\n $activitySearchId = $data['saved_search'] ?? null;\n if (empty($activitySearchId)) {\n throw new InvalidArgumentException('Saved search is required');\n }\n $savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);\n if (! $savedSearch) {\n throw new InvalidArgumentException('Saved search not found or does not belong to you');\n }\n\n // Validate saved prompt\n $askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;\n if (empty($askAnythingPromptId)) {\n throw new InvalidArgumentException('Ask Jiminny prompt is required');\n }\n $prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);\n if (! $prompt) {\n throw new InvalidArgumentException('Ask Jiminny prompt not found');\n }\n\n // Validate status\n $status = $data['enabled'] ?? false;\n\n $recipientUserIds = [$user->getId()];\n\n if (! empty($data['share_users'])) {\n $sharedUserIds = $this->validateAndGetUserIdsByTeam(\n $user->team,\n (array) $data['share_users']\n );\n $recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);\n }\n\n $sharedGroupIds = [];\n if (! empty($data['share_teams'])) {\n $sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);\n }\n\n $recipientUserIds = array_values(array_unique($recipientUserIds));\n\n return [\n 'team_id' => $user->getTeamId(),\n 'type' => self::TYPE_ASK_JIMINNY,\n 'status' => (bool) $status,\n 'frequency' => $frequency,\n 'custom_name' => $name,\n 'activity_search_id' => $savedSearch->getId(),\n 'ask_anything_prompt_id' => $prompt->getId(),\n 'expires_at' => $expiresAtDate->toDateString(),\n 'media_types' => [self::MEDIA_TYPE_PDF],\n 'call_types' => [],\n 'recipients' => ['users' => $recipientUserIds],\n 'groups' => $sharedGroupIds,\n ];\n }\n\n public static function getAskJiminnyFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::ASK_JIMINNY_FREQUENCIES);\n }\n\n public function getAskJiminnyReportFilters(User $user): array\n {\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n return [\n [\n 'id' => 'prompt',\n 'label' => 'Prompt',\n 'options' => $prompts,\n ],\n [\n 'id' => 'saved_search',\n 'label' => 'Saved Search',\n 'options' => $savedSearches,\n ],\n ];\n }\n\n public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array\n {\n $team = $user->getTeam();\n $userTimezone = $user->getTimezone();\n\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n $teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ])->values()->all();\n\n $shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];\n\n $sharedTeamsValue = [];\n $sharedUsersValue = [];\n if ($report) {\n $sharedTeamsValue = $this->transformGroups($team, $report->getGroups());\n\n $recipientUserIds = $report->getRecipients()['users'] ?? [];\n $creatorId = $report->getAttribute('created_by');\n $sharedUserIds = array_values(array_filter(\n $recipientUserIds,\n static fn ($id) => $id !== $creatorId\n ));\n $sharedUsersValue = collect($sharedUserIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (User $u) => [\n 'id' => $u->getUuid(),\n 'name' => $u->getName(),\n ])\n ->values()\n ->all();\n }\n\n return [\n 'fields' => [\n [\n 'id' => 'enabled',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'label' => '',\n 'value' => $report?->getStatus() ?? false,\n ],\n [\n 'id' => 'report_name',\n 'inputType' => InputTypeEnum::TEXT,\n 'label' => 'Name',\n 'placeholder' => 'Enter name',\n 'required' => true,\n 'validation' => ['maxLength' => 50],\n 'value' => $report?->getCustomName() ?? '',\n ],\n [\n 'id' => 'frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Frequency',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::ASK_JIMINNY_FREQUENCIES,\n 'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,\n ],\n [\n 'id' => 'expires_on',\n 'inputType' => InputTypeEnum::DATE,\n 'label' => 'Expires on',\n 'required' => true,\n 'placeholder' => 'Select',\n 'validation' => [\n 'minDate' => now($userTimezone)->toDateString(),\n 'maxDate' => now($userTimezone)->addYear()->toDateString(),\n ],\n 'value' => $report?->getExpiresAt()?->toDateString(),\n ],\n [\n 'id' => 'share_teams',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team',\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $teamGroups,\n 'value' => $sharedTeamsValue,\n ],\n [\n 'id' => 'share_users',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team member',\n 'required' => false,\n 'placeholder' => 'Select',\n 'groupLabelKey' => 'label',\n 'groupValuesKey' => 'users',\n 'optionLabelKey' => 'name',\n 'optionValueKey' => 'id',\n 'options' => $shareUsers,\n 'value' => $sharedUsersValue,\n ],\n [\n 'id' => 'saved_search',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Saved search',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $savedSearches,\n 'value' => $report && $report->getSavedSearch() ? [\n 'id' => $report->getSavedSearch()->getUuid(),\n 'name' => $report->getSavedSearch()->getName(),\n ] : null,\n ],\n [\n 'id' => 'ask_jiminny_prompt',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Ask Jiminny prompt',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $prompts,\n 'value' => $report && $report->getAskAnythingPrompt() ? [\n 'id' => $report->getAskAnythingPrompt()->getUuid(),\n 'name' => $report->getAskAnythingPrompt()->getTitle(),\n ] : null,\n ],\n ],\n ];\n }\n\n private function updateResultNames(AutomatedReport $automatedReport): void\n {\n $results = $this->automatedReportsRepository->getResultsByReport($automatedReport);\n\n foreach ($results as $result) {\n $result->update(['name' => $this->getReportFileName($result)]);\n }\n }\n\n public function updateStatus(string $uuid, array $data): array\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $automatedReport->update([\n 'status' => $status,\n ]);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n private function generateOneOffReport(AutomatedReport $automatedReport): void\n {\n // the scheduler handles all the other frequency types\n if ($automatedReport->getStatus() === false || $automatedReport->getFrequency() !== self::FREQUENCY_ONE_OFF) {\n return;\n }\n\n $this->dispatcher->dispatch(new RequestGenerateReportJob($automatedReport->getUuid()));\n }\n\n public function getReport(string $uuid): AutomatedReport\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n return $automatedReport;\n }\n\n public function get(string $uuid): array\n {\n $automatedReport = $this->getReport($uuid);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function list(string $sortColumn = 'created_at', string $sortDirection = 'desc'): array\n {\n $results = [];\n $collection = $this->automatedReportsRepository->getAllStandardReports($sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function listAskJiminnyReports(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): array {\n $results = [];\n $collection = $this->automatedReportsRepository->getAskJiminnyReportsByUser($user, $sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function delete(string $uuid): void\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $automatedReport->delete();\n }\n\n public function createReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n return $this->automatedReportsRepository->createResult(\n array_merge(\n [\n 'report_id' => $automatedReport->getId(),\n 'status' => AutomatedReportResult::STATUS_DEFAULT,\n ],\n $data\n )\n );\n }\n\n public function getOrCreateReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n $existing = $this->automatedReportsRepository->findLatestDefaultOrFailedResult($automatedReport);\n\n if ($existing !== null) {\n $existing->update(['status' => AutomatedReportResult::STATUS_DEFAULT]);\n\n return $existing;\n }\n\n return $this->createReportResult($automatedReport, $data);\n }\n\n public function getReportResult(string $resultUuid): AutomatedReportResult\n {\n $report = $this->automatedReportsRepository->findResultByUuid($resultUuid);\n\n if (! $report) {\n throw new ModelNotFoundException('Report Result not found');\n }\n\n return $report;\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return $this->automatedReportsRepository->findChildResult($result, $type);\n }\n\n // prophet API calls\n /**\n * @throws ApplicationException\n */\n public function getGenerateReportPayload(AutomatedReport $automatedReport, string $reportResultUuid): array\n {\n $period = $this->calculateFromAndToDate($automatedReport);\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n return [\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResultUuid,\n 'report_type' => $automatedReport->getType(),\n 'media_types' => $automatedReport->getMediaTypes(),\n 'from_date' => $fromDate->startOfDay()->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->endOfDay()->format(DateTimeInterface::RFC3339),\n 'group_ids' => $automatedReport->getGroups(),\n 'call_deal_stage' => $automatedReport->getDealAtCallStages(),\n 'current_deal_stage' => $automatedReport->getCurrentDealStages(),\n 'deal_min_value' => $automatedReport->getDealValueMin(),\n 'deal_max_value' => $automatedReport->getDealValueMax(),\n 'call_types' => $automatedReport->getCallTypes(),\n 'call_duration_min_seconds' => $automatedReport->getCallDurationMin(),\n 'call_duration_max_seconds' => $automatedReport->getCallDurationMax(),\n 'special_requirements' => $automatedReport->getAdditionalPromptInput(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->formatReportPeriodName(\n $automatedReport->getFrequency(),\n $fromDate,\n $toDate,\n ),\n 'playbook_categories' => $automatedReport->getPlaybookCategories(),\n 'custom_name' => $automatedReport->getCustomName(),\n ];\n }\n\n // $inputPayload - FE payload structure\n public function getActivitiesCountPayload(array $inputPayload): array\n {\n // Use validateAndTransformData to validate and normalize input\n $validatedData = $this->validateAndTransformData($inputPayload);\n $period = $this->calculateFromAndToDatePeriod(\n $validatedData['frequency'],\n Carbon::parse($validatedData['from']),\n Carbon::parse($validatedData['to']),\n );\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n // Create payload similar to getGenerateReportPayload\n return [\n 'team_id' => $validatedData['team_id'],\n 'group_ids' => $validatedData['groups'] ?? [],\n 'report_type' => $validatedData['type'],\n 'from_date' => $fromDate->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->format(DateTimeInterface::RFC3339),\n 'call_deal_stage' => $validatedData['deal_at_call_stages'] ?? [],\n 'current_deal_stage' => $validatedData['current_deal_stages'] ?? [],\n 'deal_min_value' => $validatedData['deal_value_min'] ?? null,\n 'deal_max_value' => $validatedData['deal_value_max'] ?? null,\n 'call_types' => $validatedData['call_types'],\n 'call_duration_min_seconds' => $validatedData['call_duration_min'] ?? null,\n 'call_duration_max_seconds' => $validatedData['call_duration_max'] ?? null,\n 'special_requirements' => $validatedData['additional_prompt_input'] ?? null,\n 'playbook_categories' => $validatedData['playbook_categories'] ?? [],\n 'request_id' => null,\n 'callback_url' => null,\n ];\n }\n\n public function shouldSendReport(array $users, ?CarbonInterface $generatedAt = null): bool\n {\n if (empty($users)) {\n return false;\n }\n\n $earliestTz = collect($users)\n ->mapWithKeys(function (array $user) {\n $tz = new DateTimeZone($user['timezone']);\n $nowUtc = new DateTime('now', new DateTimeZone('UTC'));\n $offset = $tz->getOffset($nowUtc);\n\n return [$user['timezone'] => $offset];\n })\n ->sortDesc()\n ->keys()\n ->first();\n\n $now = Carbon::now($earliestTz);\n $isScheduledTime = (int) $now->format('H') === self::SENT_REPORT_AT_HOURS;\n\n if ($isScheduledTime) {\n return true;\n }\n\n return $this->hasPassedScheduledTime($generatedAt, $earliestTz);\n }\n\n public function hasPassedScheduledTime(?CarbonInterface $generatedAt, string $timezone): bool\n {\n if ($generatedAt === null) {\n return false;\n }\n\n $now = Carbon::now($timezone);\n $scheduledTime = $now->copy()->setTime(self::SENT_REPORT_AT_HOURS, 0, 0);\n\n if ($now->hour < self::SENT_REPORT_AT_HOURS) {\n $scheduledTime = $scheduledTime->subDay();\n }\n\n $scheduledTimeUtc = $scheduledTime->copy()->utc();\n $generatedAtUtc = $generatedAt->copy()->utc();\n $nowUtc = $now->copy()->utc();\n\n return $generatedAtUtc->lt($scheduledTimeUtc) && $nowUtc->gt($scheduledTimeUtc);\n }\n\n public function calculateFromAndToDatePeriod(\n string $frequency,\n ?Carbon $fromDate = null,\n ?Carbon $toDate = null\n ): array {\n if ($frequency === self::FREQUENCY_ONE_OFF) {\n return [\n 'fromDate' => $fromDate,\n 'toDate' => $toDate,\n ];\n }\n\n $now = Carbon::now();\n\n return match ($frequency) {\n self::FREQUENCY_DAILY => [\n 'fromDate' => $now->copy()->subDay()->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_WEEKLY => [\n 'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_MONTHLY => [\n 'fromDate' => $now->copy()->subMonths(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_QUARTERLY => [\n 'fromDate' => $now->copy()->subMonths(3)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n default => throw new InvalidArgumentException(\"Unsupported frequency: {$frequency}\"),\n };\n }\n\n private function calculateFromAndToDate(AutomatedReport $automatedReport): array\n {\n return $this->calculateFromAndToDatePeriod(\n $automatedReport->getFrequency(),\n $automatedReport->getFrom(),\n $automatedReport->getTo()\n );\n }\n\n public function getAskJiminnyGenerateReportPayload(\n AutomatedReport $automatedReport,\n AutomatedReportResult $reportResult,\n array $activityIds,\n ): array {\n return [\n 'user_question' => $automatedReport->getAskAnythingPrompt()?->getContent(),\n 'call_ids' => array_map('strval', $activityIds),\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResult->getUuid(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->getReportPeriodName($reportResult),\n 'report_name' => $automatedReport->getCustomName(),\n ];\n }\n\n private function getCallbackUrl(): string\n {\n return $this->webhookService->route('jiminny.webhook.reports.ready');\n }\n\n /**\n * Validate and transform payload data for automated reports\n *\n * @param array $data\n *\n * @throws InvalidArgumentException\n *\n * @return array\n */\n private function validateAndTransformData(array $data): array\n {\n // Validate organization (team) and check feature\n $team = $this->validateOrganization($data['organization'] ?? null);\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $type = $this->validateReportType($data['report_type'] ?? null);\n $frequency = $this->validateFrequency($data['frequency'] ?? null);\n $additionalPromptInput = $this->validateAdditionalPromptInput(\n $data['additional_prompt_input'] ?? null\n );\n $customReportName = $this->validateCustomReportName($data['custom_name'] ?? null);\n\n // Prepare data for the database\n $reportData = [\n 'team_id' => $team->getId(),\n 'type' => $type,\n 'status' => $status,\n 'frequency' => $frequency,\n 'additional_prompt_input' => $additionalPromptInput,\n 'custom_name' => $customReportName,\n ];\n\n // Validate deal values\n $reportData = $this->validateDealValues($data, $reportData);\n\n // Validate date range\n $reportData = $this->validateDateRange($data, $reportData, $frequency);\n\n // Validate call durations\n $reportData = $this->validateCallDurations($data, $reportData);\n\n // Validate call types\n $reportData = $this->validateCallTypes($data, $reportData);\n\n // Validate media types\n $reportData = $this->validateMediaTypes($data, $reportData);\n\n // Validate groups\n if (isset($data['teams'])) {\n $reportData['groups'] = $this->validateAndGetGroupIds($team, $data['teams']);\n }\n\n // Validate deal stages\n $reportData = $this->validateDealStages($data, $reportData, $team, $type);\n\n // Validate playbook categories\n $reportData = $this->validatePlaybookCategories($data, $reportData, $team);\n\n // Validate recipients\n $reportData['recipients'] = [\n 'users' => $this->validateAndGetUserIdsByTeam($team, $data['recipients'] ?? []),\n ];\n\n if (isset($data['jiminny_recipients'])) {\n // Validate Jiminny recipients\n $reportData['jiminny_recipients'] = [\n 'users' => $this->validateAndGetJiminnyUserIds((array) $data['jiminny_recipients']),\n ];\n }\n\n return $reportData;\n }\n\n private function validateDealValues(array $data, array $reportData): array\n {\n if (isset($data['min_deal_value'])) {\n $reportData['deal_value_min'] = (int) $data['min_deal_value'];\n\n if ($reportData['deal_value_min'] > 4294967295 || $reportData['deal_value_min'] < 0) {\n throw new InvalidArgumentException('Min deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_deal_value'])) {\n $reportData['deal_value_max'] = (int) $data['max_deal_value'];\n\n if ($reportData['deal_value_max'] > 4294967295 || $reportData['deal_value_max'] < 0) {\n throw new InvalidArgumentException('Max deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['min_deal_value'], $data['max_deal_value'])\n && $data['min_deal_value'] > $data['max_deal_value']\n ) {\n throw new InvalidArgumentException('Min deal value cannot be greater than max deal value');\n }\n\n return $reportData;\n }\n\n private function validateDateRange(array $data, array $reportData, string $frequency): array\n {\n // Set date range only for one_off frequency\n if ($frequency === 'one_off') {\n if (isset($data['start_date_period'])) {\n $reportData['from'] = $this->parseDate($data['start_date_period']);\n }\n\n if (isset($data['end_date_period'])) {\n $reportData['to'] = $this->parseDate($data['end_date_period']);\n }\n\n if (empty($reportData['from']) || empty($reportData['to'])) {\n throw new InvalidArgumentException(\n 'Start date and end date are required for one_off frequency'\n );\n }\n } else {\n $reportData['from'] = null;\n $reportData['to'] = null;\n }\n\n return $reportData;\n }\n\n private function validateCallDurations(array $data, array $reportData): array\n {\n // Convert call durations from minutes to seconds\n if (isset($data['min_call_duration'])) {\n $reportData['call_duration_min'] = (int) $data['min_call_duration'] * 60;\n\n if ($reportData['call_duration_min'] > 4294967295 || $reportData['call_duration_min'] < 0) {\n throw new InvalidArgumentException('Min call duration should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_call_duration'])) {\n $reportData['call_duration_max'] = (int) $data['max_call_duration'] * 60;\n\n if ($reportData['call_duration_max'] > 4294967295 || $reportData['call_duration_max'] < 0) {\n throw new InvalidArgumentException('Max call duration should be between 0 and 4294967295');\n }\n }\n\n return $reportData;\n }\n\n private function validateCallTypes(array $data, array $reportData): array\n {\n // Set call types\n $reportData['call_types'] = $data['call_type'] ?? [];\n if (empty($reportData['call_types'])) {\n $reportData['call_types'] = self::getCallTypes();\n }\n\n foreach ($reportData['call_types'] as $callType) {\n if (! in_array($callType, self::getCallTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Call type %s is invalid', $callType));\n }\n }\n\n return $reportData;\n }\n\n private function validateMediaTypes(array $data, array $reportData): array\n {\n // Set media types from input data\n $reportData['media_types'] = $data['media_types'] ?? [];\n\n if (empty($reportData['media_types'])) {\n throw new InvalidArgumentException('Media types are required');\n }\n\n foreach ($reportData['media_types'] as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n throw new InvalidArgumentException(sprintf('Media type %s is invalid', $mediaType));\n }\n }\n\n return $reportData;\n }\n\n private function validateDealStages(array $data, array $reportData, Team $team, string $reportType): array\n {\n // Validate and set deal stages\n if (isset($data['deal_stage_at_call'])) {\n $reportData['deal_at_call_stages'] =\n $this->validateAndGetDealStageIds($team, $data['deal_stage_at_call'], 'Deal stage at call');\n }\n\n if (isset($data['current_deal_stage'])) {\n $reportData['current_deal_stages'] =\n $this->validateAndGetDealStageIds($team, $data['current_deal_stage'], 'Current deal stage');\n }\n\n // Ensure current_deal_stage is not provided for loss_analysis report type\n if ($reportType === self::TYPE_LOSS_ANALYSIS && ! empty($data['current_deal_stage'])) {\n throw new InvalidArgumentException('Current deal stage is not applicable for Loss Analysis reports');\n }\n\n return $reportData;\n }\n\n // transform uuid to id\n private function validatePlaybookCategories(array $data, array $reportData, Team $team): array\n {\n $key = 'playbook_categories';\n\n if (isset($data[$key])) {\n $payloadIds = $data[$key];\n $ids = [];\n\n foreach ($payloadIds as $uuid) {\n $uuid = (string) $uuid;\n\n try {\n $playbookCategory = $this->playbookCategoryRepository->findByUuid($uuid);\n } catch (Throwable $throwable) {\n Log::error(__METHOD__ . ' ' . $throwable->getMessage());\n\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory) {\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory->hasPlaybook()) {\n throw new InvalidArgumentException(sprintf('Playbook category %s has no playbook', $uuid));\n }\n\n if ($playbookCategory->getPlaybook()->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Playbook category %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $ids[] = $playbookCategory->getId();\n }\n\n $reportData[$key] = $ids;\n }\n\n return $reportData;\n }\n\n private function validateReportStatus($status): bool\n {\n if (! in_array($status, [true, false], true)) {\n throw new InvalidArgumentException('Report status is invalid');\n }\n\n return $status;\n }\n\n private function validateReportType($type): string\n {\n if (! in_array($type, self::getTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Report type is invalid: %s', $type));\n }\n\n return $type;\n }\n\n private function validateFrequency($frequency): string\n {\n if (! in_array($frequency, self::getFrequencies(), true)) {\n throw new InvalidArgumentException('Frequency is invalid');\n }\n\n return $frequency;\n }\n\n private function validateAdditionalPromptInput(?string $additionalPromptInput): ?string\n {\n if ($additionalPromptInput && strlen($additionalPromptInput) > 5000) {\n throw new InvalidArgumentException('Additional Prompt Input should be less than 5000 characters');\n }\n\n return $additionalPromptInput;\n }\n\n private function validateCustomReportName(?string $customReportName): ?string\n {\n if ($customReportName === null || $customReportName === '') {\n return null;\n }\n\n if (strlen($customReportName) > 70) {\n throw new InvalidArgumentException('Custom report name should be less than 70 characters');\n }\n\n return $customReportName;\n }\n\n private function validateOrganization(?string $organizationUuid): Team\n {\n if (! $organizationUuid) {\n throw new InvalidArgumentException('Organization is required');\n }\n\n $team = $this->teamRepository->idOrUuid($organizationUuid);\n\n if (! $team) {\n throw new InvalidArgumentException('Organization not found');\n }\n\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n throw new InvalidArgumentException('Organization does not have the Automated Reports feature');\n }\n\n return $team;\n }\n\n private function validateAndGetGroupIds(Team $team, array $teamUuids): array\n {\n $groupIds = [];\n\n foreach ($teamUuids as $uuid) {\n $group = $this->groupRepository->findByUuid($uuid);\n\n if ($group === null || $group->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Group %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $groupIds[] = $group->getId();\n\n }\n\n return $groupIds;\n }\n\n private function validateAndGetDealStageIds(Team $team, array $stageUuids, string $propertyLabel): array\n {\n $stageIds = [];\n\n foreach ($stageUuids as $uuid) {\n $stage = $this->stageRepository->findByUuid($uuid);\n\n if ($stage === null || $stage->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Stage %s not found for team %s for %s', $uuid, $team->getUuid(), $propertyLabel)\n );\n }\n\n $stageIds[] = $stage->getId();\n }\n\n return $stageIds;\n }\n\n private function validateAndGetUserIds(array $userUuids, callable $teamCheck): array\n {\n if (empty($userUuids)) {\n return [];\n }\n\n $userIds = [];\n\n foreach ($userUuids as $uuid) {\n $user = $this->userRepository->findByUuid($uuid);\n\n if (! $user || ! $user->isStatusActive()) {\n throw new InvalidArgumentException(\n sprintf('User %s not found or is not active', $uuid)\n );\n }\n\n if (! $teamCheck($user)) {\n throw new InvalidArgumentException(\n sprintf('User %s does not belong to the allowed team(s)', $uuid)\n );\n }\n\n $userIds[] = $user->getId();\n }\n\n return $userIds;\n }\n\n private function validateAndGetUserIdsByTeam(Team $team, array $userUuids): array\n {\n return $this->validateAndGetUserIds($userUuids, fn ($user) => $user->getTeamId() === $team->getId());\n }\n\n private function validateAndGetJiminnyUserIds(array $userUuids): array\n {\n $allowedTeamIds = config('kiosk.teamIds', []);\n\n return $this->validateAndGetUserIds($userUuids, fn ($user) => in_array($user->getTeamId(), $allowedTeamIds, true));\n }\n\n private function parseDate(string $dateString): string\n {\n return date('Y-m-d H:i:s', strtotime($dateString));\n }\n\n private function generateReportResultViewUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.view', ['uuid' => $result->getUuid()]);\n }\n\n private function generateReportResultDownloadUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.download', ['uuid' => $result->getUuid()]);\n }\n\n private function getReportMediaRouteResource(AutomatedReportResult $result): string\n {\n if ($result->getMediaType() === self::MEDIA_TYPE_PDF) {\n return self::PDF_KEY;\n } elseif ($result->getMediaType() === self::MEDIA_TYPE_PODCAST) {\n return self::AUDIO_KEY;\n }\n\n throw new \\InvalidArgumentException('Unknown media type.');\n }\n\n public function getMediaPath(AutomatedReportResult $result): ?string\n {\n $url = match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => $result->getPdfUrl(),\n self::MEDIA_TYPE_PODCAST => $result->getPodcastAudioUrl(),\n default => null,\n };\n\n if ($url === null) {\n return null;\n }\n\n $path = parse_url(trim($url, '\"\\''), PHP_URL_PATH);\n\n return $path ?: null;\n }\n\n public function getFilenameSuffix(AutomatedReportResult $result): ?string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => 'Podcast',\n default => null,\n };\n }\n\n public function getMailSubjectSuffix(AutomatedReportResult $result): string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => 'report',\n self::MEDIA_TYPE_PODCAST => 'podcast',\n default => '',\n };\n }\n\n public function getMediaTypeMetadata(AutomatedReportResult $result): array\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => ['extension' => 'mp3', 'mime' => 'audio/mpeg'],\n self::MEDIA_TYPE_PDF => ['extension' => 'pdf', 'mime' => 'application/pdf'],\n default => ['extension' => null, 'mime' => null],\n };\n }\n\n public function deleteS3Files(AutomatedReportResult $result): void\n {\n $teamUuid = $result->getReport()->getTeam()->getUuid();\n $reportUuid = $result->getUuid();\n\n // delete all files for a report uuid no mather of pdf, podcast, or both\n // in case of both - the podcast files are linked to the pdf (parent) uuid\n // pdf and podcast date times should be close\n $path = sprintf('%s/%s/%s', $teamUuid, self::S3_DIR, $reportUuid);\n\n foreach (self::FILE_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted S3 file', [\n 'path' => $file,\n ]);\n }\n }\n\n foreach (self::FILE_PODCAST_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '_podcast.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted Podcast S3 file', [\n 'path' => $file,\n ]);\n }\n }\n }\n\n /**\n *\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): Collection\n {\n return $this->automatedReportsRepository->getTeamIdsWithReportsResults($teamId);\n }\n\n /**\n * Core delete logic for report results using a query\n *\n * @param Builder $query\n * @param array $logContext\n *\n * @return int\n */\n private function deleteReportResultsByQuery(Builder $query, array $logContext = []): int\n {\n $deletedCount = 0;\n\n if ($query->exists()) {\n Log::info(\n 'Run delete report results',\n array_merge(\n $logContext,\n [\n 'service' => 'AutomatedReportsService',\n ]\n )\n );\n\n $query->chunkById(50, function ($results) use (&$deletedCount, $logContext) {\n foreach ($results as $result) {\n $this->deleteReportResult($result);\n $deletedCount++;\n\n Log::info(\n 'Deleted a report result',\n array_merge(\n $logContext,\n [\n 'result_id' => $result->getId(),\n 'report_id' => $result->getReportId(),\n ]\n )\n );\n }\n });\n }\n\n return $deletedCount;\n }\n\n /**\n * Delete report results for a team by retention period\n *\n * @param Team $team\n * @param CarbonImmutable $retentionDate\n *\n * @return int Number of deleted report results\n */\n public function deleteReportsResultsInRetentionPeriod(Team $team, CarbonImmutable $retentionDate): int\n {\n $reportIds = $this->automatedReportsRepository->getReportIdsByTeam($team);\n\n if ($reportIds->isEmpty()) {\n return 0;\n }\n\n $query = $this->automatedReportsRepository\n ->getReportResultsQueryForRetention($team, $retentionDate);\n\n return $this->deleteReportResultsByQuery($query, [\n 'team_id' => $team->getId(),\n 'retention_date' => $retentionDate->toDateTimeString(),\n ]);\n }\n\n /**\n * Delete ALL report results for a specific automated report\n *\n * @param string $uuid\n *\n * @return int\n */\n public function deleteReportResults(string $uuid): int\n {\n $report = $this->getReport($uuid);\n\n $query = $this->automatedReportsRepository->getResultsByReportQuery($report);\n\n return $this->deleteReportResultsByQuery($query, [\n 'report_uuid' => $uuid,\n 'report_id' => $report->getId(),\n ]);\n }\n\n public function deleteReportResult(AutomatedReportResult $result): void\n {\n $this->deleteS3Files($result);\n\n $result->delete();\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getTeamReports(Team $team): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getReportsByTeam($team);\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getReportResults(AutomatedReport $report): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getResultsByReport($report);\n }\n\n public function deleteAllReportResults(AutomatedReport $report): void\n {\n $results = $this->getReportResults($report);\n\n /** @var AutomatedReportResult $result */\n foreach ($results as $result) {\n Log::info('Deleting result', [\n 'report' => $report->getId(),\n 'result' => $result->getId(),\n ]);\n\n $this->deleteReportResult($result);\n }\n }\n\n public function deleteAllData(Team $team): void\n {\n Log::info('Deleting automated report and results for team', [\n 'team' => $team->getId(),\n ]);\n\n $reports = $this->getTeamReports($team);\n\n /** @var AutomatedReport $report */\n foreach ($reports as $report) {\n Log::info('Deleting report', [\n 'team' => $team->getId(),\n 'report' => $report->getId(),\n ]);\n\n $this->deleteAllReportResults($report);\n\n $report->delete();\n }\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"bounds":{"left":0.50166225,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"bounds":{"left":0.5103058,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"bounds":{"left":0.5212766,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"bounds":{"left":0.5299202,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"bounds":{"left":0.53856385,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"bounds":{"left":0.54953456,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"bounds":{"left":0.56050533,"top":0.14844373,"width":0.024268618,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"bounds":{"left":0.58710104,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"bounds":{"left":0.5980718,"top":0.14844373,"width":0.029587766,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"bounds":{"left":0.6599069,"top":0.14844373,"width":0.02825798,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"18","depth":4,"bounds":{"left":0.63231385,"top":0.17318435,"width":0.009640957,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"14","depth":4,"bounds":{"left":0.64394945,"top":0.17318435,"width":0.009640957,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"2","depth":4,"bounds":{"left":0.6555851,"top":0.17318435,"width":0.007978723,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"4","depth":4,"bounds":{"left":0.6655585,"top":0.17318435,"width":0.007978723,"height":0.015163607},"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.67519945,"top":0.17158818,"width":0.00731383,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.6825133,"top":0.17158818,"width":0.006981383,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o\nJOIN activities a ON o.id = a.opportunity_id\nWHERE a.crm_configuration_id = 39\nAND a.actual_start_time > '2025-10-13'\nAND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM activities\nWHERE crm_configuration_id = 39 and user_id = 143\nand actual_start_time >= '2025-10-13'\nAND type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM opportunities WHERE account_id IN (178);\nselect * from activities where id IN (620137, 620187, 620188, 620189, 620230);\n\n# HS\nSELECT * FROM opportunities WHERE id IN (238);\nselect * from activities where id IN (477,2076);\n\nselect * from users;\n\nSELECT COUNT(*) FROM users;\nSELECT COUNT(*) FROM activities;\nSELECT COUNT(*) FROM opportunities;\n\nUPDATE activities\nSET\n actual_start_time = '2025-12-19 09:00:00',\n actual_end_time = '2025-12-19 10:30:00',\n scheduled_start_time = '2025-12-19 09:00:00',\n scheduled_end_time = '2025-12-19 10:30:00'\nWHERE id IN (407509,407375);\n\nselect * from partners;\n\nSELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id\nFROM activities\nWHERE user_id = 143\nAND actual_start_time >= '2025-10-13 00:00:00'\nAND actual_start_time <= '2026-01-13 23:59:59'\nORDER BY actual_start_time DESC;\n\nSELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;\nSELECT * FROM crm_layouts where crm_configuration_id = 39;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;\n# lead_id\n# account_id 177\n# contact_id 3969\n# opportunity_id\n# stage_id 203\n\nSELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;\n\nSELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'\nAND user_id = 143 and actual_start_time >= '2025-10-13';\n\nSELECT * FROM activities a\n# JOIN opportunities o ON a.opportunity_id = o.id\nWHERE a.crm_configuration_id = 39 AND a.type = 'conference'\nand status = 'completed' and recording_state = 'recorded'\nand a.actual_start_time >= '2025-10-13'\nAND a.user_id = 143\n;\n\nselect * from leads\nwhere crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707\n\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310);\nSELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198\nSELECT * FROM activities WHERE id IN (356001, 356008); # contacts:\n\nSELECT * FROM opportunities WHERE id IN (1707);\nSELECT * FROM stages where id IN (204, 198);\nSELECT * FROM opportunities WHERE account_id IN (178);\nSELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';\nSELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal\n\nSELECT * FROM activities where crm_configuration_id = 39\nAND opportunity_id IS NULL\nAND is_internal = false\nand status = 'completed' and recording_state = 'recorded'\nAND actual_start_time >= '2025-10-13'\nAND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)\n# AND lead_id IN (112, 109)\n;\n\nSELECT * FROM crm_profiles WHERE user_id = 143;\n\nselect * from inboxes; # 212\nselect * from users where id = 143; # 143\nselect * from inbox_email_batches where inbox_id = 212\nand updated_at >= '2026-01-28 00:00:00' order by id desc;\nselect * from inbox_emails where inbox_id = 212\nand batch_id = 95885 order by id desc;\nselect * from email_messages where origin_user_id = 143;\nselect * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';\nselect * from participants where activity_id = 620247;\n\nselect * from crm_profiles where user_id = 143;\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001\nselect * from transcription where activity_id = 356001; # 6943\nselect * from ai_prompts where transcription_id = 6943;\nSELECT * FROM activity_summary_logs where activity_id = 356001;\n\nSELECT * FROM social_accounts WHERE sociable_id = 143;\n\n# ************************************************************************************\nSELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;\n# 422515 softphone tr. 8100\n\nSELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;\n# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS\n\nselect * from ai_prompts where transcription_id IN (8100, 7670);\nselect * from activity_summary_logs where activity_id = 407509;\n\nselect * from sidekick_settings;\nselect * from default_activity_types;\n\nSELECT * FROM contacts WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\nSELECT * FROM leads WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\n\nSELECT * FROM activity_searches where user_id = 143;\nSELECT * FROM groups where team_id = 1;\n\nselect * from teams where id = 1;\nselect * from groups where team_id = 1; # 1150 - 7e75f8025c22\nselect id, name, group_id, status, deleted_at, email\nfrom users where team_id = 1 order by group_id desc ;\n\nselect * from activity_searches where id in (1977, 1978, 1979);\nselect * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);\nselect * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277\nselect * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879\n\nINSERT INTO `activity_search_filters`\n(`activity_search_id`, `filter`, `value`) VALUES\n(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')\n;\n\nselect * from crm_configurations where id = 39;\n\n\nselect sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id\nwhere u.team_id = 1;\nSELECT * FROM social_accounts WHERE sociable_id = 1635;\nSELECT * FROM users WHERE id = 1635;\n\nselect * from teams where id = 1;\nselect * from users where team_id = 1;\nselect * from team_features where team_id = 1;\nselect * from features;\n\nSELECT * FROM activity_searches where id = 1982; # 1981\nSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;\n\nSELECT * FROM automated_reports where id = 68;\nUPDATE automated_reports set playbook_categories = NULL where id = 68;\nSELECT * FROM automated_report_results where id = 275;\n\nSELECT * FROM automated_reports order by id desc;\nSELECT * FROM automated_report_results order by id desc;\nselect * from activity_searches where user_id = 143;\nselect * from ask_anything_prompts;\n\nSELECT * FROM groups WHERE id = 1439;\nSELECT * FROM users WHERE group_id = 1439;\n\nselect * from permissions; # 158\nselect * from roles;\nselect * from permission_role\n\nselect * from teams where id = 1;\nselect * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;\nselect * from groups where id = 28;\nselect * from playbooks where team_id = 1;\nselect * from playbooks where id = 179;\nselect * from playbook_categories where id = 1391;\nselect * from users where id = 143;\nselect * from crm_profiles where user_id = 143;\nselect * from activities where crm_configuration_id = 39 and type = 'conference'\nand crm_provider_id IS NOT NULL ORDER by id desc;\nselect * from activities where id = 422003; # 00UO400000pB6fpMAC\n\nSELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type\nFROM automated_report_results ar\nJOIN automated_reports a ON a.id = ar.report_id\nWHERE a.type = 'ask_jiminny'\nLIMIT 10;\n\nSELECT `automated_report_results`.* FROM `automated_report_results`\nINNER JOIN `automated_reports`\n ON `automated_report_results`.`report_id` = `automated_reports`.`id`\nWHERE `automated_report_results`.`generated_at` IS NOT NULL\n AND `automated_reports`.`team_id` = 1\n AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$.\"users\"')\n;\n\n\nselect * from teams where id = 3143;\nselect * from crm_configurations where id = 500;\nselect * from users where name = 'Integration Account'; # 1695\nSELECT * FROM social_accounts WHERE sociable_id = 1695;\n\nselect * from activities where crm_configuration_id = 39\nand recording_state = 'recorded' and duration > 60\nand status = 'completed' and actual_start_time >= '2025-12-01';\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;\n\nselect * from leads;","depth":4,"value":"SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o\nJOIN activities a ON o.id = a.opportunity_id\nWHERE a.crm_configuration_id = 39\nAND a.actual_start_time > '2025-10-13'\nAND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM activities\nWHERE crm_configuration_id = 39 and user_id = 143\nand actual_start_time >= '2025-10-13'\nAND type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM opportunities WHERE account_id IN (178);\nselect * from activities where id IN (620137, 620187, 620188, 620189, 620230);\n\n# HS\nSELECT * FROM opportunities WHERE id IN (238);\nselect * from activities where id IN (477,2076);\n\nselect * from users;\n\nSELECT COUNT(*) FROM users;\nSELECT COUNT(*) FROM activities;\nSELECT COUNT(*) FROM opportunities;\n\nUPDATE activities\nSET\n actual_start_time = '2025-12-19 09:00:00',\n actual_end_time = '2025-12-19 10:30:00',\n scheduled_start_time = '2025-12-19 09:00:00',\n scheduled_end_time = '2025-12-19 10:30:00'\nWHERE id IN (407509,407375);\n\nselect * from partners;\n\nSELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id\nFROM activities\nWHERE user_id = 143\nAND actual_start_time >= '2025-10-13 00:00:00'\nAND actual_start_time <= '2026-01-13 23:59:59'\nORDER BY actual_start_time DESC;\n\nSELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;\nSELECT * FROM crm_layouts where crm_configuration_id = 39;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;\n# lead_id\n# account_id 177\n# contact_id 3969\n# opportunity_id\n# stage_id 203\n\nSELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;\n\nSELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'\nAND user_id = 143 and actual_start_time >= '2025-10-13';\n\nSELECT * FROM activities a\n# JOIN opportunities o ON a.opportunity_id = o.id\nWHERE a.crm_configuration_id = 39 AND a.type = 'conference'\nand status = 'completed' and recording_state = 'recorded'\nand a.actual_start_time >= '2025-10-13'\nAND a.user_id = 143\n;\n\nselect * from leads\nwhere crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707\n\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310);\nSELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198\nSELECT * FROM activities WHERE id IN (356001, 356008); # contacts:\n\nSELECT * FROM opportunities WHERE id IN (1707);\nSELECT * FROM stages where id IN (204, 198);\nSELECT * FROM opportunities WHERE account_id IN (178);\nSELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';\nSELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal\n\nSELECT * FROM activities where crm_configuration_id = 39\nAND opportunity_id IS NULL\nAND is_internal = false\nand status = 'completed' and recording_state = 'recorded'\nAND actual_start_time >= '2025-10-13'\nAND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)\n# AND lead_id IN (112, 109)\n;\n\nSELECT * FROM crm_profiles WHERE user_id = 143;\n\nselect * from inboxes; # 212\nselect * from users where id = 143; # 143\nselect * from inbox_email_batches where inbox_id = 212\nand updated_at >= '2026-01-28 00:00:00' order by id desc;\nselect * from inbox_emails where inbox_id = 212\nand batch_id = 95885 order by id desc;\nselect * from email_messages where origin_user_id = 143;\nselect * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';\nselect * from participants where activity_id = 620247;\n\nselect * from crm_profiles where user_id = 143;\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001\nselect * from transcription where activity_id = 356001; # 6943\nselect * from ai_prompts where transcription_id = 6943;\nSELECT * FROM activity_summary_logs where activity_id = 356001;\n\nSELECT * FROM social_accounts WHERE sociable_id = 143;\n\n# ************************************************************************************\nSELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;\n# 422515 softphone tr. 8100\n\nSELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;\n# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS\n\nselect * from ai_prompts where transcription_id IN (8100, 7670);\nselect * from activity_summary_logs where activity_id = 407509;\n\nselect * from sidekick_settings;\nselect * from default_activity_types;\n\nSELECT * FROM contacts WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\nSELECT * FROM leads WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\n\nSELECT * FROM activity_searches where user_id = 143;\nSELECT * FROM groups where team_id = 1;\n\nselect * from teams where id = 1;\nselect * from groups where team_id = 1; # 1150 - 7e75f8025c22\nselect id, name, group_id, status, deleted_at, email\nfrom users where team_id = 1 order by group_id desc ;\n\nselect * from activity_searches where id in (1977, 1978, 1979);\nselect * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);\nselect * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277\nselect * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879\n\nINSERT INTO `activity_search_filters`\n(`activity_search_id`, `filter`, `value`) VALUES\n(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')\n;\n\nselect * from crm_configurations where id = 39;\n\n\nselect sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id\nwhere u.team_id = 1;\nSELECT * FROM social_accounts WHERE sociable_id = 1635;\nSELECT * FROM users WHERE id = 1635;\n\nselect * from teams where id = 1;\nselect * from users where team_id = 1;\nselect * from team_features where team_id = 1;\nselect * from features;\n\nSELECT * FROM activity_searches where id = 1982; # 1981\nSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;\n\nSELECT * FROM automated_reports where id = 68;\nUPDATE automated_reports set playbook_categories = NULL where id = 68;\nSELECT * FROM automated_report_results where id = 275;\n\nSELECT * FROM automated_reports order by id desc;\nSELECT * FROM automated_report_results order by id desc;\nselect * from activity_searches where user_id = 143;\nselect * from ask_anything_prompts;\n\nSELECT * FROM groups WHERE id = 1439;\nSELECT * FROM users WHERE group_id = 1439;\n\nselect * from permissions; # 158\nselect * from roles;\nselect * from permission_role\n\nselect * from teams where id = 1;\nselect * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;\nselect * from groups where id = 28;\nselect * from playbooks where team_id = 1;\nselect * from playbooks where id = 179;\nselect * from playbook_categories where id = 1391;\nselect * from users where id = 143;\nselect * from crm_profiles where user_id = 143;\nselect * from activities where crm_configuration_id = 39 and type = 'conference'\nand crm_provider_id IS NOT NULL ORDER by id desc;\nselect * from activities where id = 422003; # 00UO400000pB6fpMAC\n\nSELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type\nFROM automated_report_results ar\nJOIN automated_reports a ON a.id = ar.report_id\nWHERE a.type = 'ask_jiminny'\nLIMIT 10;\n\nSELECT `automated_report_results`.* FROM `automated_report_results`\nINNER JOIN `automated_reports`\n ON `automated_report_results`.`report_id` = `automated_reports`.`id`\nWHERE `automated_report_results`.`generated_at` IS NOT NULL\n AND `automated_reports`.`team_id` = 1\n AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$.\"users\"')\n;\n\n\nselect * from teams where id = 3143;\nselect * from crm_configurations where id = 500;\nselect * from users where name = 'Integration Account'; # 1695\nSELECT * FROM social_accounts WHERE sociable_id = 1695;\n\nselect * from activities where crm_configuration_id = 39\nand recording_state = 'recorded' and duration > 60\nand status = 'completed' and actual_start_time >= '2025-12-01';\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;\n\nselect * from leads;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"bounds":{"left":0.011968086,"top":0.047885075,"width":0.024268618,"height":0.024740623},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-3163136488953525261
|
1126710648141684156
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsRepositoryTest
Run 'AutomatedReportsRepositoryTest'
Debug 'AutomatedReportsRepositoryTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
3
102
3
34
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Kiosk\AutomatedReports;
use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Carbon\Exceptions\InvalidFormatException;
use DateTime;
use DateTimeInterface;
use DateTimeZone;
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcher;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Jiminny\Component\ActivitySearch\FilterDefinition\InputTypeEnum;
use Jiminny\Component\AskAnything\AskAnythingPromptService;
use Jiminny\Component\AskAnything\Dtos\AskAnythingPromptDto;
use Jiminny\Component\UrlGenerator\Webhook;
use Jiminny\Contracts\Repositories\PlaybookCategoryRepository;
use Jiminny\Contracts\Repositories\TeamRepository;
use Jiminny\Contracts\Repositories\UserRepository;
use Jiminny\Exceptions\ApplicationException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Exceptions\ModelNotFoundException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateReportJob;
use Jiminny\Models\Activity\Search;
use Jiminny\Models\AskAnything\AskAnythingPrompt;
use Jiminny\Models\AskAnything\AskAnythingPromptTarget;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Contracts\UserContract;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AskAnythingRepository;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Repositories\GroupRepository;
use Jiminny\Repositories\SearchRepository;
use Jiminny\Repositories\StageRepository;
use Throwable;
class AutomatedReportsService
{
public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';
public const string TYPE_ASK_JIMINNY = 'ask_jiminny';
/**
* Standard report types (used by kiosk for existing automated reports).
*/
// @TODO this will add filter, however if we need to control feature by FF we need conditional logic
public const array TYPES = [
['id' => 'exec_summary', 'name' => 'Exec Summary'],
['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],
['id' => 'product_feedback', 'name' => 'Product Feedback'],
['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],
// ['id' => 'questions', 'name' => 'Questions'],
// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],
];
public const array ALL_TYPES = [
...self::TYPES,
['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],
];
public const string FREQUENCY_DAILY = 'daily';
public const string FREQUENCY_WEEKLY = 'weekly';
public const string FREQUENCY_MONTHLY = 'monthly';
public const string FREQUENCY_QUARTERLY = 'quarterly';
public const string FREQUENCY_ONE_OFF = 'one_off';
/**
* Frequencies for standard (non-Ask Jiminny) reports.
*/
public const array FREQUENCIES = [
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
/**
* Frequencies for Ask Jiminny reports.
*/
public const array ASK_JIMINNY_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
];
public const string MEDIA_TYPE_PDF = 'pdf';
public const string MEDIA_TYPE_PODCAST = 'podcast';
public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];
public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];
public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];
public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];
public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];
public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];
public const int SENT_REPORT_AT_HOURS = 5;
public const string PDF_KEY = 'pdf';
public const string AUDIO_KEY = 'audio';
private const array ALL_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
private const string S3_DIR = 'reports';
private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];
private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];
public function __construct(
private readonly TeamRepository $teamRepository,
private readonly GroupRepository $groupRepository,
private readonly UserRepository $userRepository,
private readonly StageRepository $stageRepository,
private readonly DealStagesService $dealStagesService,
private readonly RecipientsService $recipientsService,
private readonly AutomatedReportsRepository $automatedReportsRepository,
private readonly Webhook $webhookService,
private readonly BusDispatcher $dispatcher,
private readonly ActivityTypeService $activityTypeService,
private readonly PlaybookCategoryRepository $playbookCategoryRepository,
private readonly AskAnythingPromptService $askAnythingPromptService,
private readonly SearchRepository $activitySearchRepository,
private readonly AskAnythingRepository $askAnythingRepository,
) {
}
public static function getTypes(): array
{
$types = self::TYPES;
return array_map(static function ($type) {
return $type['id'];
}, $types);
}
public static function getCallTypes(): array
{
return array_map(static function ($callType) {
return $callType['id'];
}, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);
}
public static function getFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::FREQUENCIES);
}
// front-facing structure
public function getReportEnabledFieldData(bool $value = false): array
{
return [
'id' => 'report_enabled',
'label' => '',
'inputType' => InputTypeEnum::TOGGLE,
'value' => $value,
];
}
// Organizations = Teams
public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array
{
$options = $this->getTeams();
if ($shortVersion) {
return [
'id' => 'organization',
'label' => 'Organization',
'options' => $options,
];
}
return [
'id' => 'organization',
'label' => 'Organization',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $options,
'value' => $value,
'dependencies' => [
'teams',
'deal_stage_at_call',
'current_deal_stage',
'recipients',
ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,
],
'dependsOn' => [],
];
}
// Teams = Groups
public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array
{
if ($shortVersion) {
return [
'id' => 'teams',
'label' => 'Team',
'options' => $options,
];
}
return [
'id' => 'teams',
'label' => 'Team',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => false,
'placeholder' => 'Select',
'options' => $options,
'value' => $value, // value should be an array of objects {id, name}
'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],
'dependsOn' => [],
];
}
public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array
{
$types = [];
if ($team instanceof Team) {
if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
$types = self::TYPES;
}
if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {
$types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];
}
} else {
$types = self::TYPES;
}
if ($shortVersion) {
return [
'id' => 'report_type',
'label' => 'Report Type',
'options' => $types,
];
}
return [
'id' => 'report_type',
'label' => 'Report Type',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $types,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getFrequencyFieldData(?string $value = null): array
{
return [
'id' => 'frequency',
'label' => 'Frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => self::FREQUENCIES,
'value' => $value,
'dependencies' => ['period'],
'dependsOn' => [],
];
}
public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array
{
return [
'id' => 'period',
'label' => 'Select one-off period',
'inputType' => InputTypeEnum::DATE_RANGE,
'required' => true,
'placeholder' => 'Select',
'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],
'queryParams' => [
'startDate' => 'start_date_period',
'endDate' => 'end_date_period',
],
'dependencies' => [],
'dependsOn' => ['frequency'],
];
}
public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array
{
return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);
}
public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);
}
public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);
}
public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'deal_value',
'label' => 'Deal Value',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_deal_value',
'max' => 'max_deal_value',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array
{
$value = [];
$conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;
$dialerOn && $value[] = self::CALL_TYPE_DIALER;
return [
'id' => 'call_type',
'label' => 'Call Type',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => [
self::CALL_TYPE_CONFERENCE,
self::CALL_TYPE_DIALER,
],
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getMediaTypeFieldData(?AutomatedReport $report = null): array
{
$value = [];
if ($report) {
$value = $this->transformMediaTypes($report);
}
return [
'id' => 'media_types',
'label' => 'Export as',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => self::MEDIA_TYPE_OBJECTS,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'call_duration',
'label' => 'Call Duration',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_call_duration',
'max' => 'max_call_duration',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getRecipientsFieldData(?Team $team = null, array $value = []): array
{
return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);
}
public function getJiminnyRecipientsFieldData(array $value = []): array
{
return $this->recipientsService->getJiminnyRecipientsFieldData($value);
}
public function getAdditionalPromptInputFieldData(?string $value = null): array
{
return [
'id' => 'additional_prompt_input',
'label' => 'Special requirements',
'inputType' => InputTypeEnum::TEXTAREA,
'required' => false,
'placeholder' => 'What should be the focus of the report?',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCustomReportNameFieldData(?string $value = null): array
{
return [
'id' => 'custom_name',
'label' => 'Custom report name',
'inputType' => InputTypeEnum::TEXT,
'required' => false,
'placeholder' => 'Enter custom name',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
// data providers
public function getTeams(): array
{
$teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);
$teamData = [];
foreach ($teams as $team) {
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
continue;
}
$teamData[] = $this->transformTeam($team);
}
return $teamData;
}
public function getTeamGroups(string $teamUuid): array
{
$data = [];
$team = $this->getTeam($teamUuid);
if ($team !== null) {
$groups = $team->groups()->get();
foreach ($groups as $group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
];
}
}
return $data;
}
public function getTeamsGroupsOptions(array $filterTeamUuids = []): array
{
$data = [];
$teams = $this->getTeams();
foreach ($teams as $team) {
if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {
continue;
}
$data[] = [
'label' => $team['name'],
'groups' => $this->getTeamGroups($team['id']),
];
}
return $data;
}
public function getTeam(string $teamUuid): ?Team
{
return $this->teamRepository->idOrUuid($teamUuid);
}
public function getTeamById(int $teamId): ?Team
{
return $this->teamRepository->find($teamId);
}
public function getGroupsUuids(AutomatedReport $report): array
{
$uuids = [];
$reportGroups = $report->getGroups();
foreach ($reportGroups as $groupId) {
if ($group = $this->groupRepository->find($groupId)) {
$uuids[] = $group->getUuid();
}
}
return $uuids;
}
public function getPlaybookCategoriesUuids(AutomatedReport $report): array
{
$uuids = [];
$playbookCategories = $report->getPlaybookCategories();
foreach ($playbookCategories as $id) {
if ($category = $this->playbookCategoryRepository->find($id)) {
$uuids[] = $category->getUuid();
}
}
return $uuids;
}
public function getDealAtCallStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getDealAtCallStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getCurrentDealStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getCurrentDealStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getRecipients());
}
public function getJiminnyUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function extractUserUuids(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => $user->getUuid())
->values()
->all();
}
// get mail data
public function getRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getRecipients());
}
/**
* @return array<UserContract>
*/
public function getRecipientUserObjects(AutomatedReport $report): array
{
$userIds = $report->getRecipients()['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->values()
->all();
}
private function getJiminnyRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function buildRecipientUsers(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => [
'email' => $user->getEmailAddress(),
'name' => $user->getName(),
'timezone' => $user->getTimezone()->getName(),
])
->values()
->all();
}
public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array
{
if ($report->isAskJiminnyReport()) {
$recipients = $this->resolveAskJiminnyRecipients($report);
} else {
$recipients = $this->getRecipientUsers($report);
if ($includeJiminny) {
$recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));
}
}
$emails = [];
return array_values(array_filter(
$recipients,
static function ($recipient) use (&$emails) {
if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {
return false;
}
$emails[] = $recipient['email'];
return true;
}
));
}
private function resolveAskJiminnyRecipients(AutomatedReport $report): array
{
$recipients = [];
$creator = $report->getCreator();
if ($creator !== null) {
$recipients[] = [
'email' => $creator->getEmailAddress(),
'name' => $creator->getName(),
'timezone' => $creator->getTimezone()->getName(),
];
}
return array_merge(
$recipients,
$this->buildRecipientUsers($report->getRecipients()),
$this->getGroupRecipientUsers($report),
);
}
private function getGroupRecipientUsers(AutomatedReport $report): array
{
$users = [];
foreach ($report->getGroups() as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group === null) {
continue;
}
foreach ($group->getMembers() as $member) {
$users[] = [
'email' => $member->getEmailAddress(),
'name' => $member->getName(),
'timezone' => $member->getTimezone()->getName(),
];
}
}
return $users;
}
public function getReportTypeName(AutomatedReportResult $report): string
{
$type = $report->getReport()->getType();
$getType = $this->transformReportType($type);
return $getType['name'];
}
public function getReportPeriodName(AutomatedReportResult $report): string
{
$from = $report->getFromDate();
$to = $report->getToDate();
$frequency = $report->getReport()->getFrequency();
if ($from === null || $to === null) {
if (! $report->getReport()->isAskJiminnyReport()) {
$invalidPeriod = $from === null ? 'from' : 'to';
throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);
}
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
}
return $this->formatReportPeriodName($frequency, $from, $to);
}
private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string
{
$fromYear = $from->format('Y');
$toYear = $to->format('Y');
$differentYears = $fromYear !== $toYear;
switch ($frequency) {
case self::FREQUENCY_DAILY:
return $from->format('j M Y');
case self::FREQUENCY_QUARTERLY:
// 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ
$startMonth = $from->format('M');
$endMonth = $to->copy()->subMonth();
$endMonthName = $endMonth->format('M');
$endMonthYear = $endMonth->format('Y');
if ($differentYears) {
return "{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}";
}
return "{$startMonth} - {$endMonthName} {$toYear}";
case self::FREQUENCY_MONTHLY:
// 'May 2025' - monthly reports are always within the same year
return $from->format('M Y');
case self::FREQUENCY_WEEKLY:
// '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ
$startDay = $from->format('j');
$endDay = $to->format('j');
$startMonth = $from->format('M');
$endMonth = $to->format('M');
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
if ($startMonth !== $endMonth) {
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
}
return "{$startDay} - {$endDay} {$endMonth} {$toYear}";
case self::FREQUENCY_ONE_OFF:
// '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ
$startDay = $from->format('j');
$startMonth = $from->format('M');
$endDay = $to->format('j');
$endMonth = $to->format('M');
// If same month and year, use a format like '2-31 May 2025'
if ($startMonth === $endMonth && ! $differentYears) {
return "{$startDay} - {$endDay} {$startMonth} {$toYear}";
}
// If different years, include both years
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
// Same year but different months
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
default:
// Default format for unknown frequencies
return $from->format('j M Y') . ' - ' . $to->format('j M Y');
}
}
public function getReportTeamsName(AutomatedReportResult $report): string
{
$groups = $report->getGroups();
if (empty($groups)) {
return 'All';
}
// Get group names from repository
$groupNames = [];
foreach ($groups as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group) {
$groupNames[] = $group->getName();
}
}
if (count($groupNames) === 1) {
// Single team format
$teamsName = $groupNames[0];
} else {
// Multiple teams format
$teamsName = implode(', ', $groupNames);
}
return $teamsName;
}
public function getReportFileName(AutomatedReportResult $report): string
{
$customName = $report->getReport()->getCustomName();
$periodName = $this->getReportPeriodName($report);
$filenameSuffix = $this->getFilenameSuffix($report);
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$customName} - {$periodName}");
}
$baseName = $this->getReportTypeName($report);
if ($filenameSuffix) {
$baseName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}");
}
public function getReportFileNameWithExtension(AutomatedReportResult $result): string
{
$extension = $this->getMediaTypeMetadata($result)['extension'];
return $this->getReportFileName($result) . '.' . $extension;
}
public function sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool
{
$recipients = array_map('intval', $report->getRecipients()['users'] ?? []);
return in_array($user->getId(), $recipients);
}
public function transformReportResults(Collection $automatedReportResults): array
{
$data = [];
foreach ($automatedReportResults as $automatedReportResult) {
/** @var AutomatedReportResult $automatedReportResult */
$report = $automatedReportResult->getReport();
$createdBy = $report->getCreator();
$creator = [
'id' => $createdBy?->getUuid(),
'name' => $createdBy?->getName(),
'email' => $createdBy?->getEmailAddress(),
'photoUrl' => $createdBy?->getPhotoUrl(),
];
$recipients = $this->buildRecipients($report);
$data[] = [
'id' => $automatedReportResult->getUuid(),
'name' => $automatedReportResult->getName(),
'frequency' => $this->transformFrequency($report->getFrequency()),
'recipients' => $recipients,
'recipients' => [
...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),
...array_values($this->transformRecipients($report->getRecipients())),
],
'report_type' => $this->transformReportType($report->getType()),
'media_type' => $automatedReportResult->getMediaType(),
'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),
'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),
'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),
'creator' => $creator,
];
}
return $data;
}
private function buildRecipients(AutomatedReport $report)
{
}
public function hasCallTypeConference(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);
}
public function hasCallTypeDialer(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);
}
// transformers
private function transformTeam(Team $team): array
{
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
return [];
}
return [
'id' => $team->getUuid(),
'name' => $team->getName(),
];
}
private function transformReportFullView(AutomatedReport $report): array
{
$base = $this->transformReportBase($report);
return $report->getType() === self::TYPE_ASK_JIMINNY
? $base + $this->transformAskJiminnyFields($report)
: $base + $this->transformStandardReportFields($report);
}
private function transformReportBase(AutomatedReport $report): array
{
return [
'id' => $report->getUuid(),
'organization' => $this->transformOrganization(team: $report->getTeam()),
'report_type' => $this->transformReportType($report->getType()),
'frequency' => $this->transformFrequency($report->getFrequency()),
];
}
private function transformStandardReportFields(AutomatedReport $report): array
{
$team = $report->getTeam();
return [
'report_enabled' => $report->getStatus(),
'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),
'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),
'deal_value_min' => $report->getDealValueMin(),
'deal_value_max' => $report->getDealValueMax(),
'call_types' => $this->transformCallType($report->getCallTypes()),
'media_types' => $this->transformMediaTypes($report),
'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),
'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),
'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),
'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),
'recipients' => $this->transformRecipients($report->getRecipients()),
'created_by' => $this->transformCreator($report->getCreator()),
'additional_prompt_input' => $report->getAdditionalPromptInput(),
'custom_name' => $report->getCustomName(),
'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),
'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),
'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),
];
}
private function transformAskJiminnyFields(AutomatedReport $report): array
{
$team = $report->getTeam();
$creatorId = $report->getAttribute('created_by');
$explicitUserIds = array_values(array_filter(
$report->getRecipients()['users'] ?? [],
static fn ($id) => $id !== $creatorId
));
return [
'report_name' => $report->getCustomName(),
'enabled' => $report->getStatus(),
'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),
'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),
'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),
'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),
];
}
private function transformOrganization(?Team $team): array
{
return [
'id' => $team?->getUuid(),
'name' => $team?->getName(),
];
}
private function transformReportType(string $type): array
{
foreach (self::ALL_TYPES as $typeItem) {
if ($typeItem['id'] === $type) {
return $typeItem;
}
}
return [];
}
private function transformCallType(array $types): array
{
$result = [];
$callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];
foreach ($types as $type) {
foreach ($callTypes as $callTypeItem) {
if ($callTypeItem['id'] === $type) {
$result[] = $callTypeItem;
break;
}
}
}
return $result;
}
private function transformMediaTypes(AutomatedReport $report): array
{
$values = [];
foreach ($report->getMediaTypes() as $mediaType) {
if (! in_array($mediaType, self::MEDIA_TYPES, true)) {
continue;
}
$values[] = match ($mediaType) {
self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,
self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,
};
}
return $values;
}
private function transformFrequency(string $frequency): array
{
foreach (self::ALL_FREQUENCIES as $frequencyItem) {
if ($frequencyItem['id'] === $frequency) {
return $frequencyItem;
}
}
return [];
}
public function transformDurationToMinutes(?int $duration): ?int
{
if (! $duration) {
return null;
}
return (int) ($duration / 60);
}
private function transformGroups(?Team $team, array $groupsIds): array
{
if (empty($groupsIds) || ! $team) {
return [];
}
$data = [];
foreach ($groupsIds as $groupId) {
$group = $team->groups()->where('id', $groupId)->first();
if ($group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
'photoUrl' => $group->getPhotoUrl(),
];
}
}
return $data;
}
private function transformStages(?Team $team, array $stagesIds): array
{
if (empty($stagesIds) || ! $team) {
return [];
}
$data = [];
foreach ($stagesIds as $stageId) {
$stage = $team->stages()->where('id', $stageId)->first();
if ($stage) {
$data[] = [
'id' => $stage->getUuid(),
'name' => $stage->getName(),
];
}
}
return $data;
}
private function transformRecipients(array $recipients): array
{
$users = [];
foreach ($recipients['users'] ?? [] as $userId) {
$users[] = $this->transformUser($userId);
}
return $users;
}
private function transformCreator(?User $user): ?array
{
if ($user === null) {
return null;
}
return $this->transformUser($user->getId());
}
private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array
{
if ($prompt === null) {
return null;
}
return [
'id' => $prompt->getUuid(),
'name' => $prompt->getTitle(),
];
}
private function transformSafeSearch(?Search $search): ?array
{
if ($search === null) {
return null;
}
return [
'id' => $search->getUuid(),
'name' => $search->getName(),
];
}
private function transformUser(int $userId): array
{
/* @var ?User $user */
$user = $this->userRepository->find($userId);
return [
'id' => $user?->getUuid(),
'name' => $user?->getName(),
'email' => $user?->getEmailAddress(),
'photoUrl' => $user?->getPhotoUrl(),
];
}
public function create(array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$validatedData['created_by'] = auth()->id();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
public function update(string $uuid, array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$report = $this->automatedReportsRepository->findByUuid($uuid);
if (! $report) {
throw new InvalidArgumentException('Report not found');
}
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
/**
* Create an Ask Jiminny report.
*/
public function createAskJiminnyReport(array $data, User $creator): array
{
$validatedData = $this->validateAskJiminnyReportData($data, $creator);
$validatedData['created_by'] = $creator->getId();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
return $this->transformReportFullView($automatedReport);
}
/**
* Update an Ask Jiminny report.
*/
public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array
{
if (! $report->isAskJiminnyReport()) {
throw new InvalidArgumentException('Report is not an Ask Jiminny report');
}
$validatedData = $this->validateAskJiminnyReportData($data, $user);
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
return $this->transformReportFullView($automatedReport);
}
public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array
{
$this->automatedReportsRepository->update($report, ['status' => $status]);
return $this->transformReportFullView($report->fresh());
}
/**
* Validate and transform data for Ask Jiminny reports.
*/
private function validateAskJiminnyReportData(array $data, User $user): array
{
// Validate name
$name = trim($data['report_name'] ?? '');
if (empty($name)) {
throw new InvalidArgumentException('Report name is required');
}
if (mb_strlen($name) > 50) {
throw new InvalidArgumentException('Report name must be 50 characters or less');
}
// Validate frequency (only daily, weekly, monthly for Ask Jiminny)
$frequency = $data['frequency'] ?? null;
$askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];
if (! in_array($frequency, $askJiminnyFrequencies, true)) {
throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');
}
// Validate expiration date
$expiresAt = $data['expires_on'] ?? null;
if (empty($expiresAt)) {
throw new InvalidArgumentException('Expiration date is required');
}
try {
$expiresAtDate = Carbon::parse($expiresAt);
} catch (InvalidFormatException $e) {
throw new InvalidArgumentException('Expiration date format is invalid');
}
$maxExpiration = Carbon::now()->addYear()->endOfDay();
if ($expiresAtDate->gt($maxExpiration)) {
throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');
}
if ($expiresAtDate->isPast()) {
throw new InvalidArgumentException('Expiration date cannot be in the past');
}
// Validate saved search
$activitySearchId = $data['saved_search'] ?? null;
if (empty($activitySearchId)) {
throw new InvalidArgumentException('Saved search is required');
}
$savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);
if (! $savedSearch) {
throw new InvalidArgumentException('Saved search not found or does not belong to you');
}
// Validate saved prompt
$askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;
if (empty($askAnythingPromptId)) {
throw new InvalidArgumentException('Ask Jiminny prompt is required');
}
$prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);
if (! $prompt) {
throw new InvalidArgumentException('Ask Jiminny prompt not found');
}
// Validate status
$status = $data['enabled'] ?? false;
$recipientUserIds = [$user->getId()];
if (! empty($data['share_users'])) {
$sharedUserIds = $this->validateAndGetUserIdsByTeam(
$user->team,
(array) $data['share_users']
);
$recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);
}
$sharedGroupIds = [];
if (! empty($data['share_teams'])) {
$sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);
}
$recipientUserIds = array_values(array_unique($recipientUserIds));
return [
'team_id' => $user->getTeamId(),
'type' => self::TYPE_ASK_JIMINNY,
'status' => (bool) $status,
'frequency' => $frequency,
'custom_name' => $name,
'activity_search_id' => $savedSearch->getId(),
'ask_anything_prompt_id' => $prompt->getId(),
'expires_at' => $expiresAtDate->toDateString(),
'media_types' => [self::MEDIA_TYPE_PDF],
'call_types' => [],
'recipients' => ['users' => $recipientUserIds],
'groups' => $sharedGroupIds,
];
}
public static function getAskJiminnyFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::ASK_JIMINNY_FREQUENCIES);
}
public function getAskJiminnyReportFilters(User $user): array
{
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
return [
[
'id' => 'prompt',
'label' => 'Prompt',
'options' => $prompts,
],
[
'id' => 'saved_search',
'label' => 'Saved Search',
'options' => $savedSearches,
],
];
}
public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array
{
$team = $user->getTeam();
$userTimezone = $user->getTimezone();
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
$teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [
'id' => $group->getUuid(),
'name' => $group->getName(),
])->values()->all();
$shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];
$sharedTeamsValue = [];
$sharedUsersValue = [];
if ($report) {
$sharedTeamsValue = $this->transformGroups($team, $report->getGroups());
$recipientUserIds = $report->getRecipients()['users'] ?? [];
$creatorId = $report->getAttribute('created_by');
$sharedUserIds = array_values(array_filter(
$recipientUserIds,
static fn ($id) => $id !== $creatorId
));
$sharedUsersValue = collect($sharedUserIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (User $u) => [
'id' => $u->getUuid(),
'name' => $u->getName(),
])
->values()
->all();
}
return [
'fields' => [
[
'id' => 'enabled',
'inputType' => InputTypeEnum::TOGGLE,
'label' => '',
'value' => $report?->getStatus() ?? false,
],
[
'id' => 'report_name',
'inputType' => InputTypeEnum::TEXT,
'label' => 'Name',
'placeholder' => 'Enter name',
'required' => true,
'validation' => ['maxLength' => 50],
'value' => $report?->getCustomName() ?? '',
],
[
'id' => 'frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'label' => 'Frequency',
'required' => true,
'placeholder' => 'Select',
'options' => self::ASK_JIMINNY_FREQUENCIES,
'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,
],
[
'id' => 'expires_on',
'inputType' => InputTypeEnum::DATE,
'label' => 'Expires on',
'required' => true,
'placeholder' => 'Select',
'validation' => [
'minDate' => now($userTimezone)->toDateString(),
'maxDate' => now($userTimezone)->addYear()->toDateString(),
],
'value' => $report?->getExpiresAt()?->toDateString(),
],
[
...
|
66589
|
|
66592
|
1497
|
0
|
2026-04-21T14:49:02.090429+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776782942090_m1.jpg...
|
PhpStorm
|
faVsco.js – AutomatedReportsService.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsRepositoryTest
Run 'AutomatedReportsRepositoryTest'
Debug 'AutomatedReportsRepositoryTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
3
102
3
34
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Kiosk\AutomatedReports;
use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Carbon\Exceptions\InvalidFormatException;
use DateTime;
use DateTimeInterface;
use DateTimeZone;
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcher;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Jiminny\Component\ActivitySearch\FilterDefinition\InputTypeEnum;
use Jiminny\Component\AskAnything\AskAnythingPromptService;
use Jiminny\Component\AskAnything\Dtos\AskAnythingPromptDto;
use Jiminny\Component\UrlGenerator\Webhook;
use Jiminny\Contracts\Repositories\PlaybookCategoryRepository;
use Jiminny\Contracts\Repositories\TeamRepository;
use Jiminny\Contracts\Repositories\UserRepository;
use Jiminny\Exceptions\ApplicationException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Exceptions\ModelNotFoundException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateReportJob;
use Jiminny\Models\Activity\Search;
use Jiminny\Models\AskAnything\AskAnythingPrompt;
use Jiminny\Models\AskAnything\AskAnythingPromptTarget;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Contracts\UserContract;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AskAnythingRepository;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Repositories\GroupRepository;
use Jiminny\Repositories\SearchRepository;
use Jiminny\Repositories\StageRepository;
use Throwable;
class AutomatedReportsService
{
public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';
public const string TYPE_ASK_JIMINNY = 'ask_jiminny';
/**
* Standard report types (used by kiosk for existing automated reports).
*/
// @TODO this will add filter, however if we need to control feature by FF we need conditional logic
public const array TYPES = [
['id' => 'exec_summary', 'name' => 'Exec Summary'],
['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],
['id' => 'product_feedback', 'name' => 'Product Feedback'],
['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],
// ['id' => 'questions', 'name' => 'Questions'],
// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],
];
public const array ALL_TYPES = [
...self::TYPES,
['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],
];
public const string FREQUENCY_DAILY = 'daily';
public const string FREQUENCY_WEEKLY = 'weekly';
public const string FREQUENCY_MONTHLY = 'monthly';
public const string FREQUENCY_QUARTERLY = 'quarterly';
public const string FREQUENCY_ONE_OFF = 'one_off';
/**
* Frequencies for standard (non-Ask Jiminny) reports.
*/
public const array FREQUENCIES = [
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
/**
* Frequencies for Ask Jiminny reports.
*/
public const array ASK_JIMINNY_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
];
public const string MEDIA_TYPE_PDF = 'pdf';
public const string MEDIA_TYPE_PODCAST = 'podcast';
public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];
public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];
public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];
public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];
public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];
public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];
public const int SENT_REPORT_AT_HOURS = 5;
public const string PDF_KEY = 'pdf';
public const string AUDIO_KEY = 'audio';
private const array ALL_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
private const string S3_DIR = 'reports';
private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];
private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];
public function __construct(
private readonly TeamRepository $teamRepository,
private readonly GroupRepository $groupRepository,
private readonly UserRepository $userRepository,
private readonly StageRepository $stageRepository,
private readonly DealStagesService $dealStagesService,
private readonly RecipientsService $recipientsService,
private readonly AutomatedReportsRepository $automatedReportsRepository,
private readonly Webhook $webhookService,
private readonly BusDispatcher $dispatcher,
private readonly ActivityTypeService $activityTypeService,
private readonly PlaybookCategoryRepository $playbookCategoryRepository,
private readonly AskAnythingPromptService $askAnythingPromptService,
private readonly SearchRepository $activitySearchRepository,
private readonly AskAnythingRepository $askAnythingRepository,
) {
}
public static function getTypes(): array
{
$types = self::TYPES;
return array_map(static function ($type) {
return $type['id'];
}, $types);
}
public static function getCallTypes(): array
{
return array_map(static function ($callType) {
return $callType['id'];
}, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);
}
public static function getFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::FREQUENCIES);
}
// front-facing structure
public function getReportEnabledFieldData(bool $value = false): array
{
return [
'id' => 'report_enabled',
'label' => '',
'inputType' => InputTypeEnum::TOGGLE,
'value' => $value,
];
}
// Organizations = Teams
public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array
{
$options = $this->getTeams();
if ($shortVersion) {
return [
'id' => 'organization',
'label' => 'Organization',
'options' => $options,
];
}
return [
'id' => 'organization',
'label' => 'Organization',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $options,
'value' => $value,
'dependencies' => [
'teams',
'deal_stage_at_call',
'current_deal_stage',
'recipients',
ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,
],
'dependsOn' => [],
];
}
// Teams = Groups
public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array
{
if ($shortVersion) {
return [
'id' => 'teams',
'label' => 'Team',
'options' => $options,
];
}
return [
'id' => 'teams',
'label' => 'Team',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => false,
'placeholder' => 'Select',
'options' => $options,
'value' => $value, // value should be an array of objects {id, name}
'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],
'dependsOn' => [],
];
}
public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array
{
$types = [];
if ($team instanceof Team) {
if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
$types = self::TYPES;
}
if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {
$types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];
}
} else {
$types = self::TYPES;
}
if ($shortVersion) {
return [
'id' => 'report_type',
'label' => 'Report Type',
'options' => $types,
];
}
return [
'id' => 'report_type',
'label' => 'Report Type',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $types,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getFrequencyFieldData(?string $value = null): array
{
return [
'id' => 'frequency',
'label' => 'Frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => self::FREQUENCIES,
'value' => $value,
'dependencies' => ['period'],
'dependsOn' => [],
];
}
public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array
{
return [
'id' => 'period',
'label' => 'Select one-off period',
'inputType' => InputTypeEnum::DATE_RANGE,
'required' => true,
'placeholder' => 'Select',
'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],
'queryParams' => [
'startDate' => 'start_date_period',
'endDate' => 'end_date_period',
],
'dependencies' => [],
'dependsOn' => ['frequency'],
];
}
public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array
{
return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);
}
public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);
}
public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);
}
public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'deal_value',
'label' => 'Deal Value',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_deal_value',
'max' => 'max_deal_value',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array
{
$value = [];
$conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;
$dialerOn && $value[] = self::CALL_TYPE_DIALER;
return [
'id' => 'call_type',
'label' => 'Call Type',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => [
self::CALL_TYPE_CONFERENCE,
self::CALL_TYPE_DIALER,
],
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getMediaTypeFieldData(?AutomatedReport $report = null): array
{
$value = [];
if ($report) {
$value = $this->transformMediaTypes($report);
}
return [
'id' => 'media_types',
'label' => 'Export as',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => self::MEDIA_TYPE_OBJECTS,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'call_duration',
'label' => 'Call Duration',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_call_duration',
'max' => 'max_call_duration',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getRecipientsFieldData(?Team $team = null, array $value = []): array
{
return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);
}
public function getJiminnyRecipientsFieldData(array $value = []): array
{
return $this->recipientsService->getJiminnyRecipientsFieldData($value);
}
public function getAdditionalPromptInputFieldData(?string $value = null): array
{
return [
'id' => 'additional_prompt_input',
'label' => 'Special requirements',
'inputType' => InputTypeEnum::TEXTAREA,
'required' => false,
'placeholder' => 'What should be the focus of the report?',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCustomReportNameFieldData(?string $value = null): array
{
return [
'id' => 'custom_name',
'label' => 'Custom report name',
'inputType' => InputTypeEnum::TEXT,
'required' => false,
'placeholder' => 'Enter custom name',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
// data providers
public function getTeams(): array
{
$teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);
$teamData = [];
foreach ($teams as $team) {
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
continue;
}
$teamData[] = $this->transformTeam($team);
}
return $teamData;
}
public function getTeamGroups(string $teamUuid): array
{
$data = [];
$team = $this->getTeam($teamUuid);
if ($team !== null) {
$groups = $team->groups()->get();
foreach ($groups as $group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
];
}
}
return $data;
}
public function getTeamsGroupsOptions(array $filterTeamUuids = []): array
{
$data = [];
$teams = $this->getTeams();
foreach ($teams as $team) {
if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {
continue;
}
$data[] = [
'label' => $team['name'],
'groups' => $this->getTeamGroups($team['id']),
];
}
return $data;
}
public function getTeam(string $teamUuid): ?Team
{
return $this->teamRepository->idOrUuid($teamUuid);
}
public function getTeamById(int $teamId): ?Team
{
return $this->teamRepository->find($teamId);
}
public function getGroupsUuids(AutomatedReport $report): array
{
$uuids = [];
$reportGroups = $report->getGroups();
foreach ($reportGroups as $groupId) {
if ($group = $this->groupRepository->find($groupId)) {
$uuids[] = $group->getUuid();
}
}
return $uuids;
}
public function getPlaybookCategoriesUuids(AutomatedReport $report): array
{
$uuids = [];
$playbookCategories = $report->getPlaybookCategories();
foreach ($playbookCategories as $id) {
if ($category = $this->playbookCategoryRepository->find($id)) {
$uuids[] = $category->getUuid();
}
}
return $uuids;
}
public function getDealAtCallStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getDealAtCallStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getCurrentDealStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getCurrentDealStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getRecipients());
}
public function getJiminnyUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function extractUserUuids(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => $user->getUuid())
->values()
->all();
}
// get mail data
public function getRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getRecipients());
}
/**
* @return array<UserContract>
*/
public function getRecipientUserObjects(AutomatedReport $report): array
{
$userIds = $report->getRecipients()['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->values()
->all();
}
private function getJiminnyRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function buildRecipientUsers(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => [
'email' => $user->getEmailAddress(),
'name' => $user->getName(),
'timezone' => $user->getTimezone()->getName(),
])
->values()
->all();
}
public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array
{
if ($report->isAskJiminnyReport()) {
$recipients = $this->resolveAskJiminnyRecipients($report);
} else {
$recipients = $this->getRecipientUsers($report);
if ($includeJiminny) {
$recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));
}
}
$emails = [];
return array_values(array_filter(
$recipients,
static function ($recipient) use (&$emails) {
if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {
return false;
}
$emails[] = $recipient['email'];
return true;
}
));
}
private function resolveAskJiminnyRecipients(AutomatedReport $report): array
{
$recipients = [];
$creator = $report->getCreator();
if ($creator !== null) {
$recipients[] = [
'email' => $creator->getEmailAddress(),
'name' => $creator->getName(),
'timezone' => $creator->getTimezone()->getName(),
];
}
return array_merge(
$recipients,
$this->buildRecipientUsers($report->getRecipients()),
$this->getGroupRecipientUsers($report),
);
}
private function getGroupRecipientUsers(AutomatedReport $report): array
{
$users = [];
foreach ($report->getGroups() as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group === null) {
continue;
}
foreach ($group->getMembers() as $member) {
$users[] = [
'email' => $member->getEmailAddress(),
'name' => $member->getName(),
'timezone' => $member->getTimezone()->getName(),
];
}
}
return $users;
}
public function getReportTypeName(AutomatedReportResult $report): string
{
$type = $report->getReport()->getType();
$getType = $this->transformReportType($type);
return $getType['name'];
}
public function getReportPeriodName(AutomatedReportResult $report): string
{
$from = $report->getFromDate();
$to = $report->getToDate();
$frequency = $report->getReport()->getFrequency();
if ($from === null || $to === null) {
if (! $report->getReport()->isAskJiminnyReport()) {
$invalidPeriod = $from === null ? 'from' : 'to';
throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);
}
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
}
return $this->formatReportPeriodName($frequency, $from, $to);
}
private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string
{
$fromYear = $from->format('Y');
$toYear = $to->format('Y');
$differentYears = $fromYear !== $toYear;
switch ($frequency) {
case self::FREQUENCY_DAILY:
return $from->format('j M Y');
case self::FREQUENCY_QUARTERLY:
// 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ
$startMonth = $from->format('M');
$endMonth = $to->copy()->subMonth();
$endMonthName = $endMonth->format('M');
$endMonthYear = $endMonth->format('Y');
if ($differentYears) {
return "{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}";
}
return "{$startMonth} - {$endMonthName} {$toYear}";
case self::FREQUENCY_MONTHLY:
// 'May 2025' - monthly reports are always within the same year
return $from->format('M Y');
case self::FREQUENCY_WEEKLY:
// '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ
$startDay = $from->format('j');
$endDay = $to->format('j');
$startMonth = $from->format('M');
$endMonth = $to->format('M');
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
if ($startMonth !== $endMonth) {
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
}
return "{$startDay} - {$endDay} {$endMonth} {$toYear}";
case self::FREQUENCY_ONE_OFF:
// '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ
$startDay = $from->format('j');
$startMonth = $from->format('M');
$endDay = $to->format('j');
$endMonth = $to->format('M');
// If same month and year, use a format like '2-31 May 2025'
if ($startMonth === $endMonth && ! $differentYears) {
return "{$startDay} - {$endDay} {$startMonth} {$toYear}";
}
// If different years, include both years
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
// Same year but different months
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
default:
// Default format for unknown frequencies
return $from->format('j M Y') . ' - ' . $to->format('j M Y');
}
}
public function getReportTeamsName(AutomatedReportResult $report): string
{
$groups = $report->getGroups();
if (empty($groups)) {
return 'All';
}
// Get group names from repository
$groupNames = [];
foreach ($groups as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group) {
$groupNames[] = $group->getName();
}
}
if (count($groupNames) === 1) {
// Single team format
$teamsName = $groupNames[0];
} else {
// Multiple teams format
$teamsName = implode(', ', $groupNames);
}
return $teamsName;
}
public function getReportFileName(AutomatedReportResult $report): string
{
$customName = $report->getReport()->getCustomName();
$periodName = $this->getReportPeriodName($report);
$filenameSuffix = $this->getFilenameSuffix($report);
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$customName} - {$periodName}");
}
$baseName = $this->getReportTypeName($report);
if ($filenameSuffix) {
$baseName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}");
}
public function getReportFileNameWithExtension(AutomatedReportResult $result): string
{
$extension = $this->getMediaTypeMetadata($result)['extension'];
return $this->getReportFileName($result) . '.' . $extension;
}
public function sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool
{
$recipients = array_map('intval', $report->getRecipients()['users'] ?? []);
return in_array($user->getId(), $recipients);
}
public function transformReportResults(Collection $automatedReportResults): array
{
$data = [];
foreach ($automatedReportResults as $automatedReportResult) {
/** @var AutomatedReportResult $automatedReportResult */
$report = $automatedReportResult->getReport();
$createdBy = $report->getCreator();
$creator = [
'id' => $createdBy?->getUuid(),
'name' => $createdBy?->getName(),
'email' => $createdBy?->getEmailAddress(),
'photoUrl' => $createdBy?->getPhotoUrl(),
];
$recipients = $this->buildRecipients($report);
$data[] = [
'id' => $automatedReportResult->getUuid(),
'name' => $automatedReportResult->getName(),
'frequency' => $this->transformFrequency($report->getFrequency()),
'recipients' => $recipients,
'recipients' => [
...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),
...array_values($this->transformRecipients($report->getRecipients())),
],
'report_type' => $this->transformReportType($report->getType()),
'media_type' => $automatedReportResult->getMediaType(),
'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),
'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),
'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),
'creator' => $creator,
];
}
return $data;
}
private function buildRecipients(AutomatedReport $report)
{
}
public function hasCallTypeConference(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);
}
public function hasCallTypeDialer(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);
}
// transformers
private function transformTeam(Team $team): array
{
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
return [];
}
return [
'id' => $team->getUuid(),
'name' => $team->getName(),
];
}
private function transformReportFullView(AutomatedReport $report): array
{
$base = $this->transformReportBase($report);
return $report->getType() === self::TYPE_ASK_JIMINNY
? $base + $this->transformAskJiminnyFields($report)
: $base + $this->transformStandardReportFields($report);
}
private function transformReportBase(AutomatedReport $report): array
{
return [
'id' => $report->getUuid(),
'organization' => $this->transformOrganization(team: $report->getTeam()),
'report_type' => $this->transformReportType($report->getType()),
'frequency' => $this->transformFrequency($report->getFrequency()),
];
}
private function transformStandardReportFields(AutomatedReport $report): array
{
$team = $report->getTeam();
return [
'report_enabled' => $report->getStatus(),
'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),
'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),
'deal_value_min' => $report->getDealValueMin(),
'deal_value_max' => $report->getDealValueMax(),
'call_types' => $this->transformCallType($report->getCallTypes()),
'media_types' => $this->transformMediaTypes($report),
'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),
'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),
'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),
'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),
'recipients' => $this->transformRecipients($report->getRecipients()),
'created_by' => $this->transformCreator($report->getCreator()),
'additional_prompt_input' => $report->getAdditionalPromptInput(),
'custom_name' => $report->getCustomName(),
'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),
'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),
'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),
];
}
private function transformAskJiminnyFields(AutomatedReport $report): array
{
$team = $report->getTeam();
$creatorId = $report->getAttribute('created_by');
$explicitUserIds = array_values(array_filter(
$report->getRecipients()['users'] ?? [],
static fn ($id) => $id !== $creatorId
));
return [
'report_name' => $report->getCustomName(),
'enabled' => $report->getStatus(),
'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),
'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),
'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),
'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),
];
}
private function transformOrganization(?Team $team): array
{
return [
'id' => $team?->getUuid(),
'name' => $team?->getName(),
];
}
private function transformReportType(string $type): array
{
foreach (self::ALL_TYPES as $typeItem) {
if ($typeItem['id'] === $type) {
return $typeItem;
}
}
return [];
}
private function transformCallType(array $types): array
{
$result = [];
$callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];
foreach ($types as $type) {
foreach ($callTypes as $callTypeItem) {
if ($callTypeItem['id'] === $type) {
$result[] = $callTypeItem;
break;
}
}
}
return $result;
}
private function transformMediaTypes(AutomatedReport $report): array
{
$values = [];
foreach ($report->getMediaTypes() as $mediaType) {
if (! in_array($mediaType, self::MEDIA_TYPES, true)) {
continue;
}
$values[] = match ($mediaType) {
self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,
self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,
};
}
return $values;
}
private function transformFrequency(string $frequency): array
{
foreach (self::ALL_FREQUENCIES as $frequencyItem) {
if ($frequencyItem['id'] === $frequency) {
return $frequencyItem;
}
}
return [];
}
public function transformDurationToMinutes(?int $duration): ?int
{
if (! $duration) {
return null;
}
return (int) ($duration / 60);
}
private function transformGroups(?Team $team, array $groupsIds): array
{
if (empty($groupsIds) || ! $team) {
return [];
}
$data = [];
foreach ($groupsIds as $groupId) {
$group = $team->groups()->where('id', $groupId)->first();
if ($group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
'photoUrl' => $group->getPhotoUrl(),
];
}
}
return $data;
}
private function transformStages(?Team $team, array $stagesIds): array
{
if (empty($stagesIds) || ! $team) {
return [];
}
$data = [];
foreach ($stagesIds as $stageId) {
$stage = $team->stages()->where('id', $stageId)->first();
if ($stage) {
$data[] = [
'id' => $stage->getUuid(),
'name' => $stage->getName(),
];
}
}
return $data;
}
private function transformRecipients(array $recipients): array
{
$users = [];
foreach ($recipients['users'] ?? [] as $userId) {
$users[] = $this->transformUser($userId);
}
return $users;
}
private function transformCreator(?User $user): ?array
{
if ($user === null) {
return null;
}
return $this->transformUser($user->getId());
}
private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array
{
if ($prompt === null) {
return null;
}
return [
'id' => $prompt->getUuid(),
'name' => $prompt->getTitle(),
];
}
private function transformSafeSearch(?Search $search): ?array
{
if ($search === null) {
return null;
}
return [
'id' => $search->getUuid(),
'name' => $search->getName(),
];
}
private function transformUser(int $userId): array
{
/* @var ?User $user */
$user = $this->userRepository->find($userId);
return [
'id' => $user?->getUuid(),
'name' => $user?->getName(),
'email' => $user?->getEmailAddress(),
'photoUrl' => $user?->getPhotoUrl(),
];
}
public function create(array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$validatedData['created_by'] = auth()->id();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
public function update(string $uuid, array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$report = $this->automatedReportsRepository->findByUuid($uuid);
if (! $report) {
throw new InvalidArgumentException('Report not found');
}
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
/**
* Create an Ask Jiminny report.
*/
public function createAskJiminnyReport(array $data, User $creator): array
{
$validatedData = $this->validateAskJiminnyReportData($data, $creator);
$validatedData['created_by'] = $creator->getId();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
return $this->transformReportFullView($automatedReport);
}
/**
* Update an Ask Jiminny report.
*/
public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array
{
if (! $report->isAskJiminnyReport()) {
throw new InvalidArgumentException('Report is not an Ask Jiminny report');
}
$validatedData = $this->validateAskJiminnyReportData($data, $user);
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
return $this->transformReportFullView($automatedReport);
}
public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array
{
$this->automatedReportsRepository->update($report, ['status' => $status]);
return $this->transformReportFullView($report->fresh());
}
/**
* Validate and transform data for Ask Jiminny reports.
*/
private function validateAskJiminnyReportData(array $data, User $user): array
{
// Validate name
$name = trim($data['report_name'] ?? '');
if (empty($name)) {
throw new InvalidArgumentException('Report name is required');
}
if (mb_strlen($name) > 50) {
throw new InvalidArgumentException('Report name must be 50 characters or less');
}
// Validate frequency (only daily, weekly, monthly for Ask Jiminny)
$frequency = $data['frequency'] ?? null;
$askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];
if (! in_array($frequency, $askJiminnyFrequencies, true)) {
throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');
}
// Validate expiration date
$expiresAt = $data['expires_on'] ?? null;
if (empty($expiresAt)) {
throw new InvalidArgumentException('Expiration date is required');
}
try {
$expiresAtDate = Carbon::parse($expiresAt);
} catch (InvalidFormatException $e) {
throw new InvalidArgumentException('Expiration date format is invalid');
}
$maxExpiration = Carbon::now()->addYear()->endOfDay();
if ($expiresAtDate->gt($maxExpiration)) {
throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');
}
if ($expiresAtDate->isPast()) {
throw new InvalidArgumentException('Expiration date cannot be in the past');
}
// Validate saved search
$activitySearchId = $data['saved_search'] ?? null;
if (empty($activitySearchId)) {
throw new InvalidArgumentException('Saved search is required');
}
$savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);
if (! $savedSearch) {
throw new InvalidArgumentException('Saved search not found or does not belong to you');
}
// Validate saved prompt
$askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;
if (empty($askAnythingPromptId)) {
throw new InvalidArgumentException('Ask Jiminny prompt is required');
}
$prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);
if (! $prompt) {
throw new InvalidArgumentException('Ask Jiminny prompt not found');
}
// Validate status
$status = $data['enabled'] ?? false;
$recipientUserIds = [$user->getId()];
if (! empty($data['share_users'])) {
$sharedUserIds = $this->validateAndGetUserIdsByTeam(
$user->team,
(array) $data['share_users']
);
$recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);
}
$sharedGroupIds = [];
if (! empty($data['share_teams'])) {
$sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);
}
$recipientUserIds = array_values(array_unique($recipientUserIds));
return [
'team_id' => $user->getTeamId(),
'type' => self::TYPE_ASK_JIMINNY,
'status' => (bool) $status,
'frequency' => $frequency,
'custom_name' => $name,
'activity_search_id' => $savedSearch->getId(),
'ask_anything_prompt_id' => $prompt->getId(),
'expires_at' => $expiresAtDate->toDateString(),
'media_types' => [self::MEDIA_TYPE_PDF],
'call_types' => [],
'recipients' => ['users' => $recipientUserIds],
'groups' => $sharedGroupIds,
];
}
public static function getAskJiminnyFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::ASK_JIMINNY_FREQUENCIES);
}
public function getAskJiminnyReportFilters(User $user): array
{
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
return [
[
'id' => 'prompt',
'label' => 'Prompt',
'options' => $prompts,
],
[
'id' => 'saved_search',
'label' => 'Saved Search',
'options' => $savedSearches,
],
];
}
public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array
{
$team = $user->getTeam();
$userTimezone = $user->getTimezone();
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
$teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [
'id' => $group->getUuid(),
'name' => $group->getName(),
])->values()->all();
$shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];
$sharedTeamsValue = [];
$sharedUsersValue = [];
if ($report) {
$sharedTeamsValue = $this->transformGroups($team, $report->getGroups());
$recipientUserIds = $report->getRecipients()['users'] ?? [];
$creatorId = $report->getAttribute('created_by');
$sharedUserIds = array_values(array_filter(
$recipientUserIds,
static fn ($id) => $id !== $creatorId
));
$sharedUsersValue = collect($sharedUserIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (User $u) => [
'id' => $u->getUuid(),
'name' => $u->getName(),
])
->values()
->all();
}
return [
'fields' => [
[
'id' => 'enabled',
'inputType' => InputTypeEnum::TOGGLE,
'label' => '',
'value' => $report?->getStatus() ?? false,
],
[
'id' => 'report_name',
'inputType' => InputTypeEnum::TEXT,
'label' => 'Name',
'placeholder' => 'Enter name',
'required' => true,
'validation' => ['maxLength' => 50],
'value' => $report?->getCustomName() ?? '',
],
[
'id' => 'frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'label' => 'Frequency',
'required' => true,
'placeholder' => 'Select',
'options' => self::ASK_JIMINNY_FREQUENCIES,
'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,
],
[
'id' => 'expires_on',
'inputType' => InputTypeEnum::DATE,
'label' => 'Expires on',
'required' => true,
'placeholder' => 'Select',
'validation' => [
'minDate' => now($userTimezone)->toDateString(),
'maxDate' => now($userTimezone)->addYear()->toDateString(),
],
'value' => $report?->getExpiresAt()?->toDateString(),
],
[
...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"#11894 on JY-18909-automated-reports-ask-jiminny, menu","depth":5,"help_text":"Pull request #11894 exists for current branch JY-18909-automated-reports-ask-jiminny","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AutomatedReportsRepositoryTest","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AutomatedReportsRepositoryTest'","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AutomatedReportsRepositoryTest'","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"3","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"102","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"3","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"34","depth":4,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Kiosk\\AutomatedReports;\n\nuse Carbon\\CarbonImmutable;\nuse Carbon\\CarbonInterface;\nuse Carbon\\Exceptions\\InvalidFormatException;\nuse DateTime;\nuse DateTimeInterface;\nuse DateTimeZone;\nuse Illuminate\\Contracts\\Bus\\Dispatcher as BusDispatcher;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Support\\Facades\\Log;\nuse Illuminate\\Support\\Facades\\Storage;\nuse Jiminny\\Component\\ActivitySearch\\FilterDefinition\\InputTypeEnum;\nuse Jiminny\\Component\\AskAnything\\AskAnythingPromptService;\nuse Jiminny\\Component\\AskAnything\\Dtos\\AskAnythingPromptDto;\nuse Jiminny\\Component\\UrlGenerator\\Webhook;\nuse Jiminny\\Contracts\\Repositories\\PlaybookCategoryRepository;\nuse Jiminny\\Contracts\\Repositories\\TeamRepository;\nuse Jiminny\\Contracts\\Repositories\\UserRepository;\nuse Jiminny\\Exceptions\\ApplicationException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Exceptions\\ModelNotFoundException;\nuse Jiminny\\Jobs\\AutomatedReports\\RequestGenerateReportJob;\nuse Jiminny\\Models\\Activity\\Search;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPrompt;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPromptTarget;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Contracts\\UserContract;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Repositories\\AskAnythingRepository;\nuse Jiminny\\Repositories\\AutomatedReportsRepository;\nuse Jiminny\\Repositories\\GroupRepository;\nuse Jiminny\\Repositories\\SearchRepository;\nuse Jiminny\\Repositories\\StageRepository;\nuse Throwable;\n\nclass AutomatedReportsService\n{\n public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';\n public const string TYPE_ASK_JIMINNY = 'ask_jiminny';\n\n /**\n * Standard report types (used by kiosk for existing automated reports).\n */\n // @TODO this will add filter, however if we need to control feature by FF we need conditional logic\n public const array TYPES = [\n ['id' => 'exec_summary', 'name' => 'Exec Summary'],\n ['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],\n ['id' => 'product_feedback', 'name' => 'Product Feedback'],\n ['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],\n// ['id' => 'questions', 'name' => 'Questions'],\n// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],\n ];\n\n public const array ALL_TYPES = [\n ...self::TYPES,\n ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],\n ];\n\n public const string FREQUENCY_DAILY = 'daily';\n public const string FREQUENCY_WEEKLY = 'weekly';\n public const string FREQUENCY_MONTHLY = 'monthly';\n public const string FREQUENCY_QUARTERLY = 'quarterly';\n public const string FREQUENCY_ONE_OFF = 'one_off';\n\n /**\n * Frequencies for standard (non-Ask Jiminny) reports.\n */\n public const array FREQUENCIES = [\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n\n /**\n * Frequencies for Ask Jiminny reports.\n */\n public const array ASK_JIMINNY_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ];\n\n public const string MEDIA_TYPE_PDF = 'pdf';\n public const string MEDIA_TYPE_PODCAST = 'podcast';\n public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];\n public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];\n public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];\n public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];\n\n public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];\n public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];\n public const int SENT_REPORT_AT_HOURS = 5;\n public const string PDF_KEY = 'pdf';\n public const string AUDIO_KEY = 'audio';\n\n private const array ALL_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n private const string S3_DIR = 'reports';\n private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];\n private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];\n\n public function __construct(\n private readonly TeamRepository $teamRepository,\n private readonly GroupRepository $groupRepository,\n private readonly UserRepository $userRepository,\n private readonly StageRepository $stageRepository,\n private readonly DealStagesService $dealStagesService,\n private readonly RecipientsService $recipientsService,\n private readonly AutomatedReportsRepository $automatedReportsRepository,\n private readonly Webhook $webhookService,\n private readonly BusDispatcher $dispatcher,\n private readonly ActivityTypeService $activityTypeService,\n private readonly PlaybookCategoryRepository $playbookCategoryRepository,\n private readonly AskAnythingPromptService $askAnythingPromptService,\n private readonly SearchRepository $activitySearchRepository,\n private readonly AskAnythingRepository $askAnythingRepository,\n ) {\n }\n\n public static function getTypes(): array\n {\n $types = self::TYPES;\n\n return array_map(static function ($type) {\n return $type['id'];\n }, $types);\n }\n\n public static function getCallTypes(): array\n {\n return array_map(static function ($callType) {\n return $callType['id'];\n }, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);\n }\n\n public static function getFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::FREQUENCIES);\n }\n\n // front-facing structure\n public function getReportEnabledFieldData(bool $value = false): array\n {\n return [\n 'id' => 'report_enabled',\n 'label' => '',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'value' => $value,\n ];\n }\n\n // Organizations = Teams\n public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array\n {\n $options = $this->getTeams();\n\n if ($shortVersion) {\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value,\n 'dependencies' => [\n 'teams',\n 'deal_stage_at_call',\n 'current_deal_stage',\n 'recipients',\n ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,\n ],\n 'dependsOn' => [],\n ];\n }\n\n // Teams = Groups\n public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array\n {\n if ($shortVersion) {\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value, // value should be an array of objects {id, name}\n 'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],\n 'dependsOn' => [],\n ];\n }\n\n public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array\n {\n $types = [];\n if ($team instanceof Team) {\n if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n $types = self::TYPES;\n }\n if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {\n $types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];\n }\n } else {\n $types = self::TYPES;\n }\n\n if ($shortVersion) {\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'options' => $types,\n ];\n }\n\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $types,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getFrequencyFieldData(?string $value = null): array\n {\n return [\n 'id' => 'frequency',\n 'label' => 'Frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::FREQUENCIES,\n 'value' => $value,\n 'dependencies' => ['period'],\n 'dependsOn' => [],\n ];\n }\n\n public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array\n {\n return [\n 'id' => 'period',\n 'label' => 'Select one-off period',\n 'inputType' => InputTypeEnum::DATE_RANGE,\n 'required' => true,\n 'placeholder' => 'Select',\n 'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],\n 'queryParams' => [\n 'startDate' => 'start_date_period',\n 'endDate' => 'end_date_period',\n ],\n 'dependencies' => [],\n 'dependsOn' => ['frequency'],\n ];\n }\n\n public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array\n {\n return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);\n }\n\n public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);\n }\n\n public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);\n }\n\n public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'deal_value',\n 'label' => 'Deal Value',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_deal_value',\n 'max' => 'max_deal_value',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array\n {\n $value = [];\n $conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;\n $dialerOn && $value[] = self::CALL_TYPE_DIALER;\n\n return [\n 'id' => 'call_type',\n 'label' => 'Call Type',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => [\n self::CALL_TYPE_CONFERENCE,\n self::CALL_TYPE_DIALER,\n ],\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getMediaTypeFieldData(?AutomatedReport $report = null): array\n {\n $value = [];\n\n if ($report) {\n $value = $this->transformMediaTypes($report);\n }\n\n return [\n 'id' => 'media_types',\n 'label' => 'Export as',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => self::MEDIA_TYPE_OBJECTS,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'call_duration',\n 'label' => 'Call Duration',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_call_duration',\n 'max' => 'max_call_duration',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getRecipientsFieldData(?Team $team = null, array $value = []): array\n {\n return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);\n }\n\n public function getJiminnyRecipientsFieldData(array $value = []): array\n {\n return $this->recipientsService->getJiminnyRecipientsFieldData($value);\n }\n\n public function getAdditionalPromptInputFieldData(?string $value = null): array\n {\n return [\n 'id' => 'additional_prompt_input',\n 'label' => 'Special requirements',\n 'inputType' => InputTypeEnum::TEXTAREA,\n 'required' => false,\n 'placeholder' => 'What should be the focus of the report?',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCustomReportNameFieldData(?string $value = null): array\n {\n return [\n 'id' => 'custom_name',\n 'label' => 'Custom report name',\n 'inputType' => InputTypeEnum::TEXT,\n 'required' => false,\n 'placeholder' => 'Enter custom name',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n // data providers\n public function getTeams(): array\n {\n $teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);\n\n $teamData = [];\n foreach ($teams as $team) {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n continue;\n }\n\n $teamData[] = $this->transformTeam($team);\n }\n\n return $teamData;\n }\n\n public function getTeamGroups(string $teamUuid): array\n {\n $data = [];\n $team = $this->getTeam($teamUuid);\n\n if ($team !== null) {\n $groups = $team->groups()->get();\n\n foreach ($groups as $group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n public function getTeamsGroupsOptions(array $filterTeamUuids = []): array\n {\n $data = [];\n $teams = $this->getTeams();\n\n foreach ($teams as $team) {\n if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {\n continue;\n }\n\n $data[] = [\n 'label' => $team['name'],\n 'groups' => $this->getTeamGroups($team['id']),\n ];\n }\n\n return $data;\n }\n\n public function getTeam(string $teamUuid): ?Team\n {\n return $this->teamRepository->idOrUuid($teamUuid);\n }\n\n public function getTeamById(int $teamId): ?Team\n {\n return $this->teamRepository->find($teamId);\n }\n\n public function getGroupsUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportGroups = $report->getGroups();\n foreach ($reportGroups as $groupId) {\n if ($group = $this->groupRepository->find($groupId)) {\n $uuids[] = $group->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getPlaybookCategoriesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $playbookCategories = $report->getPlaybookCategories();\n foreach ($playbookCategories as $id) {\n if ($category = $this->playbookCategoryRepository->find($id)) {\n $uuids[] = $category->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getDealAtCallStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getDealAtCallStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getCurrentDealStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getCurrentDealStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getRecipients());\n }\n\n public function getJiminnyUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function extractUserUuids(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => $user->getUuid())\n ->values()\n ->all();\n }\n\n // get mail data\n public function getRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getRecipients());\n }\n\n /**\n * @return array<UserContract>\n */\n public function getRecipientUserObjects(AutomatedReport $report): array\n {\n $userIds = $report->getRecipients()['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->values()\n ->all();\n }\n\n private function getJiminnyRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function buildRecipientUsers(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => [\n 'email' => $user->getEmailAddress(),\n 'name' => $user->getName(),\n 'timezone' => $user->getTimezone()->getName(),\n ])\n ->values()\n ->all();\n }\n\n public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array\n {\n if ($report->isAskJiminnyReport()) {\n $recipients = $this->resolveAskJiminnyRecipients($report);\n } else {\n $recipients = $this->getRecipientUsers($report);\n if ($includeJiminny) {\n $recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));\n }\n }\n\n $emails = [];\n\n return array_values(array_filter(\n $recipients,\n static function ($recipient) use (&$emails) {\n if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {\n return false;\n }\n $emails[] = $recipient['email'];\n\n return true;\n }\n ));\n }\n\n private function resolveAskJiminnyRecipients(AutomatedReport $report): array\n {\n $recipients = [];\n\n $creator = $report->getCreator();\n if ($creator !== null) {\n $recipients[] = [\n 'email' => $creator->getEmailAddress(),\n 'name' => $creator->getName(),\n 'timezone' => $creator->getTimezone()->getName(),\n ];\n }\n\n return array_merge(\n $recipients,\n $this->buildRecipientUsers($report->getRecipients()),\n $this->getGroupRecipientUsers($report),\n );\n }\n\n private function getGroupRecipientUsers(AutomatedReport $report): array\n {\n $users = [];\n foreach ($report->getGroups() as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group === null) {\n continue;\n }\n foreach ($group->getMembers() as $member) {\n $users[] = [\n 'email' => $member->getEmailAddress(),\n 'name' => $member->getName(),\n 'timezone' => $member->getTimezone()->getName(),\n ];\n }\n }\n\n return $users;\n }\n\n public function getReportTypeName(AutomatedReportResult $report): string\n {\n $type = $report->getReport()->getType();\n\n $getType = $this->transformReportType($type);\n\n return $getType['name'];\n }\n\n public function getReportPeriodName(AutomatedReportResult $report): string\n {\n $from = $report->getFromDate();\n $to = $report->getToDate();\n $frequency = $report->getReport()->getFrequency();\n\n if ($from === null || $to === null) {\n if (! $report->getReport()->isAskJiminnyReport()) {\n $invalidPeriod = $from === null ? 'from' : 'to';\n\n throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);\n }\n\n $period = $this->calculateFromAndToDatePeriod($frequency);\n $from = $period['fromDate'];\n $to = $period['toDate'];\n }\n\n return $this->formatReportPeriodName($frequency, $from, $to);\n }\n\n private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string\n {\n $fromYear = $from->format('Y');\n $toYear = $to->format('Y');\n $differentYears = $fromYear !== $toYear;\n\n switch ($frequency) {\n case self::FREQUENCY_DAILY:\n return $from->format('j M Y');\n\n case self::FREQUENCY_QUARTERLY:\n // 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ\n $startMonth = $from->format('M');\n $endMonth = $to->copy()->subMonth();\n $endMonthName = $endMonth->format('M');\n $endMonthYear = $endMonth->format('Y');\n\n if ($differentYears) {\n return \"{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}\";\n }\n\n return \"{$startMonth} - {$endMonthName} {$toYear}\";\n\n case self::FREQUENCY_MONTHLY:\n // 'May 2025' - monthly reports are always within the same year\n return $from->format('M Y');\n\n case self::FREQUENCY_WEEKLY:\n // '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ\n $startDay = $from->format('j');\n $endDay = $to->format('j');\n $startMonth = $from->format('M');\n $endMonth = $to->format('M');\n\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n if ($startMonth !== $endMonth) {\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n return \"{$startDay} - {$endDay} {$endMonth} {$toYear}\";\n\n case self::FREQUENCY_ONE_OFF:\n // '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ\n $startDay = $from->format('j');\n $startMonth = $from->format('M');\n $endDay = $to->format('j');\n $endMonth = $to->format('M');\n\n // If same month and year, use a format like '2-31 May 2025'\n if ($startMonth === $endMonth && ! $differentYears) {\n return \"{$startDay} - {$endDay} {$startMonth} {$toYear}\";\n }\n\n // If different years, include both years\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n // Same year but different months\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n\n default:\n // Default format for unknown frequencies\n return $from->format('j M Y') . ' - ' . $to->format('j M Y');\n }\n }\n\n public function getReportTeamsName(AutomatedReportResult $report): string\n {\n $groups = $report->getGroups();\n\n if (empty($groups)) {\n return 'All';\n }\n\n // Get group names from repository\n $groupNames = [];\n foreach ($groups as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group) {\n $groupNames[] = $group->getName();\n }\n }\n\n if (count($groupNames) === 1) {\n // Single team format\n $teamsName = $groupNames[0];\n } else {\n // Multiple teams format\n $teamsName = implode(', ', $groupNames);\n }\n\n return $teamsName;\n }\n\n public function getReportFileName(AutomatedReportResult $report): string\n {\n $customName = $report->getReport()->getCustomName();\n $periodName = $this->getReportPeriodName($report);\n $filenameSuffix = $this->getFilenameSuffix($report);\n\n if ($customName) {\n if ($filenameSuffix) {\n $customName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$customName} - {$periodName}\");\n }\n\n $baseName = $this->getReportTypeName($report);\n\n if ($filenameSuffix) {\n $baseName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}\");\n }\n\n public function getReportFileNameWithExtension(AutomatedReportResult $result): string\n {\n $extension = $this->getMediaTypeMetadata($result)['extension'];\n\n return $this->getReportFileName($result) . '.' . $extension;\n }\n\n public function sanitizeFileName(string $fileName): string\n {\n return str_replace(['/', '\\\\'], '-', $fileName);\n }\n\n public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool\n {\n $recipients = array_map('intval', $report->getRecipients()['users'] ?? []);\n\n return in_array($user->getId(), $recipients);\n }\n\n public function transformReportResults(Collection $automatedReportResults): array\n {\n $data = [];\n foreach ($automatedReportResults as $automatedReportResult) {\n /** @var AutomatedReportResult $automatedReportResult */\n\n $report = $automatedReportResult->getReport();\n\n $createdBy = $report->getCreator();\n $creator = [\n 'id' => $createdBy?->getUuid(),\n 'name' => $createdBy?->getName(),\n 'email' => $createdBy?->getEmailAddress(),\n 'photoUrl' => $createdBy?->getPhotoUrl(),\n ];\n\n $recipients = $this->buildRecipients($report);\n\n $data[] = [\n 'id' => $automatedReportResult->getUuid(),\n 'name' => $automatedReportResult->getName(),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n 'recipients' => $recipients,\n 'recipients' => [\n ...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),\n ...array_values($this->transformRecipients($report->getRecipients())),\n ],\n 'report_type' => $this->transformReportType($report->getType()),\n 'media_type' => $automatedReportResult->getMediaType(),\n 'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),\n 'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),\n 'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),\n 'creator' => $creator,\n ];\n \n \n }\n\n return $data;\n }\n\n private function buildRecipients(AutomatedReport $report)\n {\n \n }\n\n public function hasCallTypeConference(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);\n }\n\n public function hasCallTypeDialer(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);\n }\n\n // transformers\n private function transformTeam(Team $team): array\n {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n return [];\n }\n\n return [\n 'id' => $team->getUuid(),\n 'name' => $team->getName(),\n ];\n }\n\n private function transformReportFullView(AutomatedReport $report): array\n {\n $base = $this->transformReportBase($report);\n\n return $report->getType() === self::TYPE_ASK_JIMINNY\n ? $base + $this->transformAskJiminnyFields($report)\n : $base + $this->transformStandardReportFields($report);\n }\n\n private function transformReportBase(AutomatedReport $report): array\n {\n return [\n 'id' => $report->getUuid(),\n 'organization' => $this->transformOrganization(team: $report->getTeam()),\n 'report_type' => $this->transformReportType($report->getType()),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n ];\n }\n\n private function transformStandardReportFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n\n return [\n 'report_enabled' => $report->getStatus(),\n 'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),\n 'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),\n 'deal_value_min' => $report->getDealValueMin(),\n 'deal_value_max' => $report->getDealValueMax(),\n 'call_types' => $this->transformCallType($report->getCallTypes()),\n 'media_types' => $this->transformMediaTypes($report),\n 'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),\n 'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),\n 'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),\n 'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),\n 'recipients' => $this->transformRecipients($report->getRecipients()),\n 'created_by' => $this->transformCreator($report->getCreator()),\n 'additional_prompt_input' => $report->getAdditionalPromptInput(),\n 'custom_name' => $report->getCustomName(),\n 'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),\n 'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),\n 'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),\n ];\n }\n\n private function transformAskJiminnyFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n $creatorId = $report->getAttribute('created_by');\n $explicitUserIds = array_values(array_filter(\n $report->getRecipients()['users'] ?? [],\n static fn ($id) => $id !== $creatorId\n ));\n\n return [\n 'report_name' => $report->getCustomName(),\n 'enabled' => $report->getStatus(),\n 'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),\n 'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),\n 'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),\n 'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),\n ];\n }\n\n private function transformOrganization(?Team $team): array\n {\n return [\n 'id' => $team?->getUuid(),\n 'name' => $team?->getName(),\n ];\n }\n\n private function transformReportType(string $type): array\n {\n foreach (self::ALL_TYPES as $typeItem) {\n if ($typeItem['id'] === $type) {\n return $typeItem;\n }\n }\n\n return [];\n }\n\n private function transformCallType(array $types): array\n {\n $result = [];\n $callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];\n\n foreach ($types as $type) {\n foreach ($callTypes as $callTypeItem) {\n if ($callTypeItem['id'] === $type) {\n $result[] = $callTypeItem;\n\n break;\n }\n }\n }\n\n return $result;\n }\n\n private function transformMediaTypes(AutomatedReport $report): array\n {\n $values = [];\n\n foreach ($report->getMediaTypes() as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n continue;\n }\n\n $values[] = match ($mediaType) {\n self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,\n self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,\n };\n }\n\n return $values;\n }\n\n private function transformFrequency(string $frequency): array\n {\n foreach (self::ALL_FREQUENCIES as $frequencyItem) {\n if ($frequencyItem['id'] === $frequency) {\n return $frequencyItem;\n }\n }\n\n return [];\n }\n\n public function transformDurationToMinutes(?int $duration): ?int\n {\n if (! $duration) {\n return null;\n }\n\n return (int) ($duration / 60);\n }\n\n private function transformGroups(?Team $team, array $groupsIds): array\n {\n if (empty($groupsIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($groupsIds as $groupId) {\n $group = $team->groups()->where('id', $groupId)->first();\n\n if ($group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n 'photoUrl' => $group->getPhotoUrl(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformStages(?Team $team, array $stagesIds): array\n {\n if (empty($stagesIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($stagesIds as $stageId) {\n $stage = $team->stages()->where('id', $stageId)->first();\n\n if ($stage) {\n $data[] = [\n 'id' => $stage->getUuid(),\n 'name' => $stage->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformRecipients(array $recipients): array\n {\n $users = [];\n foreach ($recipients['users'] ?? [] as $userId) {\n $users[] = $this->transformUser($userId);\n }\n\n return $users;\n }\n\n private function transformCreator(?User $user): ?array\n {\n if ($user === null) {\n return null;\n }\n\n return $this->transformUser($user->getId());\n }\n\n private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array\n {\n if ($prompt === null) {\n return null;\n }\n\n return [\n 'id' => $prompt->getUuid(),\n 'name' => $prompt->getTitle(),\n ];\n }\n\n private function transformSafeSearch(?Search $search): ?array\n {\n if ($search === null) {\n return null;\n }\n\n return [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ];\n }\n\n private function transformUser(int $userId): array\n {\n /* @var ?User $user */\n $user = $this->userRepository->find($userId);\n\n return [\n 'id' => $user?->getUuid(),\n 'name' => $user?->getName(),\n 'email' => $user?->getEmailAddress(),\n 'photoUrl' => $user?->getPhotoUrl(),\n ];\n }\n\n public function create(array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $validatedData['created_by'] = auth()->id();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function update(string $uuid, array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $report = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $report) {\n throw new InvalidArgumentException('Report not found');\n }\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Create an Ask Jiminny report.\n */\n public function createAskJiminnyReport(array $data, User $creator): array\n {\n $validatedData = $this->validateAskJiminnyReportData($data, $creator);\n $validatedData['created_by'] = $creator->getId();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Update an Ask Jiminny report.\n */\n public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array\n {\n if (! $report->isAskJiminnyReport()) {\n throw new InvalidArgumentException('Report is not an Ask Jiminny report');\n }\n\n $validatedData = $this->validateAskJiminnyReportData($data, $user);\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array\n {\n $this->automatedReportsRepository->update($report, ['status' => $status]);\n\n return $this->transformReportFullView($report->fresh());\n }\n\n /**\n * Validate and transform data for Ask Jiminny reports.\n */\n private function validateAskJiminnyReportData(array $data, User $user): array\n {\n // Validate name\n $name = trim($data['report_name'] ?? '');\n if (empty($name)) {\n throw new InvalidArgumentException('Report name is required');\n }\n if (mb_strlen($name) > 50) {\n throw new InvalidArgumentException('Report name must be 50 characters or less');\n }\n\n // Validate frequency (only daily, weekly, monthly for Ask Jiminny)\n $frequency = $data['frequency'] ?? null;\n $askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];\n if (! in_array($frequency, $askJiminnyFrequencies, true)) {\n throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');\n }\n\n // Validate expiration date\n $expiresAt = $data['expires_on'] ?? null;\n if (empty($expiresAt)) {\n throw new InvalidArgumentException('Expiration date is required');\n }\n\n try {\n $expiresAtDate = Carbon::parse($expiresAt);\n } catch (InvalidFormatException $e) {\n throw new InvalidArgumentException('Expiration date format is invalid');\n }\n $maxExpiration = Carbon::now()->addYear()->endOfDay();\n if ($expiresAtDate->gt($maxExpiration)) {\n throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');\n }\n if ($expiresAtDate->isPast()) {\n throw new InvalidArgumentException('Expiration date cannot be in the past');\n }\n\n // Validate saved search\n $activitySearchId = $data['saved_search'] ?? null;\n if (empty($activitySearchId)) {\n throw new InvalidArgumentException('Saved search is required');\n }\n $savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);\n if (! $savedSearch) {\n throw new InvalidArgumentException('Saved search not found or does not belong to you');\n }\n\n // Validate saved prompt\n $askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;\n if (empty($askAnythingPromptId)) {\n throw new InvalidArgumentException('Ask Jiminny prompt is required');\n }\n $prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);\n if (! $prompt) {\n throw new InvalidArgumentException('Ask Jiminny prompt not found');\n }\n\n // Validate status\n $status = $data['enabled'] ?? false;\n\n $recipientUserIds = [$user->getId()];\n\n if (! empty($data['share_users'])) {\n $sharedUserIds = $this->validateAndGetUserIdsByTeam(\n $user->team,\n (array) $data['share_users']\n );\n $recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);\n }\n\n $sharedGroupIds = [];\n if (! empty($data['share_teams'])) {\n $sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);\n }\n\n $recipientUserIds = array_values(array_unique($recipientUserIds));\n\n return [\n 'team_id' => $user->getTeamId(),\n 'type' => self::TYPE_ASK_JIMINNY,\n 'status' => (bool) $status,\n 'frequency' => $frequency,\n 'custom_name' => $name,\n 'activity_search_id' => $savedSearch->getId(),\n 'ask_anything_prompt_id' => $prompt->getId(),\n 'expires_at' => $expiresAtDate->toDateString(),\n 'media_types' => [self::MEDIA_TYPE_PDF],\n 'call_types' => [],\n 'recipients' => ['users' => $recipientUserIds],\n 'groups' => $sharedGroupIds,\n ];\n }\n\n public static function getAskJiminnyFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::ASK_JIMINNY_FREQUENCIES);\n }\n\n public function getAskJiminnyReportFilters(User $user): array\n {\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n return [\n [\n 'id' => 'prompt',\n 'label' => 'Prompt',\n 'options' => $prompts,\n ],\n [\n 'id' => 'saved_search',\n 'label' => 'Saved Search',\n 'options' => $savedSearches,\n ],\n ];\n }\n\n public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array\n {\n $team = $user->getTeam();\n $userTimezone = $user->getTimezone();\n\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n $teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ])->values()->all();\n\n $shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];\n\n $sharedTeamsValue = [];\n $sharedUsersValue = [];\n if ($report) {\n $sharedTeamsValue = $this->transformGroups($team, $report->getGroups());\n\n $recipientUserIds = $report->getRecipients()['users'] ?? [];\n $creatorId = $report->getAttribute('created_by');\n $sharedUserIds = array_values(array_filter(\n $recipientUserIds,\n static fn ($id) => $id !== $creatorId\n ));\n $sharedUsersValue = collect($sharedUserIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (User $u) => [\n 'id' => $u->getUuid(),\n 'name' => $u->getName(),\n ])\n ->values()\n ->all();\n }\n\n return [\n 'fields' => [\n [\n 'id' => 'enabled',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'label' => '',\n 'value' => $report?->getStatus() ?? false,\n ],\n [\n 'id' => 'report_name',\n 'inputType' => InputTypeEnum::TEXT,\n 'label' => 'Name',\n 'placeholder' => 'Enter name',\n 'required' => true,\n 'validation' => ['maxLength' => 50],\n 'value' => $report?->getCustomName() ?? '',\n ],\n [\n 'id' => 'frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Frequency',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::ASK_JIMINNY_FREQUENCIES,\n 'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,\n ],\n [\n 'id' => 'expires_on',\n 'inputType' => InputTypeEnum::DATE,\n 'label' => 'Expires on',\n 'required' => true,\n 'placeholder' => 'Select',\n 'validation' => [\n 'minDate' => now($userTimezone)->toDateString(),\n 'maxDate' => now($userTimezone)->addYear()->toDateString(),\n ],\n 'value' => $report?->getExpiresAt()?->toDateString(),\n ],\n [\n 'id' => 'share_teams',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team',\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $teamGroups,\n 'value' => $sharedTeamsValue,\n ],\n [\n 'id' => 'share_users',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team member',\n 'required' => false,\n 'placeholder' => 'Select',\n 'groupLabelKey' => 'label',\n 'groupValuesKey' => 'users',\n 'optionLabelKey' => 'name',\n 'optionValueKey' => 'id',\n 'options' => $shareUsers,\n 'value' => $sharedUsersValue,\n ],\n [\n 'id' => 'saved_search',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Saved search',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $savedSearches,\n 'value' => $report && $report->getSavedSearch() ? [\n 'id' => $report->getSavedSearch()->getUuid(),\n 'name' => $report->getSavedSearch()->getName(),\n ] : null,\n ],\n [\n 'id' => 'ask_jiminny_prompt',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Ask Jiminny prompt',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $prompts,\n 'value' => $report && $report->getAskAnythingPrompt() ? [\n 'id' => $report->getAskAnythingPrompt()->getUuid(),\n 'name' => $report->getAskAnythingPrompt()->getTitle(),\n ] : null,\n ],\n ],\n ];\n }\n\n private function updateResultNames(AutomatedReport $automatedReport): void\n {\n $results = $this->automatedReportsRepository->getResultsByReport($automatedReport);\n\n foreach ($results as $result) {\n $result->update(['name' => $this->getReportFileName($result)]);\n }\n }\n\n public function updateStatus(string $uuid, array $data): array\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $automatedReport->update([\n 'status' => $status,\n ]);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n private function generateOneOffReport(AutomatedReport $automatedReport): void\n {\n // the scheduler handles all the other frequency types\n if ($automatedReport->getStatus() === false || $automatedReport->getFrequency() !== self::FREQUENCY_ONE_OFF) {\n return;\n }\n\n $this->dispatcher->dispatch(new RequestGenerateReportJob($automatedReport->getUuid()));\n }\n\n public function getReport(string $uuid): AutomatedReport\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n return $automatedReport;\n }\n\n public function get(string $uuid): array\n {\n $automatedReport = $this->getReport($uuid);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function list(string $sortColumn = 'created_at', string $sortDirection = 'desc'): array\n {\n $results = [];\n $collection = $this->automatedReportsRepository->getAllStandardReports($sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function listAskJiminnyReports(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): array {\n $results = [];\n $collection = $this->automatedReportsRepository->getAskJiminnyReportsByUser($user, $sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function delete(string $uuid): void\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $automatedReport->delete();\n }\n\n public function createReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n return $this->automatedReportsRepository->createResult(\n array_merge(\n [\n 'report_id' => $automatedReport->getId(),\n 'status' => AutomatedReportResult::STATUS_DEFAULT,\n ],\n $data\n )\n );\n }\n\n public function getOrCreateReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n $existing = $this->automatedReportsRepository->findLatestDefaultOrFailedResult($automatedReport);\n\n if ($existing !== null) {\n $existing->update(['status' => AutomatedReportResult::STATUS_DEFAULT]);\n\n return $existing;\n }\n\n return $this->createReportResult($automatedReport, $data);\n }\n\n public function getReportResult(string $resultUuid): AutomatedReportResult\n {\n $report = $this->automatedReportsRepository->findResultByUuid($resultUuid);\n\n if (! $report) {\n throw new ModelNotFoundException('Report Result not found');\n }\n\n return $report;\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return $this->automatedReportsRepository->findChildResult($result, $type);\n }\n\n // prophet API calls\n /**\n * @throws ApplicationException\n */\n public function getGenerateReportPayload(AutomatedReport $automatedReport, string $reportResultUuid): array\n {\n $period = $this->calculateFromAndToDate($automatedReport);\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n return [\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResultUuid,\n 'report_type' => $automatedReport->getType(),\n 'media_types' => $automatedReport->getMediaTypes(),\n 'from_date' => $fromDate->startOfDay()->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->endOfDay()->format(DateTimeInterface::RFC3339),\n 'group_ids' => $automatedReport->getGroups(),\n 'call_deal_stage' => $automatedReport->getDealAtCallStages(),\n 'current_deal_stage' => $automatedReport->getCurrentDealStages(),\n 'deal_min_value' => $automatedReport->getDealValueMin(),\n 'deal_max_value' => $automatedReport->getDealValueMax(),\n 'call_types' => $automatedReport->getCallTypes(),\n 'call_duration_min_seconds' => $automatedReport->getCallDurationMin(),\n 'call_duration_max_seconds' => $automatedReport->getCallDurationMax(),\n 'special_requirements' => $automatedReport->getAdditionalPromptInput(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->formatReportPeriodName(\n $automatedReport->getFrequency(),\n $fromDate,\n $toDate,\n ),\n 'playbook_categories' => $automatedReport->getPlaybookCategories(),\n 'custom_name' => $automatedReport->getCustomName(),\n ];\n }\n\n // $inputPayload - FE payload structure\n public function getActivitiesCountPayload(array $inputPayload): array\n {\n // Use validateAndTransformData to validate and normalize input\n $validatedData = $this->validateAndTransformData($inputPayload);\n $period = $this->calculateFromAndToDatePeriod(\n $validatedData['frequency'],\n Carbon::parse($validatedData['from']),\n Carbon::parse($validatedData['to']),\n );\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n // Create payload similar to getGenerateReportPayload\n return [\n 'team_id' => $validatedData['team_id'],\n 'group_ids' => $validatedData['groups'] ?? [],\n 'report_type' => $validatedData['type'],\n 'from_date' => $fromDate->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->format(DateTimeInterface::RFC3339),\n 'call_deal_stage' => $validatedData['deal_at_call_stages'] ?? [],\n 'current_deal_stage' => $validatedData['current_deal_stages'] ?? [],\n 'deal_min_value' => $validatedData['deal_value_min'] ?? null,\n 'deal_max_value' => $validatedData['deal_value_max'] ?? null,\n 'call_types' => $validatedData['call_types'],\n 'call_duration_min_seconds' => $validatedData['call_duration_min'] ?? null,\n 'call_duration_max_seconds' => $validatedData['call_duration_max'] ?? null,\n 'special_requirements' => $validatedData['additional_prompt_input'] ?? null,\n 'playbook_categories' => $validatedData['playbook_categories'] ?? [],\n 'request_id' => null,\n 'callback_url' => null,\n ];\n }\n\n public function shouldSendReport(array $users, ?CarbonInterface $generatedAt = null): bool\n {\n if (empty($users)) {\n return false;\n }\n\n $earliestTz = collect($users)\n ->mapWithKeys(function (array $user) {\n $tz = new DateTimeZone($user['timezone']);\n $nowUtc = new DateTime('now', new DateTimeZone('UTC'));\n $offset = $tz->getOffset($nowUtc);\n\n return [$user['timezone'] => $offset];\n })\n ->sortDesc()\n ->keys()\n ->first();\n\n $now = Carbon::now($earliestTz);\n $isScheduledTime = (int) $now->format('H') === self::SENT_REPORT_AT_HOURS;\n\n if ($isScheduledTime) {\n return true;\n }\n\n return $this->hasPassedScheduledTime($generatedAt, $earliestTz);\n }\n\n public function hasPassedScheduledTime(?CarbonInterface $generatedAt, string $timezone): bool\n {\n if ($generatedAt === null) {\n return false;\n }\n\n $now = Carbon::now($timezone);\n $scheduledTime = $now->copy()->setTime(self::SENT_REPORT_AT_HOURS, 0, 0);\n\n if ($now->hour < self::SENT_REPORT_AT_HOURS) {\n $scheduledTime = $scheduledTime->subDay();\n }\n\n $scheduledTimeUtc = $scheduledTime->copy()->utc();\n $generatedAtUtc = $generatedAt->copy()->utc();\n $nowUtc = $now->copy()->utc();\n\n return $generatedAtUtc->lt($scheduledTimeUtc) && $nowUtc->gt($scheduledTimeUtc);\n }\n\n public function calculateFromAndToDatePeriod(\n string $frequency,\n ?Carbon $fromDate = null,\n ?Carbon $toDate = null\n ): array {\n if ($frequency === self::FREQUENCY_ONE_OFF) {\n return [\n 'fromDate' => $fromDate,\n 'toDate' => $toDate,\n ];\n }\n\n $now = Carbon::now();\n\n return match ($frequency) {\n self::FREQUENCY_DAILY => [\n 'fromDate' => $now->copy()->subDay()->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_WEEKLY => [\n 'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_MONTHLY => [\n 'fromDate' => $now->copy()->subMonths(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_QUARTERLY => [\n 'fromDate' => $now->copy()->subMonths(3)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n default => throw new InvalidArgumentException(\"Unsupported frequency: {$frequency}\"),\n };\n }\n\n private function calculateFromAndToDate(AutomatedReport $automatedReport): array\n {\n return $this->calculateFromAndToDatePeriod(\n $automatedReport->getFrequency(),\n $automatedReport->getFrom(),\n $automatedReport->getTo()\n );\n }\n\n public function getAskJiminnyGenerateReportPayload(\n AutomatedReport $automatedReport,\n AutomatedReportResult $reportResult,\n array $activityIds,\n ): array {\n return [\n 'user_question' => $automatedReport->getAskAnythingPrompt()?->getContent(),\n 'call_ids' => array_map('strval', $activityIds),\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResult->getUuid(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->getReportPeriodName($reportResult),\n 'report_name' => $automatedReport->getCustomName(),\n ];\n }\n\n private function getCallbackUrl(): string\n {\n return $this->webhookService->route('jiminny.webhook.reports.ready');\n }\n\n /**\n * Validate and transform payload data for automated reports\n *\n * @param array $data\n *\n * @throws InvalidArgumentException\n *\n * @return array\n */\n private function validateAndTransformData(array $data): array\n {\n // Validate organization (team) and check feature\n $team = $this->validateOrganization($data['organization'] ?? null);\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $type = $this->validateReportType($data['report_type'] ?? null);\n $frequency = $this->validateFrequency($data['frequency'] ?? null);\n $additionalPromptInput = $this->validateAdditionalPromptInput(\n $data['additional_prompt_input'] ?? null\n );\n $customReportName = $this->validateCustomReportName($data['custom_name'] ?? null);\n\n // Prepare data for the database\n $reportData = [\n 'team_id' => $team->getId(),\n 'type' => $type,\n 'status' => $status,\n 'frequency' => $frequency,\n 'additional_prompt_input' => $additionalPromptInput,\n 'custom_name' => $customReportName,\n ];\n\n // Validate deal values\n $reportData = $this->validateDealValues($data, $reportData);\n\n // Validate date range\n $reportData = $this->validateDateRange($data, $reportData, $frequency);\n\n // Validate call durations\n $reportData = $this->validateCallDurations($data, $reportData);\n\n // Validate call types\n $reportData = $this->validateCallTypes($data, $reportData);\n\n // Validate media types\n $reportData = $this->validateMediaTypes($data, $reportData);\n\n // Validate groups\n if (isset($data['teams'])) {\n $reportData['groups'] = $this->validateAndGetGroupIds($team, $data['teams']);\n }\n\n // Validate deal stages\n $reportData = $this->validateDealStages($data, $reportData, $team, $type);\n\n // Validate playbook categories\n $reportData = $this->validatePlaybookCategories($data, $reportData, $team);\n\n // Validate recipients\n $reportData['recipients'] = [\n 'users' => $this->validateAndGetUserIdsByTeam($team, $data['recipients'] ?? []),\n ];\n\n if (isset($data['jiminny_recipients'])) {\n // Validate Jiminny recipients\n $reportData['jiminny_recipients'] = [\n 'users' => $this->validateAndGetJiminnyUserIds((array) $data['jiminny_recipients']),\n ];\n }\n\n return $reportData;\n }\n\n private function validateDealValues(array $data, array $reportData): array\n {\n if (isset($data['min_deal_value'])) {\n $reportData['deal_value_min'] = (int) $data['min_deal_value'];\n\n if ($reportData['deal_value_min'] > 4294967295 || $reportData['deal_value_min'] < 0) {\n throw new InvalidArgumentException('Min deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_deal_value'])) {\n $reportData['deal_value_max'] = (int) $data['max_deal_value'];\n\n if ($reportData['deal_value_max'] > 4294967295 || $reportData['deal_value_max'] < 0) {\n throw new InvalidArgumentException('Max deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['min_deal_value'], $data['max_deal_value'])\n && $data['min_deal_value'] > $data['max_deal_value']\n ) {\n throw new InvalidArgumentException('Min deal value cannot be greater than max deal value');\n }\n\n return $reportData;\n }\n\n private function validateDateRange(array $data, array $reportData, string $frequency): array\n {\n // Set date range only for one_off frequency\n if ($frequency === 'one_off') {\n if (isset($data['start_date_period'])) {\n $reportData['from'] = $this->parseDate($data['start_date_period']);\n }\n\n if (isset($data['end_date_period'])) {\n $reportData['to'] = $this->parseDate($data['end_date_period']);\n }\n\n if (empty($reportData['from']) || empty($reportData['to'])) {\n throw new InvalidArgumentException(\n 'Start date and end date are required for one_off frequency'\n );\n }\n } else {\n $reportData['from'] = null;\n $reportData['to'] = null;\n }\n\n return $reportData;\n }\n\n private function validateCallDurations(array $data, array $reportData): array\n {\n // Convert call durations from minutes to seconds\n if (isset($data['min_call_duration'])) {\n $reportData['call_duration_min'] = (int) $data['min_call_duration'] * 60;\n\n if ($reportData['call_duration_min'] > 4294967295 || $reportData['call_duration_min'] < 0) {\n throw new InvalidArgumentException('Min call duration should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_call_duration'])) {\n $reportData['call_duration_max'] = (int) $data['max_call_duration'] * 60;\n\n if ($reportData['call_duration_max'] > 4294967295 || $reportData['call_duration_max'] < 0) {\n throw new InvalidArgumentException('Max call duration should be between 0 and 4294967295');\n }\n }\n\n return $reportData;\n }\n\n private function validateCallTypes(array $data, array $reportData): array\n {\n // Set call types\n $reportData['call_types'] = $data['call_type'] ?? [];\n if (empty($reportData['call_types'])) {\n $reportData['call_types'] = self::getCallTypes();\n }\n\n foreach ($reportData['call_types'] as $callType) {\n if (! in_array($callType, self::getCallTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Call type %s is invalid', $callType));\n }\n }\n\n return $reportData;\n }\n\n private function validateMediaTypes(array $data, array $reportData): array\n {\n // Set media types from input data\n $reportData['media_types'] = $data['media_types'] ?? [];\n\n if (empty($reportData['media_types'])) {\n throw new InvalidArgumentException('Media types are required');\n }\n\n foreach ($reportData['media_types'] as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n throw new InvalidArgumentException(sprintf('Media type %s is invalid', $mediaType));\n }\n }\n\n return $reportData;\n }\n\n private function validateDealStages(array $data, array $reportData, Team $team, string $reportType): array\n {\n // Validate and set deal stages\n if (isset($data['deal_stage_at_call'])) {\n $reportData['deal_at_call_stages'] =\n $this->validateAndGetDealStageIds($team, $data['deal_stage_at_call'], 'Deal stage at call');\n }\n\n if (isset($data['current_deal_stage'])) {\n $reportData['current_deal_stages'] =\n $this->validateAndGetDealStageIds($team, $data['current_deal_stage'], 'Current deal stage');\n }\n\n // Ensure current_deal_stage is not provided for loss_analysis report type\n if ($reportType === self::TYPE_LOSS_ANALYSIS && ! empty($data['current_deal_stage'])) {\n throw new InvalidArgumentException('Current deal stage is not applicable for Loss Analysis reports');\n }\n\n return $reportData;\n }\n\n // transform uuid to id\n private function validatePlaybookCategories(array $data, array $reportData, Team $team): array\n {\n $key = 'playbook_categories';\n\n if (isset($data[$key])) {\n $payloadIds = $data[$key];\n $ids = [];\n\n foreach ($payloadIds as $uuid) {\n $uuid = (string) $uuid;\n\n try {\n $playbookCategory = $this->playbookCategoryRepository->findByUuid($uuid);\n } catch (Throwable $throwable) {\n Log::error(__METHOD__ . ' ' . $throwable->getMessage());\n\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory) {\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory->hasPlaybook()) {\n throw new InvalidArgumentException(sprintf('Playbook category %s has no playbook', $uuid));\n }\n\n if ($playbookCategory->getPlaybook()->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Playbook category %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $ids[] = $playbookCategory->getId();\n }\n\n $reportData[$key] = $ids;\n }\n\n return $reportData;\n }\n\n private function validateReportStatus($status): bool\n {\n if (! in_array($status, [true, false], true)) {\n throw new InvalidArgumentException('Report status is invalid');\n }\n\n return $status;\n }\n\n private function validateReportType($type): string\n {\n if (! in_array($type, self::getTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Report type is invalid: %s', $type));\n }\n\n return $type;\n }\n\n private function validateFrequency($frequency): string\n {\n if (! in_array($frequency, self::getFrequencies(), true)) {\n throw new InvalidArgumentException('Frequency is invalid');\n }\n\n return $frequency;\n }\n\n private function validateAdditionalPromptInput(?string $additionalPromptInput): ?string\n {\n if ($additionalPromptInput && strlen($additionalPromptInput) > 5000) {\n throw new InvalidArgumentException('Additional Prompt Input should be less than 5000 characters');\n }\n\n return $additionalPromptInput;\n }\n\n private function validateCustomReportName(?string $customReportName): ?string\n {\n if ($customReportName === null || $customReportName === '') {\n return null;\n }\n\n if (strlen($customReportName) > 70) {\n throw new InvalidArgumentException('Custom report name should be less than 70 characters');\n }\n\n return $customReportName;\n }\n\n private function validateOrganization(?string $organizationUuid): Team\n {\n if (! $organizationUuid) {\n throw new InvalidArgumentException('Organization is required');\n }\n\n $team = $this->teamRepository->idOrUuid($organizationUuid);\n\n if (! $team) {\n throw new InvalidArgumentException('Organization not found');\n }\n\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n throw new InvalidArgumentException('Organization does not have the Automated Reports feature');\n }\n\n return $team;\n }\n\n private function validateAndGetGroupIds(Team $team, array $teamUuids): array\n {\n $groupIds = [];\n\n foreach ($teamUuids as $uuid) {\n $group = $this->groupRepository->findByUuid($uuid);\n\n if ($group === null || $group->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Group %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $groupIds[] = $group->getId();\n\n }\n\n return $groupIds;\n }\n\n private function validateAndGetDealStageIds(Team $team, array $stageUuids, string $propertyLabel): array\n {\n $stageIds = [];\n\n foreach ($stageUuids as $uuid) {\n $stage = $this->stageRepository->findByUuid($uuid);\n\n if ($stage === null || $stage->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Stage %s not found for team %s for %s', $uuid, $team->getUuid(), $propertyLabel)\n );\n }\n\n $stageIds[] = $stage->getId();\n }\n\n return $stageIds;\n }\n\n private function validateAndGetUserIds(array $userUuids, callable $teamCheck): array\n {\n if (empty($userUuids)) {\n return [];\n }\n\n $userIds = [];\n\n foreach ($userUuids as $uuid) {\n $user = $this->userRepository->findByUuid($uuid);\n\n if (! $user || ! $user->isStatusActive()) {\n throw new InvalidArgumentException(\n sprintf('User %s not found or is not active', $uuid)\n );\n }\n\n if (! $teamCheck($user)) {\n throw new InvalidArgumentException(\n sprintf('User %s does not belong to the allowed team(s)', $uuid)\n );\n }\n\n $userIds[] = $user->getId();\n }\n\n return $userIds;\n }\n\n private function validateAndGetUserIdsByTeam(Team $team, array $userUuids): array\n {\n return $this->validateAndGetUserIds($userUuids, fn ($user) => $user->getTeamId() === $team->getId());\n }\n\n private function validateAndGetJiminnyUserIds(array $userUuids): array\n {\n $allowedTeamIds = config('kiosk.teamIds', []);\n\n return $this->validateAndGetUserIds($userUuids, fn ($user) => in_array($user->getTeamId(), $allowedTeamIds, true));\n }\n\n private function parseDate(string $dateString): string\n {\n return date('Y-m-d H:i:s', strtotime($dateString));\n }\n\n private function generateReportResultViewUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.view', ['uuid' => $result->getUuid()]);\n }\n\n private function generateReportResultDownloadUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.download', ['uuid' => $result->getUuid()]);\n }\n\n private function getReportMediaRouteResource(AutomatedReportResult $result): string\n {\n if ($result->getMediaType() === self::MEDIA_TYPE_PDF) {\n return self::PDF_KEY;\n } elseif ($result->getMediaType() === self::MEDIA_TYPE_PODCAST) {\n return self::AUDIO_KEY;\n }\n\n throw new \\InvalidArgumentException('Unknown media type.');\n }\n\n public function getMediaPath(AutomatedReportResult $result): ?string\n {\n $url = match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => $result->getPdfUrl(),\n self::MEDIA_TYPE_PODCAST => $result->getPodcastAudioUrl(),\n default => null,\n };\n\n if ($url === null) {\n return null;\n }\n\n $path = parse_url(trim($url, '\"\\''), PHP_URL_PATH);\n\n return $path ?: null;\n }\n\n public function getFilenameSuffix(AutomatedReportResult $result): ?string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => 'Podcast',\n default => null,\n };\n }\n\n public function getMailSubjectSuffix(AutomatedReportResult $result): string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => 'report',\n self::MEDIA_TYPE_PODCAST => 'podcast',\n default => '',\n };\n }\n\n public function getMediaTypeMetadata(AutomatedReportResult $result): array\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => ['extension' => 'mp3', 'mime' => 'audio/mpeg'],\n self::MEDIA_TYPE_PDF => ['extension' => 'pdf', 'mime' => 'application/pdf'],\n default => ['extension' => null, 'mime' => null],\n };\n }\n\n public function deleteS3Files(AutomatedReportResult $result): void\n {\n $teamUuid = $result->getReport()->getTeam()->getUuid();\n $reportUuid = $result->getUuid();\n\n // delete all files for a report uuid no mather of pdf, podcast, or both\n // in case of both - the podcast files are linked to the pdf (parent) uuid\n // pdf and podcast date times should be close\n $path = sprintf('%s/%s/%s', $teamUuid, self::S3_DIR, $reportUuid);\n\n foreach (self::FILE_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted S3 file', [\n 'path' => $file,\n ]);\n }\n }\n\n foreach (self::FILE_PODCAST_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '_podcast.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted Podcast S3 file', [\n 'path' => $file,\n ]);\n }\n }\n }\n\n /**\n *\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): Collection\n {\n return $this->automatedReportsRepository->getTeamIdsWithReportsResults($teamId);\n }\n\n /**\n * Core delete logic for report results using a query\n *\n * @param Builder $query\n * @param array $logContext\n *\n * @return int\n */\n private function deleteReportResultsByQuery(Builder $query, array $logContext = []): int\n {\n $deletedCount = 0;\n\n if ($query->exists()) {\n Log::info(\n 'Run delete report results',\n array_merge(\n $logContext,\n [\n 'service' => 'AutomatedReportsService',\n ]\n )\n );\n\n $query->chunkById(50, function ($results) use (&$deletedCount, $logContext) {\n foreach ($results as $result) {\n $this->deleteReportResult($result);\n $deletedCount++;\n\n Log::info(\n 'Deleted a report result',\n array_merge(\n $logContext,\n [\n 'result_id' => $result->getId(),\n 'report_id' => $result->getReportId(),\n ]\n )\n );\n }\n });\n }\n\n return $deletedCount;\n }\n\n /**\n * Delete report results for a team by retention period\n *\n * @param Team $team\n * @param CarbonImmutable $retentionDate\n *\n * @return int Number of deleted report results\n */\n public function deleteReportsResultsInRetentionPeriod(Team $team, CarbonImmutable $retentionDate): int\n {\n $reportIds = $this->automatedReportsRepository->getReportIdsByTeam($team);\n\n if ($reportIds->isEmpty()) {\n return 0;\n }\n\n $query = $this->automatedReportsRepository\n ->getReportResultsQueryForRetention($team, $retentionDate);\n\n return $this->deleteReportResultsByQuery($query, [\n 'team_id' => $team->getId(),\n 'retention_date' => $retentionDate->toDateTimeString(),\n ]);\n }\n\n /**\n * Delete ALL report results for a specific automated report\n *\n * @param string $uuid\n *\n * @return int\n */\n public function deleteReportResults(string $uuid): int\n {\n $report = $this->getReport($uuid);\n\n $query = $this->automatedReportsRepository->getResultsByReportQuery($report);\n\n return $this->deleteReportResultsByQuery($query, [\n 'report_uuid' => $uuid,\n 'report_id' => $report->getId(),\n ]);\n }\n\n public function deleteReportResult(AutomatedReportResult $result): void\n {\n $this->deleteS3Files($result);\n\n $result->delete();\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getTeamReports(Team $team): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getReportsByTeam($team);\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getReportResults(AutomatedReport $report): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getResultsByReport($report);\n }\n\n public function deleteAllReportResults(AutomatedReport $report): void\n {\n $results = $this->getReportResults($report);\n\n /** @var AutomatedReportResult $result */\n foreach ($results as $result) {\n Log::info('Deleting result', [\n 'report' => $report->getId(),\n 'result' => $result->getId(),\n ]);\n\n $this->deleteReportResult($result);\n }\n }\n\n public function deleteAllData(Team $team): void\n {\n Log::info('Deleting automated report and results for team', [\n 'team' => $team->getId(),\n ]);\n\n $reports = $this->getTeamReports($team);\n\n /** @var AutomatedReport $report */\n foreach ($reports as $report) {\n Log::info('Deleting report', [\n 'team' => $team->getId(),\n 'report' => $report->getId(),\n ]);\n\n $this->deleteAllReportResults($report);\n\n $report->delete();\n }\n }\n}","depth":4,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Kiosk\\AutomatedReports;\n\nuse Carbon\\CarbonImmutable;\nuse Carbon\\CarbonInterface;\nuse Carbon\\Exceptions\\InvalidFormatException;\nuse DateTime;\nuse DateTimeInterface;\nuse DateTimeZone;\nuse Illuminate\\Contracts\\Bus\\Dispatcher as BusDispatcher;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Support\\Facades\\Log;\nuse Illuminate\\Support\\Facades\\Storage;\nuse Jiminny\\Component\\ActivitySearch\\FilterDefinition\\InputTypeEnum;\nuse Jiminny\\Component\\AskAnything\\AskAnythingPromptService;\nuse Jiminny\\Component\\AskAnything\\Dtos\\AskAnythingPromptDto;\nuse Jiminny\\Component\\UrlGenerator\\Webhook;\nuse Jiminny\\Contracts\\Repositories\\PlaybookCategoryRepository;\nuse Jiminny\\Contracts\\Repositories\\TeamRepository;\nuse Jiminny\\Contracts\\Repositories\\UserRepository;\nuse Jiminny\\Exceptions\\ApplicationException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Exceptions\\ModelNotFoundException;\nuse Jiminny\\Jobs\\AutomatedReports\\RequestGenerateReportJob;\nuse Jiminny\\Models\\Activity\\Search;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPrompt;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPromptTarget;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Contracts\\UserContract;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Repositories\\AskAnythingRepository;\nuse Jiminny\\Repositories\\AutomatedReportsRepository;\nuse Jiminny\\Repositories\\GroupRepository;\nuse Jiminny\\Repositories\\SearchRepository;\nuse Jiminny\\Repositories\\StageRepository;\nuse Throwable;\n\nclass AutomatedReportsService\n{\n public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';\n public const string TYPE_ASK_JIMINNY = 'ask_jiminny';\n\n /**\n * Standard report types (used by kiosk for existing automated reports).\n */\n // @TODO this will add filter, however if we need to control feature by FF we need conditional logic\n public const array TYPES = [\n ['id' => 'exec_summary', 'name' => 'Exec Summary'],\n ['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],\n ['id' => 'product_feedback', 'name' => 'Product Feedback'],\n ['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],\n// ['id' => 'questions', 'name' => 'Questions'],\n// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],\n ];\n\n public const array ALL_TYPES = [\n ...self::TYPES,\n ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],\n ];\n\n public const string FREQUENCY_DAILY = 'daily';\n public const string FREQUENCY_WEEKLY = 'weekly';\n public const string FREQUENCY_MONTHLY = 'monthly';\n public const string FREQUENCY_QUARTERLY = 'quarterly';\n public const string FREQUENCY_ONE_OFF = 'one_off';\n\n /**\n * Frequencies for standard (non-Ask Jiminny) reports.\n */\n public const array FREQUENCIES = [\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n\n /**\n * Frequencies for Ask Jiminny reports.\n */\n public const array ASK_JIMINNY_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ];\n\n public const string MEDIA_TYPE_PDF = 'pdf';\n public const string MEDIA_TYPE_PODCAST = 'podcast';\n public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];\n public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];\n public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];\n public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];\n\n public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];\n public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];\n public const int SENT_REPORT_AT_HOURS = 5;\n public const string PDF_KEY = 'pdf';\n public const string AUDIO_KEY = 'audio';\n\n private const array ALL_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n private const string S3_DIR = 'reports';\n private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];\n private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];\n\n public function __construct(\n private readonly TeamRepository $teamRepository,\n private readonly GroupRepository $groupRepository,\n private readonly UserRepository $userRepository,\n private readonly StageRepository $stageRepository,\n private readonly DealStagesService $dealStagesService,\n private readonly RecipientsService $recipientsService,\n private readonly AutomatedReportsRepository $automatedReportsRepository,\n private readonly Webhook $webhookService,\n private readonly BusDispatcher $dispatcher,\n private readonly ActivityTypeService $activityTypeService,\n private readonly PlaybookCategoryRepository $playbookCategoryRepository,\n private readonly AskAnythingPromptService $askAnythingPromptService,\n private readonly SearchRepository $activitySearchRepository,\n private readonly AskAnythingRepository $askAnythingRepository,\n ) {\n }\n\n public static function getTypes(): array\n {\n $types = self::TYPES;\n\n return array_map(static function ($type) {\n return $type['id'];\n }, $types);\n }\n\n public static function getCallTypes(): array\n {\n return array_map(static function ($callType) {\n return $callType['id'];\n }, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);\n }\n\n public static function getFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::FREQUENCIES);\n }\n\n // front-facing structure\n public function getReportEnabledFieldData(bool $value = false): array\n {\n return [\n 'id' => 'report_enabled',\n 'label' => '',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'value' => $value,\n ];\n }\n\n // Organizations = Teams\n public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array\n {\n $options = $this->getTeams();\n\n if ($shortVersion) {\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value,\n 'dependencies' => [\n 'teams',\n 'deal_stage_at_call',\n 'current_deal_stage',\n 'recipients',\n ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,\n ],\n 'dependsOn' => [],\n ];\n }\n\n // Teams = Groups\n public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array\n {\n if ($shortVersion) {\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value, // value should be an array of objects {id, name}\n 'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],\n 'dependsOn' => [],\n ];\n }\n\n public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array\n {\n $types = [];\n if ($team instanceof Team) {\n if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n $types = self::TYPES;\n }\n if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {\n $types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];\n }\n } else {\n $types = self::TYPES;\n }\n\n if ($shortVersion) {\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'options' => $types,\n ];\n }\n\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $types,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getFrequencyFieldData(?string $value = null): array\n {\n return [\n 'id' => 'frequency',\n 'label' => 'Frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::FREQUENCIES,\n 'value' => $value,\n 'dependencies' => ['period'],\n 'dependsOn' => [],\n ];\n }\n\n public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array\n {\n return [\n 'id' => 'period',\n 'label' => 'Select one-off period',\n 'inputType' => InputTypeEnum::DATE_RANGE,\n 'required' => true,\n 'placeholder' => 'Select',\n 'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],\n 'queryParams' => [\n 'startDate' => 'start_date_period',\n 'endDate' => 'end_date_period',\n ],\n 'dependencies' => [],\n 'dependsOn' => ['frequency'],\n ];\n }\n\n public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array\n {\n return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);\n }\n\n public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);\n }\n\n public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);\n }\n\n public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'deal_value',\n 'label' => 'Deal Value',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_deal_value',\n 'max' => 'max_deal_value',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array\n {\n $value = [];\n $conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;\n $dialerOn && $value[] = self::CALL_TYPE_DIALER;\n\n return [\n 'id' => 'call_type',\n 'label' => 'Call Type',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => [\n self::CALL_TYPE_CONFERENCE,\n self::CALL_TYPE_DIALER,\n ],\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getMediaTypeFieldData(?AutomatedReport $report = null): array\n {\n $value = [];\n\n if ($report) {\n $value = $this->transformMediaTypes($report);\n }\n\n return [\n 'id' => 'media_types',\n 'label' => 'Export as',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => self::MEDIA_TYPE_OBJECTS,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'call_duration',\n 'label' => 'Call Duration',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_call_duration',\n 'max' => 'max_call_duration',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getRecipientsFieldData(?Team $team = null, array $value = []): array\n {\n return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);\n }\n\n public function getJiminnyRecipientsFieldData(array $value = []): array\n {\n return $this->recipientsService->getJiminnyRecipientsFieldData($value);\n }\n\n public function getAdditionalPromptInputFieldData(?string $value = null): array\n {\n return [\n 'id' => 'additional_prompt_input',\n 'label' => 'Special requirements',\n 'inputType' => InputTypeEnum::TEXTAREA,\n 'required' => false,\n 'placeholder' => 'What should be the focus of the report?',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCustomReportNameFieldData(?string $value = null): array\n {\n return [\n 'id' => 'custom_name',\n 'label' => 'Custom report name',\n 'inputType' => InputTypeEnum::TEXT,\n 'required' => false,\n 'placeholder' => 'Enter custom name',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n // data providers\n public function getTeams(): array\n {\n $teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);\n\n $teamData = [];\n foreach ($teams as $team) {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n continue;\n }\n\n $teamData[] = $this->transformTeam($team);\n }\n\n return $teamData;\n }\n\n public function getTeamGroups(string $teamUuid): array\n {\n $data = [];\n $team = $this->getTeam($teamUuid);\n\n if ($team !== null) {\n $groups = $team->groups()->get();\n\n foreach ($groups as $group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n public function getTeamsGroupsOptions(array $filterTeamUuids = []): array\n {\n $data = [];\n $teams = $this->getTeams();\n\n foreach ($teams as $team) {\n if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {\n continue;\n }\n\n $data[] = [\n 'label' => $team['name'],\n 'groups' => $this->getTeamGroups($team['id']),\n ];\n }\n\n return $data;\n }\n\n public function getTeam(string $teamUuid): ?Team\n {\n return $this->teamRepository->idOrUuid($teamUuid);\n }\n\n public function getTeamById(int $teamId): ?Team\n {\n return $this->teamRepository->find($teamId);\n }\n\n public function getGroupsUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportGroups = $report->getGroups();\n foreach ($reportGroups as $groupId) {\n if ($group = $this->groupRepository->find($groupId)) {\n $uuids[] = $group->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getPlaybookCategoriesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $playbookCategories = $report->getPlaybookCategories();\n foreach ($playbookCategories as $id) {\n if ($category = $this->playbookCategoryRepository->find($id)) {\n $uuids[] = $category->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getDealAtCallStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getDealAtCallStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getCurrentDealStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getCurrentDealStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getRecipients());\n }\n\n public function getJiminnyUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function extractUserUuids(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => $user->getUuid())\n ->values()\n ->all();\n }\n\n // get mail data\n public function getRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getRecipients());\n }\n\n /**\n * @return array<UserContract>\n */\n public function getRecipientUserObjects(AutomatedReport $report): array\n {\n $userIds = $report->getRecipients()['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->values()\n ->all();\n }\n\n private function getJiminnyRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function buildRecipientUsers(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => [\n 'email' => $user->getEmailAddress(),\n 'name' => $user->getName(),\n 'timezone' => $user->getTimezone()->getName(),\n ])\n ->values()\n ->all();\n }\n\n public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array\n {\n if ($report->isAskJiminnyReport()) {\n $recipients = $this->resolveAskJiminnyRecipients($report);\n } else {\n $recipients = $this->getRecipientUsers($report);\n if ($includeJiminny) {\n $recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));\n }\n }\n\n $emails = [];\n\n return array_values(array_filter(\n $recipients,\n static function ($recipient) use (&$emails) {\n if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {\n return false;\n }\n $emails[] = $recipient['email'];\n\n return true;\n }\n ));\n }\n\n private function resolveAskJiminnyRecipients(AutomatedReport $report): array\n {\n $recipients = [];\n\n $creator = $report->getCreator();\n if ($creator !== null) {\n $recipients[] = [\n 'email' => $creator->getEmailAddress(),\n 'name' => $creator->getName(),\n 'timezone' => $creator->getTimezone()->getName(),\n ];\n }\n\n return array_merge(\n $recipients,\n $this->buildRecipientUsers($report->getRecipients()),\n $this->getGroupRecipientUsers($report),\n );\n }\n\n private function getGroupRecipientUsers(AutomatedReport $report): array\n {\n $users = [];\n foreach ($report->getGroups() as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group === null) {\n continue;\n }\n foreach ($group->getMembers() as $member) {\n $users[] = [\n 'email' => $member->getEmailAddress(),\n 'name' => $member->getName(),\n 'timezone' => $member->getTimezone()->getName(),\n ];\n }\n }\n\n return $users;\n }\n\n public function getReportTypeName(AutomatedReportResult $report): string\n {\n $type = $report->getReport()->getType();\n\n $getType = $this->transformReportType($type);\n\n return $getType['name'];\n }\n\n public function getReportPeriodName(AutomatedReportResult $report): string\n {\n $from = $report->getFromDate();\n $to = $report->getToDate();\n $frequency = $report->getReport()->getFrequency();\n\n if ($from === null || $to === null) {\n if (! $report->getReport()->isAskJiminnyReport()) {\n $invalidPeriod = $from === null ? 'from' : 'to';\n\n throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);\n }\n\n $period = $this->calculateFromAndToDatePeriod($frequency);\n $from = $period['fromDate'];\n $to = $period['toDate'];\n }\n\n return $this->formatReportPeriodName($frequency, $from, $to);\n }\n\n private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string\n {\n $fromYear = $from->format('Y');\n $toYear = $to->format('Y');\n $differentYears = $fromYear !== $toYear;\n\n switch ($frequency) {\n case self::FREQUENCY_DAILY:\n return $from->format('j M Y');\n\n case self::FREQUENCY_QUARTERLY:\n // 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ\n $startMonth = $from->format('M');\n $endMonth = $to->copy()->subMonth();\n $endMonthName = $endMonth->format('M');\n $endMonthYear = $endMonth->format('Y');\n\n if ($differentYears) {\n return \"{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}\";\n }\n\n return \"{$startMonth} - {$endMonthName} {$toYear}\";\n\n case self::FREQUENCY_MONTHLY:\n // 'May 2025' - monthly reports are always within the same year\n return $from->format('M Y');\n\n case self::FREQUENCY_WEEKLY:\n // '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ\n $startDay = $from->format('j');\n $endDay = $to->format('j');\n $startMonth = $from->format('M');\n $endMonth = $to->format('M');\n\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n if ($startMonth !== $endMonth) {\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n return \"{$startDay} - {$endDay} {$endMonth} {$toYear}\";\n\n case self::FREQUENCY_ONE_OFF:\n // '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ\n $startDay = $from->format('j');\n $startMonth = $from->format('M');\n $endDay = $to->format('j');\n $endMonth = $to->format('M');\n\n // If same month and year, use a format like '2-31 May 2025'\n if ($startMonth === $endMonth && ! $differentYears) {\n return \"{$startDay} - {$endDay} {$startMonth} {$toYear}\";\n }\n\n // If different years, include both years\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n // Same year but different months\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n\n default:\n // Default format for unknown frequencies\n return $from->format('j M Y') . ' - ' . $to->format('j M Y');\n }\n }\n\n public function getReportTeamsName(AutomatedReportResult $report): string\n {\n $groups = $report->getGroups();\n\n if (empty($groups)) {\n return 'All';\n }\n\n // Get group names from repository\n $groupNames = [];\n foreach ($groups as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group) {\n $groupNames[] = $group->getName();\n }\n }\n\n if (count($groupNames) === 1) {\n // Single team format\n $teamsName = $groupNames[0];\n } else {\n // Multiple teams format\n $teamsName = implode(', ', $groupNames);\n }\n\n return $teamsName;\n }\n\n public function getReportFileName(AutomatedReportResult $report): string\n {\n $customName = $report->getReport()->getCustomName();\n $periodName = $this->getReportPeriodName($report);\n $filenameSuffix = $this->getFilenameSuffix($report);\n\n if ($customName) {\n if ($filenameSuffix) {\n $customName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$customName} - {$periodName}\");\n }\n\n $baseName = $this->getReportTypeName($report);\n\n if ($filenameSuffix) {\n $baseName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}\");\n }\n\n public function getReportFileNameWithExtension(AutomatedReportResult $result): string\n {\n $extension = $this->getMediaTypeMetadata($result)['extension'];\n\n return $this->getReportFileName($result) . '.' . $extension;\n }\n\n public function sanitizeFileName(string $fileName): string\n {\n return str_replace(['/', '\\\\'], '-', $fileName);\n }\n\n public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool\n {\n $recipients = array_map('intval', $report->getRecipients()['users'] ?? []);\n\n return in_array($user->getId(), $recipients);\n }\n\n public function transformReportResults(Collection $automatedReportResults): array\n {\n $data = [];\n foreach ($automatedReportResults as $automatedReportResult) {\n /** @var AutomatedReportResult $automatedReportResult */\n\n $report = $automatedReportResult->getReport();\n\n $createdBy = $report->getCreator();\n $creator = [\n 'id' => $createdBy?->getUuid(),\n 'name' => $createdBy?->getName(),\n 'email' => $createdBy?->getEmailAddress(),\n 'photoUrl' => $createdBy?->getPhotoUrl(),\n ];\n\n $recipients = $this->buildRecipients($report);\n\n $data[] = [\n 'id' => $automatedReportResult->getUuid(),\n 'name' => $automatedReportResult->getName(),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n 'recipients' => $recipients,\n 'recipients' => [\n ...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),\n ...array_values($this->transformRecipients($report->getRecipients())),\n ],\n 'report_type' => $this->transformReportType($report->getType()),\n 'media_type' => $automatedReportResult->getMediaType(),\n 'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),\n 'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),\n 'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),\n 'creator' => $creator,\n ];\n \n \n }\n\n return $data;\n }\n\n private function buildRecipients(AutomatedReport $report)\n {\n \n }\n\n public function hasCallTypeConference(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);\n }\n\n public function hasCallTypeDialer(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);\n }\n\n // transformers\n private function transformTeam(Team $team): array\n {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n return [];\n }\n\n return [\n 'id' => $team->getUuid(),\n 'name' => $team->getName(),\n ];\n }\n\n private function transformReportFullView(AutomatedReport $report): array\n {\n $base = $this->transformReportBase($report);\n\n return $report->getType() === self::TYPE_ASK_JIMINNY\n ? $base + $this->transformAskJiminnyFields($report)\n : $base + $this->transformStandardReportFields($report);\n }\n\n private function transformReportBase(AutomatedReport $report): array\n {\n return [\n 'id' => $report->getUuid(),\n 'organization' => $this->transformOrganization(team: $report->getTeam()),\n 'report_type' => $this->transformReportType($report->getType()),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n ];\n }\n\n private function transformStandardReportFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n\n return [\n 'report_enabled' => $report->getStatus(),\n 'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),\n 'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),\n 'deal_value_min' => $report->getDealValueMin(),\n 'deal_value_max' => $report->getDealValueMax(),\n 'call_types' => $this->transformCallType($report->getCallTypes()),\n 'media_types' => $this->transformMediaTypes($report),\n 'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),\n 'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),\n 'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),\n 'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),\n 'recipients' => $this->transformRecipients($report->getRecipients()),\n 'created_by' => $this->transformCreator($report->getCreator()),\n 'additional_prompt_input' => $report->getAdditionalPromptInput(),\n 'custom_name' => $report->getCustomName(),\n 'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),\n 'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),\n 'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),\n ];\n }\n\n private function transformAskJiminnyFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n $creatorId = $report->getAttribute('created_by');\n $explicitUserIds = array_values(array_filter(\n $report->getRecipients()['users'] ?? [],\n static fn ($id) => $id !== $creatorId\n ));\n\n return [\n 'report_name' => $report->getCustomName(),\n 'enabled' => $report->getStatus(),\n 'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),\n 'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),\n 'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),\n 'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),\n ];\n }\n\n private function transformOrganization(?Team $team): array\n {\n return [\n 'id' => $team?->getUuid(),\n 'name' => $team?->getName(),\n ];\n }\n\n private function transformReportType(string $type): array\n {\n foreach (self::ALL_TYPES as $typeItem) {\n if ($typeItem['id'] === $type) {\n return $typeItem;\n }\n }\n\n return [];\n }\n\n private function transformCallType(array $types): array\n {\n $result = [];\n $callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];\n\n foreach ($types as $type) {\n foreach ($callTypes as $callTypeItem) {\n if ($callTypeItem['id'] === $type) {\n $result[] = $callTypeItem;\n\n break;\n }\n }\n }\n\n return $result;\n }\n\n private function transformMediaTypes(AutomatedReport $report): array\n {\n $values = [];\n\n foreach ($report->getMediaTypes() as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n continue;\n }\n\n $values[] = match ($mediaType) {\n self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,\n self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,\n };\n }\n\n return $values;\n }\n\n private function transformFrequency(string $frequency): array\n {\n foreach (self::ALL_FREQUENCIES as $frequencyItem) {\n if ($frequencyItem['id'] === $frequency) {\n return $frequencyItem;\n }\n }\n\n return [];\n }\n\n public function transformDurationToMinutes(?int $duration): ?int\n {\n if (! $duration) {\n return null;\n }\n\n return (int) ($duration / 60);\n }\n\n private function transformGroups(?Team $team, array $groupsIds): array\n {\n if (empty($groupsIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($groupsIds as $groupId) {\n $group = $team->groups()->where('id', $groupId)->first();\n\n if ($group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n 'photoUrl' => $group->getPhotoUrl(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformStages(?Team $team, array $stagesIds): array\n {\n if (empty($stagesIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($stagesIds as $stageId) {\n $stage = $team->stages()->where('id', $stageId)->first();\n\n if ($stage) {\n $data[] = [\n 'id' => $stage->getUuid(),\n 'name' => $stage->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformRecipients(array $recipients): array\n {\n $users = [];\n foreach ($recipients['users'] ?? [] as $userId) {\n $users[] = $this->transformUser($userId);\n }\n\n return $users;\n }\n\n private function transformCreator(?User $user): ?array\n {\n if ($user === null) {\n return null;\n }\n\n return $this->transformUser($user->getId());\n }\n\n private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array\n {\n if ($prompt === null) {\n return null;\n }\n\n return [\n 'id' => $prompt->getUuid(),\n 'name' => $prompt->getTitle(),\n ];\n }\n\n private function transformSafeSearch(?Search $search): ?array\n {\n if ($search === null) {\n return null;\n }\n\n return [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ];\n }\n\n private function transformUser(int $userId): array\n {\n /* @var ?User $user */\n $user = $this->userRepository->find($userId);\n\n return [\n 'id' => $user?->getUuid(),\n 'name' => $user?->getName(),\n 'email' => $user?->getEmailAddress(),\n 'photoUrl' => $user?->getPhotoUrl(),\n ];\n }\n\n public function create(array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $validatedData['created_by'] = auth()->id();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function update(string $uuid, array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $report = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $report) {\n throw new InvalidArgumentException('Report not found');\n }\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Create an Ask Jiminny report.\n */\n public function createAskJiminnyReport(array $data, User $creator): array\n {\n $validatedData = $this->validateAskJiminnyReportData($data, $creator);\n $validatedData['created_by'] = $creator->getId();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Update an Ask Jiminny report.\n */\n public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array\n {\n if (! $report->isAskJiminnyReport()) {\n throw new InvalidArgumentException('Report is not an Ask Jiminny report');\n }\n\n $validatedData = $this->validateAskJiminnyReportData($data, $user);\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array\n {\n $this->automatedReportsRepository->update($report, ['status' => $status]);\n\n return $this->transformReportFullView($report->fresh());\n }\n\n /**\n * Validate and transform data for Ask Jiminny reports.\n */\n private function validateAskJiminnyReportData(array $data, User $user): array\n {\n // Validate name\n $name = trim($data['report_name'] ?? '');\n if (empty($name)) {\n throw new InvalidArgumentException('Report name is required');\n }\n if (mb_strlen($name) > 50) {\n throw new InvalidArgumentException('Report name must be 50 characters or less');\n }\n\n // Validate frequency (only daily, weekly, monthly for Ask Jiminny)\n $frequency = $data['frequency'] ?? null;\n $askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];\n if (! in_array($frequency, $askJiminnyFrequencies, true)) {\n throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');\n }\n\n // Validate expiration date\n $expiresAt = $data['expires_on'] ?? null;\n if (empty($expiresAt)) {\n throw new InvalidArgumentException('Expiration date is required');\n }\n\n try {\n $expiresAtDate = Carbon::parse($expiresAt);\n } catch (InvalidFormatException $e) {\n throw new InvalidArgumentException('Expiration date format is invalid');\n }\n $maxExpiration = Carbon::now()->addYear()->endOfDay();\n if ($expiresAtDate->gt($maxExpiration)) {\n throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');\n }\n if ($expiresAtDate->isPast()) {\n throw new InvalidArgumentException('Expiration date cannot be in the past');\n }\n\n // Validate saved search\n $activitySearchId = $data['saved_search'] ?? null;\n if (empty($activitySearchId)) {\n throw new InvalidArgumentException('Saved search is required');\n }\n $savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);\n if (! $savedSearch) {\n throw new InvalidArgumentException('Saved search not found or does not belong to you');\n }\n\n // Validate saved prompt\n $askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;\n if (empty($askAnythingPromptId)) {\n throw new InvalidArgumentException('Ask Jiminny prompt is required');\n }\n $prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);\n if (! $prompt) {\n throw new InvalidArgumentException('Ask Jiminny prompt not found');\n }\n\n // Validate status\n $status = $data['enabled'] ?? false;\n\n $recipientUserIds = [$user->getId()];\n\n if (! empty($data['share_users'])) {\n $sharedUserIds = $this->validateAndGetUserIdsByTeam(\n $user->team,\n (array) $data['share_users']\n );\n $recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);\n }\n\n $sharedGroupIds = [];\n if (! empty($data['share_teams'])) {\n $sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);\n }\n\n $recipientUserIds = array_values(array_unique($recipientUserIds));\n\n return [\n 'team_id' => $user->getTeamId(),\n 'type' => self::TYPE_ASK_JIMINNY,\n 'status' => (bool) $status,\n 'frequency' => $frequency,\n 'custom_name' => $name,\n 'activity_search_id' => $savedSearch->getId(),\n 'ask_anything_prompt_id' => $prompt->getId(),\n 'expires_at' => $expiresAtDate->toDateString(),\n 'media_types' => [self::MEDIA_TYPE_PDF],\n 'call_types' => [],\n 'recipients' => ['users' => $recipientUserIds],\n 'groups' => $sharedGroupIds,\n ];\n }\n\n public static function getAskJiminnyFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::ASK_JIMINNY_FREQUENCIES);\n }\n\n public function getAskJiminnyReportFilters(User $user): array\n {\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n return [\n [\n 'id' => 'prompt',\n 'label' => 'Prompt',\n 'options' => $prompts,\n ],\n [\n 'id' => 'saved_search',\n 'label' => 'Saved Search',\n 'options' => $savedSearches,\n ],\n ];\n }\n\n public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array\n {\n $team = $user->getTeam();\n $userTimezone = $user->getTimezone();\n\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n $teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ])->values()->all();\n\n $shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];\n\n $sharedTeamsValue = [];\n $sharedUsersValue = [];\n if ($report) {\n $sharedTeamsValue = $this->transformGroups($team, $report->getGroups());\n\n $recipientUserIds = $report->getRecipients()['users'] ?? [];\n $creatorId = $report->getAttribute('created_by');\n $sharedUserIds = array_values(array_filter(\n $recipientUserIds,\n static fn ($id) => $id !== $creatorId\n ));\n $sharedUsersValue = collect($sharedUserIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (User $u) => [\n 'id' => $u->getUuid(),\n 'name' => $u->getName(),\n ])\n ->values()\n ->all();\n }\n\n return [\n 'fields' => [\n [\n 'id' => 'enabled',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'label' => '',\n 'value' => $report?->getStatus() ?? false,\n ],\n [\n 'id' => 'report_name',\n 'inputType' => InputTypeEnum::TEXT,\n 'label' => 'Name',\n 'placeholder' => 'Enter name',\n 'required' => true,\n 'validation' => ['maxLength' => 50],\n 'value' => $report?->getCustomName() ?? '',\n ],\n [\n 'id' => 'frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Frequency',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::ASK_JIMINNY_FREQUENCIES,\n 'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,\n ],\n [\n 'id' => 'expires_on',\n 'inputType' => InputTypeEnum::DATE,\n 'label' => 'Expires on',\n 'required' => true,\n 'placeholder' => 'Select',\n 'validation' => [\n 'minDate' => now($userTimezone)->toDateString(),\n 'maxDate' => now($userTimezone)->addYear()->toDateString(),\n ],\n 'value' => $report?->getExpiresAt()?->toDateString(),\n ],\n [\n 'id' => 'share_teams',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team',\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $teamGroups,\n 'value' => $sharedTeamsValue,\n ],\n [\n 'id' => 'share_users',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team member',\n 'required' => false,\n 'placeholder' => 'Select',\n 'groupLabelKey' => 'label',\n 'groupValuesKey' => 'users',\n 'optionLabelKey' => 'name',\n 'optionValueKey' => 'id',\n 'options' => $shareUsers,\n 'value' => $sharedUsersValue,\n ],\n [\n 'id' => 'saved_search',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Saved search',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $savedSearches,\n 'value' => $report && $report->getSavedSearch() ? [\n 'id' => $report->getSavedSearch()->getUuid(),\n 'name' => $report->getSavedSearch()->getName(),\n ] : null,\n ],\n [\n 'id' => 'ask_jiminny_prompt',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Ask Jiminny prompt',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $prompts,\n 'value' => $report && $report->getAskAnythingPrompt() ? [\n 'id' => $report->getAskAnythingPrompt()->getUuid(),\n 'name' => $report->getAskAnythingPrompt()->getTitle(),\n ] : null,\n ],\n ],\n ];\n }\n\n private function updateResultNames(AutomatedReport $automatedReport): void\n {\n $results = $this->automatedReportsRepository->getResultsByReport($automatedReport);\n\n foreach ($results as $result) {\n $result->update(['name' => $this->getReportFileName($result)]);\n }\n }\n\n public function updateStatus(string $uuid, array $data): array\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $automatedReport->update([\n 'status' => $status,\n ]);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n private function generateOneOffReport(AutomatedReport $automatedReport): void\n {\n // the scheduler handles all the other frequency types\n if ($automatedReport->getStatus() === false || $automatedReport->getFrequency() !== self::FREQUENCY_ONE_OFF) {\n return;\n }\n\n $this->dispatcher->dispatch(new RequestGenerateReportJob($automatedReport->getUuid()));\n }\n\n public function getReport(string $uuid): AutomatedReport\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n return $automatedReport;\n }\n\n public function get(string $uuid): array\n {\n $automatedReport = $this->getReport($uuid);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function list(string $sortColumn = 'created_at', string $sortDirection = 'desc'): array\n {\n $results = [];\n $collection = $this->automatedReportsRepository->getAllStandardReports($sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function listAskJiminnyReports(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): array {\n $results = [];\n $collection = $this->automatedReportsRepository->getAskJiminnyReportsByUser($user, $sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function delete(string $uuid): void\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $automatedReport->delete();\n }\n\n public function createReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n return $this->automatedReportsRepository->createResult(\n array_merge(\n [\n 'report_id' => $automatedReport->getId(),\n 'status' => AutomatedReportResult::STATUS_DEFAULT,\n ],\n $data\n )\n );\n }\n\n public function getOrCreateReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n $existing = $this->automatedReportsRepository->findLatestDefaultOrFailedResult($automatedReport);\n\n if ($existing !== null) {\n $existing->update(['status' => AutomatedReportResult::STATUS_DEFAULT]);\n\n return $existing;\n }\n\n return $this->createReportResult($automatedReport, $data);\n }\n\n public function getReportResult(string $resultUuid): AutomatedReportResult\n {\n $report = $this->automatedReportsRepository->findResultByUuid($resultUuid);\n\n if (! $report) {\n throw new ModelNotFoundException('Report Result not found');\n }\n\n return $report;\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return $this->automatedReportsRepository->findChildResult($result, $type);\n }\n\n // prophet API calls\n /**\n * @throws ApplicationException\n */\n public function getGenerateReportPayload(AutomatedReport $automatedReport, string $reportResultUuid): array\n {\n $period = $this->calculateFromAndToDate($automatedReport);\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n return [\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResultUuid,\n 'report_type' => $automatedReport->getType(),\n 'media_types' => $automatedReport->getMediaTypes(),\n 'from_date' => $fromDate->startOfDay()->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->endOfDay()->format(DateTimeInterface::RFC3339),\n 'group_ids' => $automatedReport->getGroups(),\n 'call_deal_stage' => $automatedReport->getDealAtCallStages(),\n 'current_deal_stage' => $automatedReport->getCurrentDealStages(),\n 'deal_min_value' => $automatedReport->getDealValueMin(),\n 'deal_max_value' => $automatedReport->getDealValueMax(),\n 'call_types' => $automatedReport->getCallTypes(),\n 'call_duration_min_seconds' => $automatedReport->getCallDurationMin(),\n 'call_duration_max_seconds' => $automatedReport->getCallDurationMax(),\n 'special_requirements' => $automatedReport->getAdditionalPromptInput(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->formatReportPeriodName(\n $automatedReport->getFrequency(),\n $fromDate,\n $toDate,\n ),\n 'playbook_categories' => $automatedReport->getPlaybookCategories(),\n 'custom_name' => $automatedReport->getCustomName(),\n ];\n }\n\n // $inputPayload - FE payload structure\n public function getActivitiesCountPayload(array $inputPayload): array\n {\n // Use validateAndTransformData to validate and normalize input\n $validatedData = $this->validateAndTransformData($inputPayload);\n $period = $this->calculateFromAndToDatePeriod(\n $validatedData['frequency'],\n Carbon::parse($validatedData['from']),\n Carbon::parse($validatedData['to']),\n );\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n // Create payload similar to getGenerateReportPayload\n return [\n 'team_id' => $validatedData['team_id'],\n 'group_ids' => $validatedData['groups'] ?? [],\n 'report_type' => $validatedData['type'],\n 'from_date' => $fromDate->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->format(DateTimeInterface::RFC3339),\n 'call_deal_stage' => $validatedData['deal_at_call_stages'] ?? [],\n 'current_deal_stage' => $validatedData['current_deal_stages'] ?? [],\n 'deal_min_value' => $validatedData['deal_value_min'] ?? null,\n 'deal_max_value' => $validatedData['deal_value_max'] ?? null,\n 'call_types' => $validatedData['call_types'],\n 'call_duration_min_seconds' => $validatedData['call_duration_min'] ?? null,\n 'call_duration_max_seconds' => $validatedData['call_duration_max'] ?? null,\n 'special_requirements' => $validatedData['additional_prompt_input'] ?? null,\n 'playbook_categories' => $validatedData['playbook_categories'] ?? [],\n 'request_id' => null,\n 'callback_url' => null,\n ];\n }\n\n public function shouldSendReport(array $users, ?CarbonInterface $generatedAt = null): bool\n {\n if (empty($users)) {\n return false;\n }\n\n $earliestTz = collect($users)\n ->mapWithKeys(function (array $user) {\n $tz = new DateTimeZone($user['timezone']);\n $nowUtc = new DateTime('now', new DateTimeZone('UTC'));\n $offset = $tz->getOffset($nowUtc);\n\n return [$user['timezone'] => $offset];\n })\n ->sortDesc()\n ->keys()\n ->first();\n\n $now = Carbon::now($earliestTz);\n $isScheduledTime = (int) $now->format('H') === self::SENT_REPORT_AT_HOURS;\n\n if ($isScheduledTime) {\n return true;\n }\n\n return $this->hasPassedScheduledTime($generatedAt, $earliestTz);\n }\n\n public function hasPassedScheduledTime(?CarbonInterface $generatedAt, string $timezone): bool\n {\n if ($generatedAt === null) {\n return false;\n }\n\n $now = Carbon::now($timezone);\n $scheduledTime = $now->copy()->setTime(self::SENT_REPORT_AT_HOURS, 0, 0);\n\n if ($now->hour < self::SENT_REPORT_AT_HOURS) {\n $scheduledTime = $scheduledTime->subDay();\n }\n\n $scheduledTimeUtc = $scheduledTime->copy()->utc();\n $generatedAtUtc = $generatedAt->copy()->utc();\n $nowUtc = $now->copy()->utc();\n\n return $generatedAtUtc->lt($scheduledTimeUtc) && $nowUtc->gt($scheduledTimeUtc);\n }\n\n public function calculateFromAndToDatePeriod(\n string $frequency,\n ?Carbon $fromDate = null,\n ?Carbon $toDate = null\n ): array {\n if ($frequency === self::FREQUENCY_ONE_OFF) {\n return [\n 'fromDate' => $fromDate,\n 'toDate' => $toDate,\n ];\n }\n\n $now = Carbon::now();\n\n return match ($frequency) {\n self::FREQUENCY_DAILY => [\n 'fromDate' => $now->copy()->subDay()->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_WEEKLY => [\n 'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_MONTHLY => [\n 'fromDate' => $now->copy()->subMonths(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_QUARTERLY => [\n 'fromDate' => $now->copy()->subMonths(3)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n default => throw new InvalidArgumentException(\"Unsupported frequency: {$frequency}\"),\n };\n }\n\n private function calculateFromAndToDate(AutomatedReport $automatedReport): array\n {\n return $this->calculateFromAndToDatePeriod(\n $automatedReport->getFrequency(),\n $automatedReport->getFrom(),\n $automatedReport->getTo()\n );\n }\n\n public function getAskJiminnyGenerateReportPayload(\n AutomatedReport $automatedReport,\n AutomatedReportResult $reportResult,\n array $activityIds,\n ): array {\n return [\n 'user_question' => $automatedReport->getAskAnythingPrompt()?->getContent(),\n 'call_ids' => array_map('strval', $activityIds),\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResult->getUuid(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->getReportPeriodName($reportResult),\n 'report_name' => $automatedReport->getCustomName(),\n ];\n }\n\n private function getCallbackUrl(): string\n {\n return $this->webhookService->route('jiminny.webhook.reports.ready');\n }\n\n /**\n * Validate and transform payload data for automated reports\n *\n * @param array $data\n *\n * @throws InvalidArgumentException\n *\n * @return array\n */\n private function validateAndTransformData(array $data): array\n {\n // Validate organization (team) and check feature\n $team = $this->validateOrganization($data['organization'] ?? null);\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $type = $this->validateReportType($data['report_type'] ?? null);\n $frequency = $this->validateFrequency($data['frequency'] ?? null);\n $additionalPromptInput = $this->validateAdditionalPromptInput(\n $data['additional_prompt_input'] ?? null\n );\n $customReportName = $this->validateCustomReportName($data['custom_name'] ?? null);\n\n // Prepare data for the database\n $reportData = [\n 'team_id' => $team->getId(),\n 'type' => $type,\n 'status' => $status,\n 'frequency' => $frequency,\n 'additional_prompt_input' => $additionalPromptInput,\n 'custom_name' => $customReportName,\n ];\n\n // Validate deal values\n $reportData = $this->validateDealValues($data, $reportData);\n\n // Validate date range\n $reportData = $this->validateDateRange($data, $reportData, $frequency);\n\n // Validate call durations\n $reportData = $this->validateCallDurations($data, $reportData);\n\n // Validate call types\n $reportData = $this->validateCallTypes($data, $reportData);\n\n // Validate media types\n $reportData = $this->validateMediaTypes($data, $reportData);\n\n // Validate groups\n if (isset($data['teams'])) {\n $reportData['groups'] = $this->validateAndGetGroupIds($team, $data['teams']);\n }\n\n // Validate deal stages\n $reportData = $this->validateDealStages($data, $reportData, $team, $type);\n\n // Validate playbook categories\n $reportData = $this->validatePlaybookCategories($data, $reportData, $team);\n\n // Validate recipients\n $reportData['recipients'] = [\n 'users' => $this->validateAndGetUserIdsByTeam($team, $data['recipients'] ?? []),\n ];\n\n if (isset($data['jiminny_recipients'])) {\n // Validate Jiminny recipients\n $reportData['jiminny_recipients'] = [\n 'users' => $this->validateAndGetJiminnyUserIds((array) $data['jiminny_recipients']),\n ];\n }\n\n return $reportData;\n }\n\n private function validateDealValues(array $data, array $reportData): array\n {\n if (isset($data['min_deal_value'])) {\n $reportData['deal_value_min'] = (int) $data['min_deal_value'];\n\n if ($reportData['deal_value_min'] > 4294967295 || $reportData['deal_value_min'] < 0) {\n throw new InvalidArgumentException('Min deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_deal_value'])) {\n $reportData['deal_value_max'] = (int) $data['max_deal_value'];\n\n if ($reportData['deal_value_max'] > 4294967295 || $reportData['deal_value_max'] < 0) {\n throw new InvalidArgumentException('Max deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['min_deal_value'], $data['max_deal_value'])\n && $data['min_deal_value'] > $data['max_deal_value']\n ) {\n throw new InvalidArgumentException('Min deal value cannot be greater than max deal value');\n }\n\n return $reportData;\n }\n\n private function validateDateRange(array $data, array $reportData, string $frequency): array\n {\n // Set date range only for one_off frequency\n if ($frequency === 'one_off') {\n if (isset($data['start_date_period'])) {\n $reportData['from'] = $this->parseDate($data['start_date_period']);\n }\n\n if (isset($data['end_date_period'])) {\n $reportData['to'] = $this->parseDate($data['end_date_period']);\n }\n\n if (empty($reportData['from']) || empty($reportData['to'])) {\n throw new InvalidArgumentException(\n 'Start date and end date are required for one_off frequency'\n );\n }\n } else {\n $reportData['from'] = null;\n $reportData['to'] = null;\n }\n\n return $reportData;\n }\n\n private function validateCallDurations(array $data, array $reportData): array\n {\n // Convert call durations from minutes to seconds\n if (isset($data['min_call_duration'])) {\n $reportData['call_duration_min'] = (int) $data['min_call_duration'] * 60;\n\n if ($reportData['call_duration_min'] > 4294967295 || $reportData['call_duration_min'] < 0) {\n throw new InvalidArgumentException('Min call duration should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_call_duration'])) {\n $reportData['call_duration_max'] = (int) $data['max_call_duration'] * 60;\n\n if ($reportData['call_duration_max'] > 4294967295 || $reportData['call_duration_max'] < 0) {\n throw new InvalidArgumentException('Max call duration should be between 0 and 4294967295');\n }\n }\n\n return $reportData;\n }\n\n private function validateCallTypes(array $data, array $reportData): array\n {\n // Set call types\n $reportData['call_types'] = $data['call_type'] ?? [];\n if (empty($reportData['call_types'])) {\n $reportData['call_types'] = self::getCallTypes();\n }\n\n foreach ($reportData['call_types'] as $callType) {\n if (! in_array($callType, self::getCallTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Call type %s is invalid', $callType));\n }\n }\n\n return $reportData;\n }\n\n private function validateMediaTypes(array $data, array $reportData): array\n {\n // Set media types from input data\n $reportData['media_types'] = $data['media_types'] ?? [];\n\n if (empty($reportData['media_types'])) {\n throw new InvalidArgumentException('Media types are required');\n }\n\n foreach ($reportData['media_types'] as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n throw new InvalidArgumentException(sprintf('Media type %s is invalid', $mediaType));\n }\n }\n\n return $reportData;\n }\n\n private function validateDealStages(array $data, array $reportData, Team $team, string $reportType): array\n {\n // Validate and set deal stages\n if (isset($data['deal_stage_at_call'])) {\n $reportData['deal_at_call_stages'] =\n $this->validateAndGetDealStageIds($team, $data['deal_stage_at_call'], 'Deal stage at call');\n }\n\n if (isset($data['current_deal_stage'])) {\n $reportData['current_deal_stages'] =\n $this->validateAndGetDealStageIds($team, $data['current_deal_stage'], 'Current deal stage');\n }\n\n // Ensure current_deal_stage is not provided for loss_analysis report type\n if ($reportType === self::TYPE_LOSS_ANALYSIS && ! empty($data['current_deal_stage'])) {\n throw new InvalidArgumentException('Current deal stage is not applicable for Loss Analysis reports');\n }\n\n return $reportData;\n }\n\n // transform uuid to id\n private function validatePlaybookCategories(array $data, array $reportData, Team $team): array\n {\n $key = 'playbook_categories';\n\n if (isset($data[$key])) {\n $payloadIds = $data[$key];\n $ids = [];\n\n foreach ($payloadIds as $uuid) {\n $uuid = (string) $uuid;\n\n try {\n $playbookCategory = $this->playbookCategoryRepository->findByUuid($uuid);\n } catch (Throwable $throwable) {\n Log::error(__METHOD__ . ' ' . $throwable->getMessage());\n\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory) {\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory->hasPlaybook()) {\n throw new InvalidArgumentException(sprintf('Playbook category %s has no playbook', $uuid));\n }\n\n if ($playbookCategory->getPlaybook()->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Playbook category %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $ids[] = $playbookCategory->getId();\n }\n\n $reportData[$key] = $ids;\n }\n\n return $reportData;\n }\n\n private function validateReportStatus($status): bool\n {\n if (! in_array($status, [true, false], true)) {\n throw new InvalidArgumentException('Report status is invalid');\n }\n\n return $status;\n }\n\n private function validateReportType($type): string\n {\n if (! in_array($type, self::getTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Report type is invalid: %s', $type));\n }\n\n return $type;\n }\n\n private function validateFrequency($frequency): string\n {\n if (! in_array($frequency, self::getFrequencies(), true)) {\n throw new InvalidArgumentException('Frequency is invalid');\n }\n\n return $frequency;\n }\n\n private function validateAdditionalPromptInput(?string $additionalPromptInput): ?string\n {\n if ($additionalPromptInput && strlen($additionalPromptInput) > 5000) {\n throw new InvalidArgumentException('Additional Prompt Input should be less than 5000 characters');\n }\n\n return $additionalPromptInput;\n }\n\n private function validateCustomReportName(?string $customReportName): ?string\n {\n if ($customReportName === null || $customReportName === '') {\n return null;\n }\n\n if (strlen($customReportName) > 70) {\n throw new InvalidArgumentException('Custom report name should be less than 70 characters');\n }\n\n return $customReportName;\n }\n\n private function validateOrganization(?string $organizationUuid): Team\n {\n if (! $organizationUuid) {\n throw new InvalidArgumentException('Organization is required');\n }\n\n $team = $this->teamRepository->idOrUuid($organizationUuid);\n\n if (! $team) {\n throw new InvalidArgumentException('Organization not found');\n }\n\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n throw new InvalidArgumentException('Organization does not have the Automated Reports feature');\n }\n\n return $team;\n }\n\n private function validateAndGetGroupIds(Team $team, array $teamUuids): array\n {\n $groupIds = [];\n\n foreach ($teamUuids as $uuid) {\n $group = $this->groupRepository->findByUuid($uuid);\n\n if ($group === null || $group->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Group %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $groupIds[] = $group->getId();\n\n }\n\n return $groupIds;\n }\n\n private function validateAndGetDealStageIds(Team $team, array $stageUuids, string $propertyLabel): array\n {\n $stageIds = [];\n\n foreach ($stageUuids as $uuid) {\n $stage = $this->stageRepository->findByUuid($uuid);\n\n if ($stage === null || $stage->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Stage %s not found for team %s for %s', $uuid, $team->getUuid(), $propertyLabel)\n );\n }\n\n $stageIds[] = $stage->getId();\n }\n\n return $stageIds;\n }\n\n private function validateAndGetUserIds(array $userUuids, callable $teamCheck): array\n {\n if (empty($userUuids)) {\n return [];\n }\n\n $userIds = [];\n\n foreach ($userUuids as $uuid) {\n $user = $this->userRepository->findByUuid($uuid);\n\n if (! $user || ! $user->isStatusActive()) {\n throw new InvalidArgumentException(\n sprintf('User %s not found or is not active', $uuid)\n );\n }\n\n if (! $teamCheck($user)) {\n throw new InvalidArgumentException(\n sprintf('User %s does not belong to the allowed team(s)', $uuid)\n );\n }\n\n $userIds[] = $user->getId();\n }\n\n return $userIds;\n }\n\n private function validateAndGetUserIdsByTeam(Team $team, array $userUuids): array\n {\n return $this->validateAndGetUserIds($userUuids, fn ($user) => $user->getTeamId() === $team->getId());\n }\n\n private function validateAndGetJiminnyUserIds(array $userUuids): array\n {\n $allowedTeamIds = config('kiosk.teamIds', []);\n\n return $this->validateAndGetUserIds($userUuids, fn ($user) => in_array($user->getTeamId(), $allowedTeamIds, true));\n }\n\n private function parseDate(string $dateString): string\n {\n return date('Y-m-d H:i:s', strtotime($dateString));\n }\n\n private function generateReportResultViewUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.view', ['uuid' => $result->getUuid()]);\n }\n\n private function generateReportResultDownloadUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.download', ['uuid' => $result->getUuid()]);\n }\n\n private function getReportMediaRouteResource(AutomatedReportResult $result): string\n {\n if ($result->getMediaType() === self::MEDIA_TYPE_PDF) {\n return self::PDF_KEY;\n } elseif ($result->getMediaType() === self::MEDIA_TYPE_PODCAST) {\n return self::AUDIO_KEY;\n }\n\n throw new \\InvalidArgumentException('Unknown media type.');\n }\n\n public function getMediaPath(AutomatedReportResult $result): ?string\n {\n $url = match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => $result->getPdfUrl(),\n self::MEDIA_TYPE_PODCAST => $result->getPodcastAudioUrl(),\n default => null,\n };\n\n if ($url === null) {\n return null;\n }\n\n $path = parse_url(trim($url, '\"\\''), PHP_URL_PATH);\n\n return $path ?: null;\n }\n\n public function getFilenameSuffix(AutomatedReportResult $result): ?string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => 'Podcast',\n default => null,\n };\n }\n\n public function getMailSubjectSuffix(AutomatedReportResult $result): string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => 'report',\n self::MEDIA_TYPE_PODCAST => 'podcast',\n default => '',\n };\n }\n\n public function getMediaTypeMetadata(AutomatedReportResult $result): array\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => ['extension' => 'mp3', 'mime' => 'audio/mpeg'],\n self::MEDIA_TYPE_PDF => ['extension' => 'pdf', 'mime' => 'application/pdf'],\n default => ['extension' => null, 'mime' => null],\n };\n }\n\n public function deleteS3Files(AutomatedReportResult $result): void\n {\n $teamUuid = $result->getReport()->getTeam()->getUuid();\n $reportUuid = $result->getUuid();\n\n // delete all files for a report uuid no mather of pdf, podcast, or both\n // in case of both - the podcast files are linked to the pdf (parent) uuid\n // pdf and podcast date times should be close\n $path = sprintf('%s/%s/%s', $teamUuid, self::S3_DIR, $reportUuid);\n\n foreach (self::FILE_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted S3 file', [\n 'path' => $file,\n ]);\n }\n }\n\n foreach (self::FILE_PODCAST_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '_podcast.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted Podcast S3 file', [\n 'path' => $file,\n ]);\n }\n }\n }\n\n /**\n *\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): Collection\n {\n return $this->automatedReportsRepository->getTeamIdsWithReportsResults($teamId);\n }\n\n /**\n * Core delete logic for report results using a query\n *\n * @param Builder $query\n * @param array $logContext\n *\n * @return int\n */\n private function deleteReportResultsByQuery(Builder $query, array $logContext = []): int\n {\n $deletedCount = 0;\n\n if ($query->exists()) {\n Log::info(\n 'Run delete report results',\n array_merge(\n $logContext,\n [\n 'service' => 'AutomatedReportsService',\n ]\n )\n );\n\n $query->chunkById(50, function ($results) use (&$deletedCount, $logContext) {\n foreach ($results as $result) {\n $this->deleteReportResult($result);\n $deletedCount++;\n\n Log::info(\n 'Deleted a report result',\n array_merge(\n $logContext,\n [\n 'result_id' => $result->getId(),\n 'report_id' => $result->getReportId(),\n ]\n )\n );\n }\n });\n }\n\n return $deletedCount;\n }\n\n /**\n * Delete report results for a team by retention period\n *\n * @param Team $team\n * @param CarbonImmutable $retentionDate\n *\n * @return int Number of deleted report results\n */\n public function deleteReportsResultsInRetentionPeriod(Team $team, CarbonImmutable $retentionDate): int\n {\n $reportIds = $this->automatedReportsRepository->getReportIdsByTeam($team);\n\n if ($reportIds->isEmpty()) {\n return 0;\n }\n\n $query = $this->automatedReportsRepository\n ->getReportResultsQueryForRetention($team, $retentionDate);\n\n return $this->deleteReportResultsByQuery($query, [\n 'team_id' => $team->getId(),\n 'retention_date' => $retentionDate->toDateTimeString(),\n ]);\n }\n\n /**\n * Delete ALL report results for a specific automated report\n *\n * @param string $uuid\n *\n * @return int\n */\n public function deleteReportResults(string $uuid): int\n {\n $report = $this->getReport($uuid);\n\n $query = $this->automatedReportsRepository->getResultsByReportQuery($report);\n\n return $this->deleteReportResultsByQuery($query, [\n 'report_uuid' => $uuid,\n 'report_id' => $report->getId(),\n ]);\n }\n\n public function deleteReportResult(AutomatedReportResult $result): void\n {\n $this->deleteS3Files($result);\n\n $result->delete();\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getTeamReports(Team $team): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getReportsByTeam($team);\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getReportResults(AutomatedReport $report): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getResultsByReport($report);\n }\n\n public function deleteAllReportResults(AutomatedReport $report): void\n {\n $results = $this->getReportResults($report);\n\n /** @var AutomatedReportResult $result */\n foreach ($results as $result) {\n Log::info('Deleting result', [\n 'report' => $report->getId(),\n 'result' => $result->getId(),\n ]);\n\n $this->deleteReportResult($result);\n }\n }\n\n public function deleteAllData(Team $team): void\n {\n Log::info('Deleting automated report and results for team', [\n 'team' => $team->getId(),\n ]);\n\n $reports = $this->getTeamReports($team);\n\n /** @var AutomatedReport $report */\n foreach ($reports as $report) {\n Log::info('Deleting report', [\n 'team' => $team->getId(),\n 'report' => $report->getId(),\n ]);\n\n $this->deleteAllReportResults($report);\n\n $report->delete();\n }\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"18","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"14","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"2","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"4","depth":4,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o\nJOIN activities a ON o.id = a.opportunity_id\nWHERE a.crm_configuration_id = 39\nAND a.actual_start_time > '2025-10-13'\nAND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM activities\nWHERE crm_configuration_id = 39 and user_id = 143\nand actual_start_time >= '2025-10-13'\nAND type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM opportunities WHERE account_id IN (178);\nselect * from activities where id IN (620137, 620187, 620188, 620189, 620230);\n\n# HS\nSELECT * FROM opportunities WHERE id IN (238);\nselect * from activities where id IN (477,2076);\n\nselect * from users;\n\nSELECT COUNT(*) FROM users;\nSELECT COUNT(*) FROM activities;\nSELECT COUNT(*) FROM opportunities;\n\nUPDATE activities\nSET\n actual_start_time = '2025-12-19 09:00:00',\n actual_end_time = '2025-12-19 10:30:00',\n scheduled_start_time = '2025-12-19 09:00:00',\n scheduled_end_time = '2025-12-19 10:30:00'\nWHERE id IN (407509,407375);\n\nselect * from partners;\n\nSELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id\nFROM activities\nWHERE user_id = 143\nAND actual_start_time >= '2025-10-13 00:00:00'\nAND actual_start_time <= '2026-01-13 23:59:59'\nORDER BY actual_start_time DESC;\n\nSELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;\nSELECT * FROM crm_layouts where crm_configuration_id = 39;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;\n# lead_id\n# account_id 177\n# contact_id 3969\n# opportunity_id\n# stage_id 203\n\nSELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;\n\nSELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'\nAND user_id = 143 and actual_start_time >= '2025-10-13';\n\nSELECT * FROM activities a\n# JOIN opportunities o ON a.opportunity_id = o.id\nWHERE a.crm_configuration_id = 39 AND a.type = 'conference'\nand status = 'completed' and recording_state = 'recorded'\nand a.actual_start_time >= '2025-10-13'\nAND a.user_id = 143\n;\n\nselect * from leads\nwhere crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707\n\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310);\nSELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198\nSELECT * FROM activities WHERE id IN (356001, 356008); # contacts:\n\nSELECT * FROM opportunities WHERE id IN (1707);\nSELECT * FROM stages where id IN (204, 198);\nSELECT * FROM opportunities WHERE account_id IN (178);\nSELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';\nSELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal\n\nSELECT * FROM activities where crm_configuration_id = 39\nAND opportunity_id IS NULL\nAND is_internal = false\nand status = 'completed' and recording_state = 'recorded'\nAND actual_start_time >= '2025-10-13'\nAND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)\n# AND lead_id IN (112, 109)\n;\n\nSELECT * FROM crm_profiles WHERE user_id = 143;\n\nselect * from inboxes; # 212\nselect * from users where id = 143; # 143\nselect * from inbox_email_batches where inbox_id = 212\nand updated_at >= '2026-01-28 00:00:00' order by id desc;\nselect * from inbox_emails where inbox_id = 212\nand batch_id = 95885 order by id desc;\nselect * from email_messages where origin_user_id = 143;\nselect * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';\nselect * from participants where activity_id = 620247;\n\nselect * from crm_profiles where user_id = 143;\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001\nselect * from transcription where activity_id = 356001; # 6943\nselect * from ai_prompts where transcription_id = 6943;\nSELECT * FROM activity_summary_logs where activity_id = 356001;\n\nSELECT * FROM social_accounts WHERE sociable_id = 143;\n\n# ************************************************************************************\nSELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;\n# 422515 softphone tr. 8100\n\nSELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;\n# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS\n\nselect * from ai_prompts where transcription_id IN (8100, 7670);\nselect * from activity_summary_logs where activity_id = 407509;\n\nselect * from sidekick_settings;\nselect * from default_activity_types;\n\nSELECT * FROM contacts WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\nSELECT * FROM leads WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\n\nSELECT * FROM activity_searches where user_id = 143;\nSELECT * FROM groups where team_id = 1;\n\nselect * from teams where id = 1;\nselect * from groups where team_id = 1; # 1150 - 7e75f8025c22\nselect id, name, group_id, status, deleted_at, email\nfrom users where team_id = 1 order by group_id desc ;\n\nselect * from activity_searches where id in (1977, 1978, 1979);\nselect * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);\nselect * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277\nselect * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879\n\nINSERT INTO `activity_search_filters`\n(`activity_search_id`, `filter`, `value`) VALUES\n(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')\n;\n\nselect * from crm_configurations where id = 39;\n\n\nselect sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id\nwhere u.team_id = 1;\nSELECT * FROM social_accounts WHERE sociable_id = 1635;\nSELECT * FROM users WHERE id = 1635;\n\nselect * from teams where id = 1;\nselect * from users where team_id = 1;\nselect * from team_features where team_id = 1;\nselect * from features;\n\nSELECT * FROM activity_searches where id = 1982; # 1981\nSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;\n\nSELECT * FROM automated_reports where id = 68;\nUPDATE automated_reports set playbook_categories = NULL where id = 68;\nSELECT * FROM automated_report_results where id = 275;\n\nSELECT * FROM automated_reports order by id desc;\nSELECT * FROM automated_report_results order by id desc;\nselect * from activity_searches where user_id = 143;\nselect * from ask_anything_prompts;\n\nSELECT * FROM groups WHERE id = 1439;\nSELECT * FROM users WHERE group_id = 1439;\n\nselect * from permissions; # 158\nselect * from roles;\nselect * from permission_role\n\nselect * from teams where id = 1;\nselect * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;\nselect * from groups where id = 28;\nselect * from playbooks where team_id = 1;\nselect * from playbooks where id = 179;\nselect * from playbook_categories where id = 1391;\nselect * from users where id = 143;\nselect * from crm_profiles where user_id = 143;\nselect * from activities where crm_configuration_id = 39 and type = 'conference'\nand crm_provider_id IS NOT NULL ORDER by id desc;\nselect * from activities where id = 422003; # 00UO400000pB6fpMAC\n\nSELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type\nFROM automated_report_results ar\nJOIN automated_reports a ON a.id = ar.report_id\nWHERE a.type = 'ask_jiminny'\nLIMIT 10;\n\nSELECT `automated_report_results`.* FROM `automated_report_results`\nINNER JOIN `automated_reports`\n ON `automated_report_results`.`report_id` = `automated_reports`.`id`\nWHERE `automated_report_results`.`generated_at` IS NOT NULL\n AND `automated_reports`.`team_id` = 1\n AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$.\"users\"')\n;\n\n\nselect * from teams where id = 3143;\nselect * from crm_configurations where id = 500;\nselect * from users where name = 'Integration Account'; # 1695\nSELECT * FROM social_accounts WHERE sociable_id = 1695;\n\nselect * from activities where crm_configuration_id = 39\nand recording_state = 'recorded' and duration > 60\nand status = 'completed' and actual_start_time >= '2025-12-01';\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;\n\nselect * from leads;","depth":4,"value":"SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o\nJOIN activities a ON o.id = a.opportunity_id\nWHERE a.crm_configuration_id = 39\nAND a.actual_start_time > '2025-10-13'\nAND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM activities\nWHERE crm_configuration_id = 39 and user_id = 143\nand actual_start_time >= '2025-10-13'\nAND type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM opportunities WHERE account_id IN (178);\nselect * from activities where id IN (620137, 620187, 620188, 620189, 620230);\n\n# HS\nSELECT * FROM opportunities WHERE id IN (238);\nselect * from activities where id IN (477,2076);\n\nselect * from users;\n\nSELECT COUNT(*) FROM users;\nSELECT COUNT(*) FROM activities;\nSELECT COUNT(*) FROM opportunities;\n\nUPDATE activities\nSET\n actual_start_time = '2025-12-19 09:00:00',\n actual_end_time = '2025-12-19 10:30:00',\n scheduled_start_time = '2025-12-19 09:00:00',\n scheduled_end_time = '2025-12-19 10:30:00'\nWHERE id IN (407509,407375);\n\nselect * from partners;\n\nSELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id\nFROM activities\nWHERE user_id = 143\nAND actual_start_time >= '2025-10-13 00:00:00'\nAND actual_start_time <= '2026-01-13 23:59:59'\nORDER BY actual_start_time DESC;\n\nSELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;\nSELECT * FROM crm_layouts where crm_configuration_id = 39;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;\n# lead_id\n# account_id 177\n# contact_id 3969\n# opportunity_id\n# stage_id 203\n\nSELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;\n\nSELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'\nAND user_id = 143 and actual_start_time >= '2025-10-13';\n\nSELECT * FROM activities a\n# JOIN opportunities o ON a.opportunity_id = o.id\nWHERE a.crm_configuration_id = 39 AND a.type = 'conference'\nand status = 'completed' and recording_state = 'recorded'\nand a.actual_start_time >= '2025-10-13'\nAND a.user_id = 143\n;\n\nselect * from leads\nwhere crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707\n\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310);\nSELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198\nSELECT * FROM activities WHERE id IN (356001, 356008); # contacts:\n\nSELECT * FROM opportunities WHERE id IN (1707);\nSELECT * FROM stages where id IN (204, 198);\nSELECT * FROM opportunities WHERE account_id IN (178);\nSELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';\nSELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal\n\nSELECT * FROM activities where crm_configuration_id = 39\nAND opportunity_id IS NULL\nAND is_internal = false\nand status = 'completed' and recording_state = 'recorded'\nAND actual_start_time >= '2025-10-13'\nAND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)\n# AND lead_id IN (112, 109)\n;\n\nSELECT * FROM crm_profiles WHERE user_id = 143;\n\nselect * from inboxes; # 212\nselect * from users where id = 143; # 143\nselect * from inbox_email_batches where inbox_id = 212\nand updated_at >= '2026-01-28 00:00:00' order by id desc;\nselect * from inbox_emails where inbox_id = 212\nand batch_id = 95885 order by id desc;\nselect * from email_messages where origin_user_id = 143;\nselect * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';\nselect * from participants where activity_id = 620247;\n\nselect * from crm_profiles where user_id = 143;\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001\nselect * from transcription where activity_id = 356001; # 6943\nselect * from ai_prompts where transcription_id = 6943;\nSELECT * FROM activity_summary_logs where activity_id = 356001;\n\nSELECT * FROM social_accounts WHERE sociable_id = 143;\n\n# ************************************************************************************\nSELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;\n# 422515 softphone tr. 8100\n\nSELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;\n# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS\n\nselect * from ai_prompts where transcription_id IN (8100, 7670);\nselect * from activity_summary_logs where activity_id = 407509;\n\nselect * from sidekick_settings;\nselect * from default_activity_types;\n\nSELECT * FROM contacts WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\nSELECT * FROM leads WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\n\nSELECT * FROM activity_searches where user_id = 143;\nSELECT * FROM groups where team_id = 1;\n\nselect * from teams where id = 1;\nselect * from groups where team_id = 1; # 1150 - 7e75f8025c22\nselect id, name, group_id, status, deleted_at, email\nfrom users where team_id = 1 order by group_id desc ;\n\nselect * from activity_searches where id in (1977, 1978, 1979);\nselect * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);\nselect * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277\nselect * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879\n\nINSERT INTO `activity_search_filters`\n(`activity_search_id`, `filter`, `value`) VALUES\n(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')\n;\n\nselect * from crm_configurations where id = 39;\n\n\nselect sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id\nwhere u.team_id = 1;\nSELECT * FROM social_accounts WHERE sociable_id = 1635;\nSELECT * FROM users WHERE id = 1635;\n\nselect * from teams where id = 1;\nselect * from users where team_id = 1;\nselect * from team_features where team_id = 1;\nselect * from features;\n\nSELECT * FROM activity_searches where id = 1982; # 1981\nSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;\n\nSELECT * FROM automated_reports where id = 68;\nUPDATE automated_reports set playbook_categories = NULL where id = 68;\nSELECT * FROM automated_report_results where id = 275;\n\nSELECT * FROM automated_reports order by id desc;\nSELECT * FROM automated_report_results order by id desc;\nselect * from activity_searches where user_id = 143;\nselect * from ask_anything_prompts;\n\nSELECT * FROM groups WHERE id = 1439;\nSELECT * FROM users WHERE group_id = 1439;\n\nselect * from permissions; # 158\nselect * from roles;\nselect * from permission_role\n\nselect * from teams where id = 1;\nselect * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;\nselect * from groups where id = 28;\nselect * from playbooks where team_id = 1;\nselect * from playbooks where id = 179;\nselect * from playbook_categories where id = 1391;\nselect * from users where id = 143;\nselect * from crm_profiles where user_id = 143;\nselect * from activities where crm_configuration_id = 39 and type = 'conference'\nand crm_provider_id IS NOT NULL ORDER by id desc;\nselect * from activities where id = 422003; # 00UO400000pB6fpMAC\n\nSELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type\nFROM automated_report_results ar\nJOIN automated_reports a ON a.id = ar.report_id\nWHERE a.type = 'ask_jiminny'\nLIMIT 10;\n\nSELECT `automated_report_results`.* FROM `automated_report_results`\nINNER JOIN `automated_reports`\n ON `automated_report_results`.`report_id` = `automated_reports`.`id`\nWHERE `automated_report_results`.`generated_at` IS NOT NULL\n AND `automated_reports`.`team_id` = 1\n AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$.\"users\"')\n;\n\n\nselect * from teams where id = 3143;\nselect * from crm_configurations where id = 500;\nselect * from users where name = 'Integration Account'; # 1695\nSELECT * FROM social_accounts WHERE sociable_id = 1695;\n\nselect * from activities where crm_configuration_id = 39\nand recording_state = 'recorded' and duration > 60\nand status = 'completed' and actual_start_time >= '2025-12-01';\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;\n\nselect * from leads;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-3163136488953525261
|
1126710648141684156
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsRepositoryTest
Run 'AutomatedReportsRepositoryTest'
Debug 'AutomatedReportsRepositoryTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
3
102
3
34
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Kiosk\AutomatedReports;
use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Carbon\Exceptions\InvalidFormatException;
use DateTime;
use DateTimeInterface;
use DateTimeZone;
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcher;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Jiminny\Component\ActivitySearch\FilterDefinition\InputTypeEnum;
use Jiminny\Component\AskAnything\AskAnythingPromptService;
use Jiminny\Component\AskAnything\Dtos\AskAnythingPromptDto;
use Jiminny\Component\UrlGenerator\Webhook;
use Jiminny\Contracts\Repositories\PlaybookCategoryRepository;
use Jiminny\Contracts\Repositories\TeamRepository;
use Jiminny\Contracts\Repositories\UserRepository;
use Jiminny\Exceptions\ApplicationException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Exceptions\ModelNotFoundException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateReportJob;
use Jiminny\Models\Activity\Search;
use Jiminny\Models\AskAnything\AskAnythingPrompt;
use Jiminny\Models\AskAnything\AskAnythingPromptTarget;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Contracts\UserContract;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AskAnythingRepository;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Repositories\GroupRepository;
use Jiminny\Repositories\SearchRepository;
use Jiminny\Repositories\StageRepository;
use Throwable;
class AutomatedReportsService
{
public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';
public const string TYPE_ASK_JIMINNY = 'ask_jiminny';
/**
* Standard report types (used by kiosk for existing automated reports).
*/
// @TODO this will add filter, however if we need to control feature by FF we need conditional logic
public const array TYPES = [
['id' => 'exec_summary', 'name' => 'Exec Summary'],
['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],
['id' => 'product_feedback', 'name' => 'Product Feedback'],
['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],
// ['id' => 'questions', 'name' => 'Questions'],
// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],
];
public const array ALL_TYPES = [
...self::TYPES,
['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],
];
public const string FREQUENCY_DAILY = 'daily';
public const string FREQUENCY_WEEKLY = 'weekly';
public const string FREQUENCY_MONTHLY = 'monthly';
public const string FREQUENCY_QUARTERLY = 'quarterly';
public const string FREQUENCY_ONE_OFF = 'one_off';
/**
* Frequencies for standard (non-Ask Jiminny) reports.
*/
public const array FREQUENCIES = [
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
/**
* Frequencies for Ask Jiminny reports.
*/
public const array ASK_JIMINNY_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
];
public const string MEDIA_TYPE_PDF = 'pdf';
public const string MEDIA_TYPE_PODCAST = 'podcast';
public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];
public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];
public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];
public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];
public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];
public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];
public const int SENT_REPORT_AT_HOURS = 5;
public const string PDF_KEY = 'pdf';
public const string AUDIO_KEY = 'audio';
private const array ALL_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
private const string S3_DIR = 'reports';
private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];
private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];
public function __construct(
private readonly TeamRepository $teamRepository,
private readonly GroupRepository $groupRepository,
private readonly UserRepository $userRepository,
private readonly StageRepository $stageRepository,
private readonly DealStagesService $dealStagesService,
private readonly RecipientsService $recipientsService,
private readonly AutomatedReportsRepository $automatedReportsRepository,
private readonly Webhook $webhookService,
private readonly BusDispatcher $dispatcher,
private readonly ActivityTypeService $activityTypeService,
private readonly PlaybookCategoryRepository $playbookCategoryRepository,
private readonly AskAnythingPromptService $askAnythingPromptService,
private readonly SearchRepository $activitySearchRepository,
private readonly AskAnythingRepository $askAnythingRepository,
) {
}
public static function getTypes(): array
{
$types = self::TYPES;
return array_map(static function ($type) {
return $type['id'];
}, $types);
}
public static function getCallTypes(): array
{
return array_map(static function ($callType) {
return $callType['id'];
}, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);
}
public static function getFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::FREQUENCIES);
}
// front-facing structure
public function getReportEnabledFieldData(bool $value = false): array
{
return [
'id' => 'report_enabled',
'label' => '',
'inputType' => InputTypeEnum::TOGGLE,
'value' => $value,
];
}
// Organizations = Teams
public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array
{
$options = $this->getTeams();
if ($shortVersion) {
return [
'id' => 'organization',
'label' => 'Organization',
'options' => $options,
];
}
return [
'id' => 'organization',
'label' => 'Organization',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $options,
'value' => $value,
'dependencies' => [
'teams',
'deal_stage_at_call',
'current_deal_stage',
'recipients',
ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,
],
'dependsOn' => [],
];
}
// Teams = Groups
public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array
{
if ($shortVersion) {
return [
'id' => 'teams',
'label' => 'Team',
'options' => $options,
];
}
return [
'id' => 'teams',
'label' => 'Team',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => false,
'placeholder' => 'Select',
'options' => $options,
'value' => $value, // value should be an array of objects {id, name}
'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],
'dependsOn' => [],
];
}
public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array
{
$types = [];
if ($team instanceof Team) {
if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
$types = self::TYPES;
}
if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {
$types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];
}
} else {
$types = self::TYPES;
}
if ($shortVersion) {
return [
'id' => 'report_type',
'label' => 'Report Type',
'options' => $types,
];
}
return [
'id' => 'report_type',
'label' => 'Report Type',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $types,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getFrequencyFieldData(?string $value = null): array
{
return [
'id' => 'frequency',
'label' => 'Frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => self::FREQUENCIES,
'value' => $value,
'dependencies' => ['period'],
'dependsOn' => [],
];
}
public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array
{
return [
'id' => 'period',
'label' => 'Select one-off period',
'inputType' => InputTypeEnum::DATE_RANGE,
'required' => true,
'placeholder' => 'Select',
'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],
'queryParams' => [
'startDate' => 'start_date_period',
'endDate' => 'end_date_period',
],
'dependencies' => [],
'dependsOn' => ['frequency'],
];
}
public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array
{
return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);
}
public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);
}
public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);
}
public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'deal_value',
'label' => 'Deal Value',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_deal_value',
'max' => 'max_deal_value',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array
{
$value = [];
$conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;
$dialerOn && $value[] = self::CALL_TYPE_DIALER;
return [
'id' => 'call_type',
'label' => 'Call Type',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => [
self::CALL_TYPE_CONFERENCE,
self::CALL_TYPE_DIALER,
],
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getMediaTypeFieldData(?AutomatedReport $report = null): array
{
$value = [];
if ($report) {
$value = $this->transformMediaTypes($report);
}
return [
'id' => 'media_types',
'label' => 'Export as',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => self::MEDIA_TYPE_OBJECTS,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'call_duration',
'label' => 'Call Duration',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_call_duration',
'max' => 'max_call_duration',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getRecipientsFieldData(?Team $team = null, array $value = []): array
{
return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);
}
public function getJiminnyRecipientsFieldData(array $value = []): array
{
return $this->recipientsService->getJiminnyRecipientsFieldData($value);
}
public function getAdditionalPromptInputFieldData(?string $value = null): array
{
return [
'id' => 'additional_prompt_input',
'label' => 'Special requirements',
'inputType' => InputTypeEnum::TEXTAREA,
'required' => false,
'placeholder' => 'What should be the focus of the report?',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCustomReportNameFieldData(?string $value = null): array
{
return [
'id' => 'custom_name',
'label' => 'Custom report name',
'inputType' => InputTypeEnum::TEXT,
'required' => false,
'placeholder' => 'Enter custom name',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
// data providers
public function getTeams(): array
{
$teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);
$teamData = [];
foreach ($teams as $team) {
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
continue;
}
$teamData[] = $this->transformTeam($team);
}
return $teamData;
}
public function getTeamGroups(string $teamUuid): array
{
$data = [];
$team = $this->getTeam($teamUuid);
if ($team !== null) {
$groups = $team->groups()->get();
foreach ($groups as $group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
];
}
}
return $data;
}
public function getTeamsGroupsOptions(array $filterTeamUuids = []): array
{
$data = [];
$teams = $this->getTeams();
foreach ($teams as $team) {
if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {
continue;
}
$data[] = [
'label' => $team['name'],
'groups' => $this->getTeamGroups($team['id']),
];
}
return $data;
}
public function getTeam(string $teamUuid): ?Team
{
return $this->teamRepository->idOrUuid($teamUuid);
}
public function getTeamById(int $teamId): ?Team
{
return $this->teamRepository->find($teamId);
}
public function getGroupsUuids(AutomatedReport $report): array
{
$uuids = [];
$reportGroups = $report->getGroups();
foreach ($reportGroups as $groupId) {
if ($group = $this->groupRepository->find($groupId)) {
$uuids[] = $group->getUuid();
}
}
return $uuids;
}
public function getPlaybookCategoriesUuids(AutomatedReport $report): array
{
$uuids = [];
$playbookCategories = $report->getPlaybookCategories();
foreach ($playbookCategories as $id) {
if ($category = $this->playbookCategoryRepository->find($id)) {
$uuids[] = $category->getUuid();
}
}
return $uuids;
}
public function getDealAtCallStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getDealAtCallStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getCurrentDealStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getCurrentDealStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getRecipients());
}
public function getJiminnyUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function extractUserUuids(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => $user->getUuid())
->values()
->all();
}
// get mail data
public function getRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getRecipients());
}
/**
* @return array<UserContract>
*/
public function getRecipientUserObjects(AutomatedReport $report): array
{
$userIds = $report->getRecipients()['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->values()
->all();
}
private function getJiminnyRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function buildRecipientUsers(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => [
'email' => $user->getEmailAddress(),
'name' => $user->getName(),
'timezone' => $user->getTimezone()->getName(),
])
->values()
->all();
}
public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array
{
if ($report->isAskJiminnyReport()) {
$recipients = $this->resolveAskJiminnyRecipients($report);
} else {
$recipients = $this->getRecipientUsers($report);
if ($includeJiminny) {
$recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));
}
}
$emails = [];
return array_values(array_filter(
$recipients,
static function ($recipient) use (&$emails) {
if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {
return false;
}
$emails[] = $recipient['email'];
return true;
}
));
}
private function resolveAskJiminnyRecipients(AutomatedReport $report): array
{
$recipients = [];
$creator = $report->getCreator();
if ($creator !== null) {
$recipients[] = [
'email' => $creator->getEmailAddress(),
'name' => $creator->getName(),
'timezone' => $creator->getTimezone()->getName(),
];
}
return array_merge(
$recipients,
$this->buildRecipientUsers($report->getRecipients()),
$this->getGroupRecipientUsers($report),
);
}
private function getGroupRecipientUsers(AutomatedReport $report): array
{
$users = [];
foreach ($report->getGroups() as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group === null) {
continue;
}
foreach ($group->getMembers() as $member) {
$users[] = [
'email' => $member->getEmailAddress(),
'name' => $member->getName(),
'timezone' => $member->getTimezone()->getName(),
];
}
}
return $users;
}
public function getReportTypeName(AutomatedReportResult $report): string
{
$type = $report->getReport()->getType();
$getType = $this->transformReportType($type);
return $getType['name'];
}
public function getReportPeriodName(AutomatedReportResult $report): string
{
$from = $report->getFromDate();
$to = $report->getToDate();
$frequency = $report->getReport()->getFrequency();
if ($from === null || $to === null) {
if (! $report->getReport()->isAskJiminnyReport()) {
$invalidPeriod = $from === null ? 'from' : 'to';
throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);
}
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
}
return $this->formatReportPeriodName($frequency, $from, $to);
}
private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string
{
$fromYear = $from->format('Y');
$toYear = $to->format('Y');
$differentYears = $fromYear !== $toYear;
switch ($frequency) {
case self::FREQUENCY_DAILY:
return $from->format('j M Y');
case self::FREQUENCY_QUARTERLY:
// 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ
$startMonth = $from->format('M');
$endMonth = $to->copy()->subMonth();
$endMonthName = $endMonth->format('M');
$endMonthYear = $endMonth->format('Y');
if ($differentYears) {
return "{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}";
}
return "{$startMonth} - {$endMonthName} {$toYear}";
case self::FREQUENCY_MONTHLY:
// 'May 2025' - monthly reports are always within the same year
return $from->format('M Y');
case self::FREQUENCY_WEEKLY:
// '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ
$startDay = $from->format('j');
$endDay = $to->format('j');
$startMonth = $from->format('M');
$endMonth = $to->format('M');
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
if ($startMonth !== $endMonth) {
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
}
return "{$startDay} - {$endDay} {$endMonth} {$toYear}";
case self::FREQUENCY_ONE_OFF:
// '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ
$startDay = $from->format('j');
$startMonth = $from->format('M');
$endDay = $to->format('j');
$endMonth = $to->format('M');
// If same month and year, use a format like '2-31 May 2025'
if ($startMonth === $endMonth && ! $differentYears) {
return "{$startDay} - {$endDay} {$startMonth} {$toYear}";
}
// If different years, include both years
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
// Same year but different months
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
default:
// Default format for unknown frequencies
return $from->format('j M Y') . ' - ' . $to->format('j M Y');
}
}
public function getReportTeamsName(AutomatedReportResult $report): string
{
$groups = $report->getGroups();
if (empty($groups)) {
return 'All';
}
// Get group names from repository
$groupNames = [];
foreach ($groups as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group) {
$groupNames[] = $group->getName();
}
}
if (count($groupNames) === 1) {
// Single team format
$teamsName = $groupNames[0];
} else {
// Multiple teams format
$teamsName = implode(', ', $groupNames);
}
return $teamsName;
}
public function getReportFileName(AutomatedReportResult $report): string
{
$customName = $report->getReport()->getCustomName();
$periodName = $this->getReportPeriodName($report);
$filenameSuffix = $this->getFilenameSuffix($report);
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$customName} - {$periodName}");
}
$baseName = $this->getReportTypeName($report);
if ($filenameSuffix) {
$baseName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}");
}
public function getReportFileNameWithExtension(AutomatedReportResult $result): string
{
$extension = $this->getMediaTypeMetadata($result)['extension'];
return $this->getReportFileName($result) . '.' . $extension;
}
public function sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool
{
$recipients = array_map('intval', $report->getRecipients()['users'] ?? []);
return in_array($user->getId(), $recipients);
}
public function transformReportResults(Collection $automatedReportResults): array
{
$data = [];
foreach ($automatedReportResults as $automatedReportResult) {
/** @var AutomatedReportResult $automatedReportResult */
$report = $automatedReportResult->getReport();
$createdBy = $report->getCreator();
$creator = [
'id' => $createdBy?->getUuid(),
'name' => $createdBy?->getName(),
'email' => $createdBy?->getEmailAddress(),
'photoUrl' => $createdBy?->getPhotoUrl(),
];
$recipients = $this->buildRecipients($report);
$data[] = [
'id' => $automatedReportResult->getUuid(),
'name' => $automatedReportResult->getName(),
'frequency' => $this->transformFrequency($report->getFrequency()),
'recipients' => $recipients,
'recipients' => [
...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),
...array_values($this->transformRecipients($report->getRecipients())),
],
'report_type' => $this->transformReportType($report->getType()),
'media_type' => $automatedReportResult->getMediaType(),
'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),
'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),
'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),
'creator' => $creator,
];
}
return $data;
}
private function buildRecipients(AutomatedReport $report)
{
}
public function hasCallTypeConference(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);
}
public function hasCallTypeDialer(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);
}
// transformers
private function transformTeam(Team $team): array
{
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
return [];
}
return [
'id' => $team->getUuid(),
'name' => $team->getName(),
];
}
private function transformReportFullView(AutomatedReport $report): array
{
$base = $this->transformReportBase($report);
return $report->getType() === self::TYPE_ASK_JIMINNY
? $base + $this->transformAskJiminnyFields($report)
: $base + $this->transformStandardReportFields($report);
}
private function transformReportBase(AutomatedReport $report): array
{
return [
'id' => $report->getUuid(),
'organization' => $this->transformOrganization(team: $report->getTeam()),
'report_type' => $this->transformReportType($report->getType()),
'frequency' => $this->transformFrequency($report->getFrequency()),
];
}
private function transformStandardReportFields(AutomatedReport $report): array
{
$team = $report->getTeam();
return [
'report_enabled' => $report->getStatus(),
'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),
'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),
'deal_value_min' => $report->getDealValueMin(),
'deal_value_max' => $report->getDealValueMax(),
'call_types' => $this->transformCallType($report->getCallTypes()),
'media_types' => $this->transformMediaTypes($report),
'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),
'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),
'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),
'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),
'recipients' => $this->transformRecipients($report->getRecipients()),
'created_by' => $this->transformCreator($report->getCreator()),
'additional_prompt_input' => $report->getAdditionalPromptInput(),
'custom_name' => $report->getCustomName(),
'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),
'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),
'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),
];
}
private function transformAskJiminnyFields(AutomatedReport $report): array
{
$team = $report->getTeam();
$creatorId = $report->getAttribute('created_by');
$explicitUserIds = array_values(array_filter(
$report->getRecipients()['users'] ?? [],
static fn ($id) => $id !== $creatorId
));
return [
'report_name' => $report->getCustomName(),
'enabled' => $report->getStatus(),
'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),
'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),
'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),
'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),
];
}
private function transformOrganization(?Team $team): array
{
return [
'id' => $team?->getUuid(),
'name' => $team?->getName(),
];
}
private function transformReportType(string $type): array
{
foreach (self::ALL_TYPES as $typeItem) {
if ($typeItem['id'] === $type) {
return $typeItem;
}
}
return [];
}
private function transformCallType(array $types): array
{
$result = [];
$callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];
foreach ($types as $type) {
foreach ($callTypes as $callTypeItem) {
if ($callTypeItem['id'] === $type) {
$result[] = $callTypeItem;
break;
}
}
}
return $result;
}
private function transformMediaTypes(AutomatedReport $report): array
{
$values = [];
foreach ($report->getMediaTypes() as $mediaType) {
if (! in_array($mediaType, self::MEDIA_TYPES, true)) {
continue;
}
$values[] = match ($mediaType) {
self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,
self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,
};
}
return $values;
}
private function transformFrequency(string $frequency): array
{
foreach (self::ALL_FREQUENCIES as $frequencyItem) {
if ($frequencyItem['id'] === $frequency) {
return $frequencyItem;
}
}
return [];
}
public function transformDurationToMinutes(?int $duration): ?int
{
if (! $duration) {
return null;
}
return (int) ($duration / 60);
}
private function transformGroups(?Team $team, array $groupsIds): array
{
if (empty($groupsIds) || ! $team) {
return [];
}
$data = [];
foreach ($groupsIds as $groupId) {
$group = $team->groups()->where('id', $groupId)->first();
if ($group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
'photoUrl' => $group->getPhotoUrl(),
];
}
}
return $data;
}
private function transformStages(?Team $team, array $stagesIds): array
{
if (empty($stagesIds) || ! $team) {
return [];
}
$data = [];
foreach ($stagesIds as $stageId) {
$stage = $team->stages()->where('id', $stageId)->first();
if ($stage) {
$data[] = [
'id' => $stage->getUuid(),
'name' => $stage->getName(),
];
}
}
return $data;
}
private function transformRecipients(array $recipients): array
{
$users = [];
foreach ($recipients['users'] ?? [] as $userId) {
$users[] = $this->transformUser($userId);
}
return $users;
}
private function transformCreator(?User $user): ?array
{
if ($user === null) {
return null;
}
return $this->transformUser($user->getId());
}
private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array
{
if ($prompt === null) {
return null;
}
return [
'id' => $prompt->getUuid(),
'name' => $prompt->getTitle(),
];
}
private function transformSafeSearch(?Search $search): ?array
{
if ($search === null) {
return null;
}
return [
'id' => $search->getUuid(),
'name' => $search->getName(),
];
}
private function transformUser(int $userId): array
{
/* @var ?User $user */
$user = $this->userRepository->find($userId);
return [
'id' => $user?->getUuid(),
'name' => $user?->getName(),
'email' => $user?->getEmailAddress(),
'photoUrl' => $user?->getPhotoUrl(),
];
}
public function create(array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$validatedData['created_by'] = auth()->id();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
public function update(string $uuid, array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$report = $this->automatedReportsRepository->findByUuid($uuid);
if (! $report) {
throw new InvalidArgumentException('Report not found');
}
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
/**
* Create an Ask Jiminny report.
*/
public function createAskJiminnyReport(array $data, User $creator): array
{
$validatedData = $this->validateAskJiminnyReportData($data, $creator);
$validatedData['created_by'] = $creator->getId();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
return $this->transformReportFullView($automatedReport);
}
/**
* Update an Ask Jiminny report.
*/
public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array
{
if (! $report->isAskJiminnyReport()) {
throw new InvalidArgumentException('Report is not an Ask Jiminny report');
}
$validatedData = $this->validateAskJiminnyReportData($data, $user);
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
return $this->transformReportFullView($automatedReport);
}
public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array
{
$this->automatedReportsRepository->update($report, ['status' => $status]);
return $this->transformReportFullView($report->fresh());
}
/**
* Validate and transform data for Ask Jiminny reports.
*/
private function validateAskJiminnyReportData(array $data, User $user): array
{
// Validate name
$name = trim($data['report_name'] ?? '');
if (empty($name)) {
throw new InvalidArgumentException('Report name is required');
}
if (mb_strlen($name) > 50) {
throw new InvalidArgumentException('Report name must be 50 characters or less');
}
// Validate frequency (only daily, weekly, monthly for Ask Jiminny)
$frequency = $data['frequency'] ?? null;
$askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];
if (! in_array($frequency, $askJiminnyFrequencies, true)) {
throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');
}
// Validate expiration date
$expiresAt = $data['expires_on'] ?? null;
if (empty($expiresAt)) {
throw new InvalidArgumentException('Expiration date is required');
}
try {
$expiresAtDate = Carbon::parse($expiresAt);
} catch (InvalidFormatException $e) {
throw new InvalidArgumentException('Expiration date format is invalid');
}
$maxExpiration = Carbon::now()->addYear()->endOfDay();
if ($expiresAtDate->gt($maxExpiration)) {
throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');
}
if ($expiresAtDate->isPast()) {
throw new InvalidArgumentException('Expiration date cannot be in the past');
}
// Validate saved search
$activitySearchId = $data['saved_search'] ?? null;
if (empty($activitySearchId)) {
throw new InvalidArgumentException('Saved search is required');
}
$savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);
if (! $savedSearch) {
throw new InvalidArgumentException('Saved search not found or does not belong to you');
}
// Validate saved prompt
$askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;
if (empty($askAnythingPromptId)) {
throw new InvalidArgumentException('Ask Jiminny prompt is required');
}
$prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);
if (! $prompt) {
throw new InvalidArgumentException('Ask Jiminny prompt not found');
}
// Validate status
$status = $data['enabled'] ?? false;
$recipientUserIds = [$user->getId()];
if (! empty($data['share_users'])) {
$sharedUserIds = $this->validateAndGetUserIdsByTeam(
$user->team,
(array) $data['share_users']
);
$recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);
}
$sharedGroupIds = [];
if (! empty($data['share_teams'])) {
$sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);
}
$recipientUserIds = array_values(array_unique($recipientUserIds));
return [
'team_id' => $user->getTeamId(),
'type' => self::TYPE_ASK_JIMINNY,
'status' => (bool) $status,
'frequency' => $frequency,
'custom_name' => $name,
'activity_search_id' => $savedSearch->getId(),
'ask_anything_prompt_id' => $prompt->getId(),
'expires_at' => $expiresAtDate->toDateString(),
'media_types' => [self::MEDIA_TYPE_PDF],
'call_types' => [],
'recipients' => ['users' => $recipientUserIds],
'groups' => $sharedGroupIds,
];
}
public static function getAskJiminnyFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::ASK_JIMINNY_FREQUENCIES);
}
public function getAskJiminnyReportFilters(User $user): array
{
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
return [
[
'id' => 'prompt',
'label' => 'Prompt',
'options' => $prompts,
],
[
'id' => 'saved_search',
'label' => 'Saved Search',
'options' => $savedSearches,
],
];
}
public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array
{
$team = $user->getTeam();
$userTimezone = $user->getTimezone();
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
$teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [
'id' => $group->getUuid(),
'name' => $group->getName(),
])->values()->all();
$shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];
$sharedTeamsValue = [];
$sharedUsersValue = [];
if ($report) {
$sharedTeamsValue = $this->transformGroups($team, $report->getGroups());
$recipientUserIds = $report->getRecipients()['users'] ?? [];
$creatorId = $report->getAttribute('created_by');
$sharedUserIds = array_values(array_filter(
$recipientUserIds,
static fn ($id) => $id !== $creatorId
));
$sharedUsersValue = collect($sharedUserIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (User $u) => [
'id' => $u->getUuid(),
'name' => $u->getName(),
])
->values()
->all();
}
return [
'fields' => [
[
'id' => 'enabled',
'inputType' => InputTypeEnum::TOGGLE,
'label' => '',
'value' => $report?->getStatus() ?? false,
],
[
'id' => 'report_name',
'inputType' => InputTypeEnum::TEXT,
'label' => 'Name',
'placeholder' => 'Enter name',
'required' => true,
'validation' => ['maxLength' => 50],
'value' => $report?->getCustomName() ?? '',
],
[
'id' => 'frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'label' => 'Frequency',
'required' => true,
'placeholder' => 'Select',
'options' => self::ASK_JIMINNY_FREQUENCIES,
'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,
],
[
'id' => 'expires_on',
'inputType' => InputTypeEnum::DATE,
'label' => 'Expires on',
'required' => true,
'placeholder' => 'Select',
'validation' => [
'minDate' => now($userTimezone)->toDateString(),
'maxDate' => now($userTimezone)->addYear()->toDateString(),
],
'value' => $report?->getExpiresAt()?->toDateString(),
],
[
...
|
66590
|
|
66593
|
1498
|
0
|
2026-04-21T14:49:02.184747+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776782942184_m2.jpg...
|
PhpStorm
|
faVsco.js – AutomatedReportsService.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsRepositoryTest
Run 'AutomatedReportsRepositoryTest'
Debug 'AutomatedReportsRepositoryTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
3
102
3
34
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Kiosk\AutomatedReports;
use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Carbon\Exceptions\InvalidFormatException;
use DateTime;
use DateTimeInterface;
use DateTimeZone;
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcher;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Jiminny\Component\ActivitySearch\FilterDefinition\InputTypeEnum;
use Jiminny\Component\AskAnything\AskAnythingPromptService;
use Jiminny\Component\AskAnything\Dtos\AskAnythingPromptDto;
use Jiminny\Component\UrlGenerator\Webhook;
use Jiminny\Contracts\Repositories\PlaybookCategoryRepository;
use Jiminny\Contracts\Repositories\TeamRepository;
use Jiminny\Contracts\Repositories\UserRepository;
use Jiminny\Exceptions\ApplicationException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Exceptions\ModelNotFoundException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateReportJob;
use Jiminny\Models\Activity\Search;
use Jiminny\Models\AskAnything\AskAnythingPrompt;
use Jiminny\Models\AskAnything\AskAnythingPromptTarget;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Contracts\UserContract;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AskAnythingRepository;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Repositories\GroupRepository;
use Jiminny\Repositories\SearchRepository;
use Jiminny\Repositories\StageRepository;
use Throwable;
class AutomatedReportsService
{
public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';
public const string TYPE_ASK_JIMINNY = 'ask_jiminny';
/**
* Standard report types (used by kiosk for existing automated reports).
*/
// @TODO this will add filter, however if we need to control feature by FF we need conditional logic
public const array TYPES = [
['id' => 'exec_summary', 'name' => 'Exec Summary'],
['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],
['id' => 'product_feedback', 'name' => 'Product Feedback'],
['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],
// ['id' => 'questions', 'name' => 'Questions'],
// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],
];
public const array ALL_TYPES = [
...self::TYPES,
['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],
];
public const string FREQUENCY_DAILY = 'daily';
public const string FREQUENCY_WEEKLY = 'weekly';
public const string FREQUENCY_MONTHLY = 'monthly';
public const string FREQUENCY_QUARTERLY = 'quarterly';
public const string FREQUENCY_ONE_OFF = 'one_off';
/**
* Frequencies for standard (non-Ask Jiminny) reports.
*/
public const array FREQUENCIES = [
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
/**
* Frequencies for Ask Jiminny reports.
*/
public const array ASK_JIMINNY_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
];
public const string MEDIA_TYPE_PDF = 'pdf';
public const string MEDIA_TYPE_PODCAST = 'podcast';
public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];
public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];
public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];
public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];
public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];
public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];
public const int SENT_REPORT_AT_HOURS = 5;
public const string PDF_KEY = 'pdf';
public const string AUDIO_KEY = 'audio';
private const array ALL_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
private const string S3_DIR = 'reports';
private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];
private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];
public function __construct(
private readonly TeamRepository $teamRepository,
private readonly GroupRepository $groupRepository,
private readonly UserRepository $userRepository,
private readonly StageRepository $stageRepository,
private readonly DealStagesService $dealStagesService,
private readonly RecipientsService $recipientsService,
private readonly AutomatedReportsRepository $automatedReportsRepository,
private readonly Webhook $webhookService,
private readonly BusDispatcher $dispatcher,
private readonly ActivityTypeService $activityTypeService,
private readonly PlaybookCategoryRepository $playbookCategoryRepository,
private readonly AskAnythingPromptService $askAnythingPromptService,
private readonly SearchRepository $activitySearchRepository,
private readonly AskAnythingRepository $askAnythingRepository,
) {
}
public static function getTypes(): array
{
$types = self::TYPES;
return array_map(static function ($type) {
return $type['id'];
}, $types);
}
public static function getCallTypes(): array
{
return array_map(static function ($callType) {
return $callType['id'];
}, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);
}
public static function getFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::FREQUENCIES);
}
// front-facing structure
public function getReportEnabledFieldData(bool $value = false): array
{
return [
'id' => 'report_enabled',
'label' => '',
'inputType' => InputTypeEnum::TOGGLE,
'value' => $value,
];
}
// Organizations = Teams
public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array
{
$options = $this->getTeams();
if ($shortVersion) {
return [
'id' => 'organization',
'label' => 'Organization',
'options' => $options,
];
}
return [
'id' => 'organization',
'label' => 'Organization',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $options,
'value' => $value,
'dependencies' => [
'teams',
'deal_stage_at_call',
'current_deal_stage',
'recipients',
ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,
],
'dependsOn' => [],
];
}
// Teams = Groups
public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array
{
if ($shortVersion) {
return [
'id' => 'teams',
'label' => 'Team',
'options' => $options,
];
}
return [
'id' => 'teams',
'label' => 'Team',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => false,
'placeholder' => 'Select',
'options' => $options,
'value' => $value, // value should be an array of objects {id, name}
'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],
'dependsOn' => [],
];
}
public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array
{
$types = [];
if ($team instanceof Team) {
if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
$types = self::TYPES;
}
if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {
$types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];
}
} else {
$types = self::TYPES;
}
if ($shortVersion) {
return [
'id' => 'report_type',
'label' => 'Report Type',
'options' => $types,
];
}
return [
'id' => 'report_type',
'label' => 'Report Type',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $types,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getFrequencyFieldData(?string $value = null): array
{
return [
'id' => 'frequency',
'label' => 'Frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => self::FREQUENCIES,
'value' => $value,
'dependencies' => ['period'],
'dependsOn' => [],
];
}
public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array
{
return [
'id' => 'period',
'label' => 'Select one-off period',
'inputType' => InputTypeEnum::DATE_RANGE,
'required' => true,
'placeholder' => 'Select',
'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],
'queryParams' => [
'startDate' => 'start_date_period',
'endDate' => 'end_date_period',
],
'dependencies' => [],
'dependsOn' => ['frequency'],
];
}
public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array
{
return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);
}
public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);
}
public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);
}
public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'deal_value',
'label' => 'Deal Value',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_deal_value',
'max' => 'max_deal_value',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array
{
$value = [];
$conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;
$dialerOn && $value[] = self::CALL_TYPE_DIALER;
return [
'id' => 'call_type',
'label' => 'Call Type',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => [
self::CALL_TYPE_CONFERENCE,
self::CALL_TYPE_DIALER,
],
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getMediaTypeFieldData(?AutomatedReport $report = null): array
{
$value = [];
if ($report) {
$value = $this->transformMediaTypes($report);
}
return [
'id' => 'media_types',
'label' => 'Export as',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => self::MEDIA_TYPE_OBJECTS,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'call_duration',
'label' => 'Call Duration',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_call_duration',
'max' => 'max_call_duration',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getRecipientsFieldData(?Team $team = null, array $value = []): array
{
return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);
}
public function getJiminnyRecipientsFieldData(array $value = []): array
{
return $this->recipientsService->getJiminnyRecipientsFieldData($value);
}
public function getAdditionalPromptInputFieldData(?string $value = null): array
{
return [
'id' => 'additional_prompt_input',
'label' => 'Special requirements',
'inputType' => InputTypeEnum::TEXTAREA,
'required' => false,
'placeholder' => 'What should be the focus of the report?',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCustomReportNameFieldData(?string $value = null): array
{
return [
'id' => 'custom_name',
'label' => 'Custom report name',
'inputType' => InputTypeEnum::TEXT,
'required' => false,
'placeholder' => 'Enter custom name',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
// data providers
public function getTeams(): array
{
$teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);
$teamData = [];
foreach ($teams as $team) {
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
continue;
}
$teamData[] = $this->transformTeam($team);
}
return $teamData;
}
public function getTeamGroups(string $teamUuid): array
{
$data = [];
$team = $this->getTeam($teamUuid);
if ($team !== null) {
$groups = $team->groups()->get();
foreach ($groups as $group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
];
}
}
return $data;
}
public function getTeamsGroupsOptions(array $filterTeamUuids = []): array
{
$data = [];
$teams = $this->getTeams();
foreach ($teams as $team) {
if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {
continue;
}
$data[] = [
'label' => $team['name'],
'groups' => $this->getTeamGroups($team['id']),
];
}
return $data;
}
public function getTeam(string $teamUuid): ?Team
{
return $this->teamRepository->idOrUuid($teamUuid);
}
public function getTeamById(int $teamId): ?Team
{
return $this->teamRepository->find($teamId);
}
public function getGroupsUuids(AutomatedReport $report): array
{
$uuids = [];
$reportGroups = $report->getGroups();
foreach ($reportGroups as $groupId) {
if ($group = $this->groupRepository->find($groupId)) {
$uuids[] = $group->getUuid();
}
}
return $uuids;
}
public function getPlaybookCategoriesUuids(AutomatedReport $report): array
{
$uuids = [];
$playbookCategories = $report->getPlaybookCategories();
foreach ($playbookCategories as $id) {
if ($category = $this->playbookCategoryRepository->find($id)) {
$uuids[] = $category->getUuid();
}
}
return $uuids;
}
public function getDealAtCallStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getDealAtCallStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getCurrentDealStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getCurrentDealStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getRecipients());
}
public function getJiminnyUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function extractUserUuids(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => $user->getUuid())
->values()
->all();
}
// get mail data
public function getRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getRecipients());
}
/**
* @return array<UserContract>
*/
public function getRecipientUserObjects(AutomatedReport $report): array
{
$userIds = $report->getRecipients()['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->values()
->all();
}
private function getJiminnyRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function buildRecipientUsers(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => [
'email' => $user->getEmailAddress(),
'name' => $user->getName(),
'timezone' => $user->getTimezone()->getName(),
])
->values()
->all();
}
public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array
{
if ($report->isAskJiminnyReport()) {
$recipients = $this->resolveAskJiminnyRecipients($report);
} else {
$recipients = $this->getRecipientUsers($report);
if ($includeJiminny) {
$recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));
}
}
$emails = [];
return array_values(array_filter(
$recipients,
static function ($recipient) use (&$emails) {
if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {
return false;
}
$emails[] = $recipient['email'];
return true;
}
));
}
private function resolveAskJiminnyRecipients(AutomatedReport $report): array
{
$recipients = [];
$creator = $report->getCreator();
if ($creator !== null) {
$recipients[] = [
'email' => $creator->getEmailAddress(),
'name' => $creator->getName(),
'timezone' => $creator->getTimezone()->getName(),
];
}
return array_merge(
$recipients,
$this->buildRecipientUsers($report->getRecipients()),
$this->getGroupRecipientUsers($report),
);
}
private function getGroupRecipientUsers(AutomatedReport $report): array
{
$users = [];
foreach ($report->getGroups() as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group === null) {
continue;
}
foreach ($group->getMembers() as $member) {
$users[] = [
'email' => $member->getEmailAddress(),
'name' => $member->getName(),
'timezone' => $member->getTimezone()->getName(),
];
}
}
return $users;
}
public function getReportTypeName(AutomatedReportResult $report): string
{
$type = $report->getReport()->getType();
$getType = $this->transformReportType($type);
return $getType['name'];
}
public function getReportPeriodName(AutomatedReportResult $report): string
{
$from = $report->getFromDate();
$to = $report->getToDate();
$frequency = $report->getReport()->getFrequency();
if ($from === null || $to === null) {
if (! $report->getReport()->isAskJiminnyReport()) {
$invalidPeriod = $from === null ? 'from' : 'to';
throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);
}
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
}
return $this->formatReportPeriodName($frequency, $from, $to);
}
private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string
{
$fromYear = $from->format('Y');
$toYear = $to->format('Y');
$differentYears = $fromYear !== $toYear;
switch ($frequency) {
case self::FREQUENCY_DAILY:
return $from->format('j M Y');
case self::FREQUENCY_QUARTERLY:
// 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ
$startMonth = $from->format('M');
$endMonth = $to->copy()->subMonth();
$endMonthName = $endMonth->format('M');
$endMonthYear = $endMonth->format('Y');
if ($differentYears) {
return "{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}";
}
return "{$startMonth} - {$endMonthName} {$toYear}";
case self::FREQUENCY_MONTHLY:
// 'May 2025' - monthly reports are always within the same year
return $from->format('M Y');
case self::FREQUENCY_WEEKLY:
// '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ
$startDay = $from->format('j');
$endDay = $to->format('j');
$startMonth = $from->format('M');
$endMonth = $to->format('M');
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
if ($startMonth !== $endMonth) {
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
}
return "{$startDay} - {$endDay} {$endMonth} {$toYear}";
case self::FREQUENCY_ONE_OFF:
// '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ
$startDay = $from->format('j');
$startMonth = $from->format('M');
$endDay = $to->format('j');
$endMonth = $to->format('M');
// If same month and year, use a format like '2-31 May 2025'
if ($startMonth === $endMonth && ! $differentYears) {
return "{$startDay} - {$endDay} {$startMonth} {$toYear}";
}
// If different years, include both years
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
// Same year but different months
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
default:
// Default format for unknown frequencies
return $from->format('j M Y') . ' - ' . $to->format('j M Y');
}
}
public function getReportTeamsName(AutomatedReportResult $report): string
{
$groups = $report->getGroups();
if (empty($groups)) {
return 'All';
}
// Get group names from repository
$groupNames = [];
foreach ($groups as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group) {
$groupNames[] = $group->getName();
}
}
if (count($groupNames) === 1) {
// Single team format
$teamsName = $groupNames[0];
} else {
// Multiple teams format
$teamsName = implode(', ', $groupNames);
}
return $teamsName;
}
public function getReportFileName(AutomatedReportResult $report): string
{
$customName = $report->getReport()->getCustomName();
$periodName = $this->getReportPeriodName($report);
$filenameSuffix = $this->getFilenameSuffix($report);
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$customName} - {$periodName}");
}
$baseName = $this->getReportTypeName($report);
if ($filenameSuffix) {
$baseName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}");
}
public function getReportFileNameWithExtension(AutomatedReportResult $result): string
{
$extension = $this->getMediaTypeMetadata($result)['extension'];
return $this->getReportFileName($result) . '.' . $extension;
}
public function sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool
{
$recipients = array_map('intval', $report->getRecipients()['users'] ?? []);
return in_array($user->getId(), $recipients);
}
public function transformReportResults(Collection $automatedReportResults): array
{
$data = [];
foreach ($automatedReportResults as $automatedReportResult) {
/** @var AutomatedReportResult $automatedReportResult */
$report = $automatedReportResult->getReport();
$createdBy = $report->getCreator();
$creator = [
'id' => $createdBy?->getUuid(),
'name' => $createdBy?->getName(),
'email' => $createdBy?->getEmailAddress(),
'photoUrl' => $createdBy?->getPhotoUrl(),
];
$recipients = $this->buildRecipients($report);
$data[] = [
'id' => $automatedReportResult->getUuid(),
'name' => $automatedReportResult->getName(),
'frequency' => $this->transformFrequency($report->getFrequency()),
'recipients' => $recipients,
'recipients' => [
...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),
...array_values($this->transformRecipients($report->getRecipients())),
],
'report_type' => $this->transformReportType($report->getType()),
'media_type' => $automatedReportResult->getMediaType(),
'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),
'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),
'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),
'creator' => $creator,
];
}
return $data;
}
private function buildRecipients(AutomatedReport $report)
{
}
public function hasCallTypeConference(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);
}
public function hasCallTypeDialer(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);
}
// transformers
private function transformTeam(Team $team): array
{
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
return [];
}
return [
'id' => $team->getUuid(),
'name' => $team->getName(),
];
}
private function transformReportFullView(AutomatedReport $report): array
{
$base = $this->transformReportBase($report);
return $report->getType() === self::TYPE_ASK_JIMINNY
? $base + $this->transformAskJiminnyFields($report)
: $base + $this->transformStandardReportFields($report);
}
private function transformReportBase(AutomatedReport $report): array
{
return [
'id' => $report->getUuid(),
'organization' => $this->transformOrganization(team: $report->getTeam()),
'report_type' => $this->transformReportType($report->getType()),
'frequency' => $this->transformFrequency($report->getFrequency()),
];
}
private function transformStandardReportFields(AutomatedReport $report): array
{
$team = $report->getTeam();
return [
'report_enabled' => $report->getStatus(),
'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),
'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),
'deal_value_min' => $report->getDealValueMin(),
'deal_value_max' => $report->getDealValueMax(),
'call_types' => $this->transformCallType($report->getCallTypes()),
'media_types' => $this->transformMediaTypes($report),
'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),
'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),
'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),
'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),
'recipients' => $this->transformRecipients($report->getRecipients()),
'created_by' => $this->transformCreator($report->getCreator()),
'additional_prompt_input' => $report->getAdditionalPromptInput(),
'custom_name' => $report->getCustomName(),
'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),
'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),
'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),
];
}
private function transformAskJiminnyFields(AutomatedReport $report): array
{
$team = $report->getTeam();
$creatorId = $report->getAttribute('created_by');
$explicitUserIds = array_values(array_filter(
$report->getRecipients()['users'] ?? [],
static fn ($id) => $id !== $creatorId
));
return [
'report_name' => $report->getCustomName(),
'enabled' => $report->getStatus(),
'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),
'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),
'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),
'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),
];
}
private function transformOrganization(?Team $team): array
{
return [
'id' => $team?->getUuid(),
'name' => $team?->getName(),
];
}
private function transformReportType(string $type): array
{
foreach (self::ALL_TYPES as $typeItem) {
if ($typeItem['id'] === $type) {
return $typeItem;
}
}
return [];
}
private function transformCallType(array $types): array
{
$result = [];
$callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];
foreach ($types as $type) {
foreach ($callTypes as $callTypeItem) {
if ($callTypeItem['id'] === $type) {
$result[] = $callTypeItem;
break;
}
}
}
return $result;
}
private function transformMediaTypes(AutomatedReport $report): array
{
$values = [];
foreach ($report->getMediaTypes() as $mediaType) {
if (! in_array($mediaType, self::MEDIA_TYPES, true)) {
continue;
}
$values[] = match ($mediaType) {
self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,
self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,
};
}
return $values;
}
private function transformFrequency(string $frequency): array
{
foreach (self::ALL_FREQUENCIES as $frequencyItem) {
if ($frequencyItem['id'] === $frequency) {
return $frequencyItem;
}
}
return [];
}
public function transformDurationToMinutes(?int $duration): ?int
{
if (! $duration) {
return null;
}
return (int) ($duration / 60);
}
private function transformGroups(?Team $team, array $groupsIds): array
{
if (empty($groupsIds) || ! $team) {
return [];
}
$data = [];
foreach ($groupsIds as $groupId) {
$group = $team->groups()->where('id', $groupId)->first();
if ($group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
'photoUrl' => $group->getPhotoUrl(),
];
}
}
return $data;
}
private function transformStages(?Team $team, array $stagesIds): array
{
if (empty($stagesIds) || ! $team) {
return [];
}
$data = [];
foreach ($stagesIds as $stageId) {
$stage = $team->stages()->where('id', $stageId)->first();
if ($stage) {
$data[] = [
'id' => $stage->getUuid(),
'name' => $stage->getName(),
];
}
}
return $data;
}
private function transformRecipients(array $recipients): array
{
$users = [];
foreach ($recipients['users'] ?? [] as $userId) {
$users[] = $this->transformUser($userId);
}
return $users;
}
private function transformCreator(?User $user): ?array
{
if ($user === null) {
return null;
}
return $this->transformUser($user->getId());
}
private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array
{
if ($prompt === null) {
return null;
}
return [
'id' => $prompt->getUuid(),
'name' => $prompt->getTitle(),
];
}
private function transformSafeSearch(?Search $search): ?array
{
if ($search === null) {
return null;
}
return [
'id' => $search->getUuid(),
'name' => $search->getName(),
];
}
private function transformUser(int $userId): array
{
/* @var ?User $user */
$user = $this->userRepository->find($userId);
return [
'id' => $user?->getUuid(),
'name' => $user?->getName(),
'email' => $user?->getEmailAddress(),
'photoUrl' => $user?->getPhotoUrl(),
];
}
public function create(array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$validatedData['created_by'] = auth()->id();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
public function update(string $uuid, array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$report = $this->automatedReportsRepository->findByUuid($uuid);
if (! $report) {
throw new InvalidArgumentException('Report not found');
}
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
/**
* Create an Ask Jiminny report.
*/
public function createAskJiminnyReport(array $data, User $creator): array
{
$validatedData = $this->validateAskJiminnyReportData($data, $creator);
$validatedData['created_by'] = $creator->getId();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
return $this->transformReportFullView($automatedReport);
}
/**
* Update an Ask Jiminny report.
*/
public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array
{
if (! $report->isAskJiminnyReport()) {
throw new InvalidArgumentException('Report is not an Ask Jiminny report');
}
$validatedData = $this->validateAskJiminnyReportData($data, $user);
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
return $this->transformReportFullView($automatedReport);
}
public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array
{
$this->automatedReportsRepository->update($report, ['status' => $status]);
return $this->transformReportFullView($report->fresh());
}
/**
* Validate and transform data for Ask Jiminny reports.
*/
private function validateAskJiminnyReportData(array $data, User $user): array
{
// Validate name
$name = trim($data['report_name'] ?? '');
if (empty($name)) {
throw new InvalidArgumentException('Report name is required');
}
if (mb_strlen($name) > 50) {
throw new InvalidArgumentException('Report name must be 50 characters or less');
}
// Validate frequency (only daily, weekly, monthly for Ask Jiminny)
$frequency = $data['frequency'] ?? null;
$askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];
if (! in_array($frequency, $askJiminnyFrequencies, true)) {
throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');
}
// Validate expiration date
$expiresAt = $data['expires_on'] ?? null;
if (empty($expiresAt)) {
throw new InvalidArgumentException('Expiration date is required');
}
try {
$expiresAtDate = Carbon::parse($expiresAt);
} catch (InvalidFormatException $e) {
throw new InvalidArgumentException('Expiration date format is invalid');
}
$maxExpiration = Carbon::now()->addYear()->endOfDay();
if ($expiresAtDate->gt($maxExpiration)) {
throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');
}
if ($expiresAtDate->isPast()) {
throw new InvalidArgumentException('Expiration date cannot be in the past');
}
// Validate saved search
$activitySearchId = $data['saved_search'] ?? null;
if (empty($activitySearchId)) {
throw new InvalidArgumentException('Saved search is required');
}
$savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);
if (! $savedSearch) {
throw new InvalidArgumentException('Saved search not found or does not belong to you');
}
// Validate saved prompt
$askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;
if (empty($askAnythingPromptId)) {
throw new InvalidArgumentException('Ask Jiminny prompt is required');
}
$prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);
if (! $prompt) {
throw new InvalidArgumentException('Ask Jiminny prompt not found');
}
// Validate status
$status = $data['enabled'] ?? false;
$recipientUserIds = [$user->getId()];
if (! empty($data['share_users'])) {
$sharedUserIds = $this->validateAndGetUserIdsByTeam(
$user->team,
(array) $data['share_users']
);
$recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);
}
$sharedGroupIds = [];
if (! empty($data['share_teams'])) {
$sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);
}
$recipientUserIds = array_values(array_unique($recipientUserIds));
return [
'team_id' => $user->getTeamId(),
'type' => self::TYPE_ASK_JIMINNY,
'status' => (bool) $status,
'frequency' => $frequency,
'custom_name' => $name,
'activity_search_id' => $savedSearch->getId(),
'ask_anything_prompt_id' => $prompt->getId(),
'expires_at' => $expiresAtDate->toDateString(),
'media_types' => [self::MEDIA_TYPE_PDF],
'call_types' => [],
'recipients' => ['users' => $recipientUserIds],
'groups' => $sharedGroupIds,
];
}
public static function getAskJiminnyFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::ASK_JIMINNY_FREQUENCIES);
}
public function getAskJiminnyReportFilters(User $user): array
{
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
return [
[
'id' => 'prompt',
'label' => 'Prompt',
'options' => $prompts,
],
[
'id' => 'saved_search',
'label' => 'Saved Search',
'options' => $savedSearches,
],
];
}
public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array
{
$team = $user->getTeam();
$userTimezone = $user->getTimezone();
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
$teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [
'id' => $group->getUuid(),
'name' => $group->getName(),
])->values()->all();
$shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];
$sharedTeamsValue = [];
$sharedUsersValue = [];
if ($report) {
$sharedTeamsValue = $this->transformGroups($team, $report->getGroups());
$recipientUserIds = $report->getRecipients()['users'] ?? [];
$creatorId = $report->getAttribute('created_by');
$sharedUserIds = array_values(array_filter(
$recipientUserIds,
static fn ($id) => $id !== $creatorId
));
$sharedUsersValue = collect($sharedUserIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (User $u) => [
'id' => $u->getUuid(),
'name' => $u->getName(),
])
->values()
->all();
}
return [
'fields' => [
[
'id' => 'enabled',
'inputType' => InputTypeEnum::TOGGLE,
'label' => '',
'value' => $report?->getStatus() ?? false,
],
[
'id' => 'report_name',
'inputType' => InputTypeEnum::TEXT,
'label' => 'Name',
'placeholder' => 'Enter name',
'required' => true,
'validation' => ['maxLength' => 50],
'value' => $report?->getCustomName() ?? '',
],
[
'id' => 'frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'label' => 'Frequency',
'required' => true,
'placeholder' => 'Select',
'options' => self::ASK_JIMINNY_FREQUENCIES,
'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,
],
[
'id' => 'expires_on',
'inputType' => InputTypeEnum::DATE,
'label' => 'Expires on',
'required' => true,
'placeholder' => 'Select',
'validation' => [
'minDate' => now($userTimezone)->toDateString(),
'maxDate' => now($userTimezone)->addYear()->toDateString(),
],
'value' => $report?->getExpiresAt()?->toDateString(),
],
[
...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"#11894 on JY-18909-automated-reports-ask-jiminny, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.12134308,"height":0.025538707},"help_text":"Pull request #11894 exists for current branch JY-18909-automated-reports-ask-jiminny","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8161569,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AutomatedReportsRepositoryTest","depth":6,"bounds":{"left":0.83144945,"top":0.019952115,"width":0.084109046,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AutomatedReportsRepositoryTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AutomatedReportsRepositoryTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"3","depth":4,"bounds":{"left":0.4325133,"top":0.17478053,"width":0.007978723,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"102","depth":4,"bounds":{"left":0.4424867,"top":0.17478053,"width":0.011968086,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"3","depth":4,"bounds":{"left":0.45644948,"top":0.17478053,"width":0.007978723,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"34","depth":4,"bounds":{"left":0.4664229,"top":0.17478053,"width":0.010305851,"height":0.015163607},"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.47839096,"top":0.17318435,"width":0.00731383,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.48570478,"top":0.17318435,"width":0.006981383,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Kiosk\\AutomatedReports;\n\nuse Carbon\\CarbonImmutable;\nuse Carbon\\CarbonInterface;\nuse Carbon\\Exceptions\\InvalidFormatException;\nuse DateTime;\nuse DateTimeInterface;\nuse DateTimeZone;\nuse Illuminate\\Contracts\\Bus\\Dispatcher as BusDispatcher;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Support\\Facades\\Log;\nuse Illuminate\\Support\\Facades\\Storage;\nuse Jiminny\\Component\\ActivitySearch\\FilterDefinition\\InputTypeEnum;\nuse Jiminny\\Component\\AskAnything\\AskAnythingPromptService;\nuse Jiminny\\Component\\AskAnything\\Dtos\\AskAnythingPromptDto;\nuse Jiminny\\Component\\UrlGenerator\\Webhook;\nuse Jiminny\\Contracts\\Repositories\\PlaybookCategoryRepository;\nuse Jiminny\\Contracts\\Repositories\\TeamRepository;\nuse Jiminny\\Contracts\\Repositories\\UserRepository;\nuse Jiminny\\Exceptions\\ApplicationException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Exceptions\\ModelNotFoundException;\nuse Jiminny\\Jobs\\AutomatedReports\\RequestGenerateReportJob;\nuse Jiminny\\Models\\Activity\\Search;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPrompt;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPromptTarget;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Contracts\\UserContract;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Repositories\\AskAnythingRepository;\nuse Jiminny\\Repositories\\AutomatedReportsRepository;\nuse Jiminny\\Repositories\\GroupRepository;\nuse Jiminny\\Repositories\\SearchRepository;\nuse Jiminny\\Repositories\\StageRepository;\nuse Throwable;\n\nclass AutomatedReportsService\n{\n public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';\n public const string TYPE_ASK_JIMINNY = 'ask_jiminny';\n\n /**\n * Standard report types (used by kiosk for existing automated reports).\n */\n // @TODO this will add filter, however if we need to control feature by FF we need conditional logic\n public const array TYPES = [\n ['id' => 'exec_summary', 'name' => 'Exec Summary'],\n ['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],\n ['id' => 'product_feedback', 'name' => 'Product Feedback'],\n ['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],\n// ['id' => 'questions', 'name' => 'Questions'],\n// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],\n ];\n\n public const array ALL_TYPES = [\n ...self::TYPES,\n ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],\n ];\n\n public const string FREQUENCY_DAILY = 'daily';\n public const string FREQUENCY_WEEKLY = 'weekly';\n public const string FREQUENCY_MONTHLY = 'monthly';\n public const string FREQUENCY_QUARTERLY = 'quarterly';\n public const string FREQUENCY_ONE_OFF = 'one_off';\n\n /**\n * Frequencies for standard (non-Ask Jiminny) reports.\n */\n public const array FREQUENCIES = [\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n\n /**\n * Frequencies for Ask Jiminny reports.\n */\n public const array ASK_JIMINNY_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ];\n\n public const string MEDIA_TYPE_PDF = 'pdf';\n public const string MEDIA_TYPE_PODCAST = 'podcast';\n public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];\n public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];\n public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];\n public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];\n\n public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];\n public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];\n public const int SENT_REPORT_AT_HOURS = 5;\n public const string PDF_KEY = 'pdf';\n public const string AUDIO_KEY = 'audio';\n\n private const array ALL_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n private const string S3_DIR = 'reports';\n private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];\n private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];\n\n public function __construct(\n private readonly TeamRepository $teamRepository,\n private readonly GroupRepository $groupRepository,\n private readonly UserRepository $userRepository,\n private readonly StageRepository $stageRepository,\n private readonly DealStagesService $dealStagesService,\n private readonly RecipientsService $recipientsService,\n private readonly AutomatedReportsRepository $automatedReportsRepository,\n private readonly Webhook $webhookService,\n private readonly BusDispatcher $dispatcher,\n private readonly ActivityTypeService $activityTypeService,\n private readonly PlaybookCategoryRepository $playbookCategoryRepository,\n private readonly AskAnythingPromptService $askAnythingPromptService,\n private readonly SearchRepository $activitySearchRepository,\n private readonly AskAnythingRepository $askAnythingRepository,\n ) {\n }\n\n public static function getTypes(): array\n {\n $types = self::TYPES;\n\n return array_map(static function ($type) {\n return $type['id'];\n }, $types);\n }\n\n public static function getCallTypes(): array\n {\n return array_map(static function ($callType) {\n return $callType['id'];\n }, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);\n }\n\n public static function getFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::FREQUENCIES);\n }\n\n // front-facing structure\n public function getReportEnabledFieldData(bool $value = false): array\n {\n return [\n 'id' => 'report_enabled',\n 'label' => '',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'value' => $value,\n ];\n }\n\n // Organizations = Teams\n public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array\n {\n $options = $this->getTeams();\n\n if ($shortVersion) {\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value,\n 'dependencies' => [\n 'teams',\n 'deal_stage_at_call',\n 'current_deal_stage',\n 'recipients',\n ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,\n ],\n 'dependsOn' => [],\n ];\n }\n\n // Teams = Groups\n public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array\n {\n if ($shortVersion) {\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value, // value should be an array of objects {id, name}\n 'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],\n 'dependsOn' => [],\n ];\n }\n\n public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array\n {\n $types = [];\n if ($team instanceof Team) {\n if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n $types = self::TYPES;\n }\n if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {\n $types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];\n }\n } else {\n $types = self::TYPES;\n }\n\n if ($shortVersion) {\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'options' => $types,\n ];\n }\n\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $types,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getFrequencyFieldData(?string $value = null): array\n {\n return [\n 'id' => 'frequency',\n 'label' => 'Frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::FREQUENCIES,\n 'value' => $value,\n 'dependencies' => ['period'],\n 'dependsOn' => [],\n ];\n }\n\n public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array\n {\n return [\n 'id' => 'period',\n 'label' => 'Select one-off period',\n 'inputType' => InputTypeEnum::DATE_RANGE,\n 'required' => true,\n 'placeholder' => 'Select',\n 'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],\n 'queryParams' => [\n 'startDate' => 'start_date_period',\n 'endDate' => 'end_date_period',\n ],\n 'dependencies' => [],\n 'dependsOn' => ['frequency'],\n ];\n }\n\n public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array\n {\n return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);\n }\n\n public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);\n }\n\n public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);\n }\n\n public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'deal_value',\n 'label' => 'Deal Value',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_deal_value',\n 'max' => 'max_deal_value',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array\n {\n $value = [];\n $conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;\n $dialerOn && $value[] = self::CALL_TYPE_DIALER;\n\n return [\n 'id' => 'call_type',\n 'label' => 'Call Type',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => [\n self::CALL_TYPE_CONFERENCE,\n self::CALL_TYPE_DIALER,\n ],\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getMediaTypeFieldData(?AutomatedReport $report = null): array\n {\n $value = [];\n\n if ($report) {\n $value = $this->transformMediaTypes($report);\n }\n\n return [\n 'id' => 'media_types',\n 'label' => 'Export as',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => self::MEDIA_TYPE_OBJECTS,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'call_duration',\n 'label' => 'Call Duration',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_call_duration',\n 'max' => 'max_call_duration',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getRecipientsFieldData(?Team $team = null, array $value = []): array\n {\n return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);\n }\n\n public function getJiminnyRecipientsFieldData(array $value = []): array\n {\n return $this->recipientsService->getJiminnyRecipientsFieldData($value);\n }\n\n public function getAdditionalPromptInputFieldData(?string $value = null): array\n {\n return [\n 'id' => 'additional_prompt_input',\n 'label' => 'Special requirements',\n 'inputType' => InputTypeEnum::TEXTAREA,\n 'required' => false,\n 'placeholder' => 'What should be the focus of the report?',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCustomReportNameFieldData(?string $value = null): array\n {\n return [\n 'id' => 'custom_name',\n 'label' => 'Custom report name',\n 'inputType' => InputTypeEnum::TEXT,\n 'required' => false,\n 'placeholder' => 'Enter custom name',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n // data providers\n public function getTeams(): array\n {\n $teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);\n\n $teamData = [];\n foreach ($teams as $team) {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n continue;\n }\n\n $teamData[] = $this->transformTeam($team);\n }\n\n return $teamData;\n }\n\n public function getTeamGroups(string $teamUuid): array\n {\n $data = [];\n $team = $this->getTeam($teamUuid);\n\n if ($team !== null) {\n $groups = $team->groups()->get();\n\n foreach ($groups as $group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n public function getTeamsGroupsOptions(array $filterTeamUuids = []): array\n {\n $data = [];\n $teams = $this->getTeams();\n\n foreach ($teams as $team) {\n if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {\n continue;\n }\n\n $data[] = [\n 'label' => $team['name'],\n 'groups' => $this->getTeamGroups($team['id']),\n ];\n }\n\n return $data;\n }\n\n public function getTeam(string $teamUuid): ?Team\n {\n return $this->teamRepository->idOrUuid($teamUuid);\n }\n\n public function getTeamById(int $teamId): ?Team\n {\n return $this->teamRepository->find($teamId);\n }\n\n public function getGroupsUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportGroups = $report->getGroups();\n foreach ($reportGroups as $groupId) {\n if ($group = $this->groupRepository->find($groupId)) {\n $uuids[] = $group->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getPlaybookCategoriesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $playbookCategories = $report->getPlaybookCategories();\n foreach ($playbookCategories as $id) {\n if ($category = $this->playbookCategoryRepository->find($id)) {\n $uuids[] = $category->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getDealAtCallStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getDealAtCallStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getCurrentDealStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getCurrentDealStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getRecipients());\n }\n\n public function getJiminnyUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function extractUserUuids(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => $user->getUuid())\n ->values()\n ->all();\n }\n\n // get mail data\n public function getRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getRecipients());\n }\n\n /**\n * @return array<UserContract>\n */\n public function getRecipientUserObjects(AutomatedReport $report): array\n {\n $userIds = $report->getRecipients()['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->values()\n ->all();\n }\n\n private function getJiminnyRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function buildRecipientUsers(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => [\n 'email' => $user->getEmailAddress(),\n 'name' => $user->getName(),\n 'timezone' => $user->getTimezone()->getName(),\n ])\n ->values()\n ->all();\n }\n\n public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array\n {\n if ($report->isAskJiminnyReport()) {\n $recipients = $this->resolveAskJiminnyRecipients($report);\n } else {\n $recipients = $this->getRecipientUsers($report);\n if ($includeJiminny) {\n $recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));\n }\n }\n\n $emails = [];\n\n return array_values(array_filter(\n $recipients,\n static function ($recipient) use (&$emails) {\n if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {\n return false;\n }\n $emails[] = $recipient['email'];\n\n return true;\n }\n ));\n }\n\n private function resolveAskJiminnyRecipients(AutomatedReport $report): array\n {\n $recipients = [];\n\n $creator = $report->getCreator();\n if ($creator !== null) {\n $recipients[] = [\n 'email' => $creator->getEmailAddress(),\n 'name' => $creator->getName(),\n 'timezone' => $creator->getTimezone()->getName(),\n ];\n }\n\n return array_merge(\n $recipients,\n $this->buildRecipientUsers($report->getRecipients()),\n $this->getGroupRecipientUsers($report),\n );\n }\n\n private function getGroupRecipientUsers(AutomatedReport $report): array\n {\n $users = [];\n foreach ($report->getGroups() as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group === null) {\n continue;\n }\n foreach ($group->getMembers() as $member) {\n $users[] = [\n 'email' => $member->getEmailAddress(),\n 'name' => $member->getName(),\n 'timezone' => $member->getTimezone()->getName(),\n ];\n }\n }\n\n return $users;\n }\n\n public function getReportTypeName(AutomatedReportResult $report): string\n {\n $type = $report->getReport()->getType();\n\n $getType = $this->transformReportType($type);\n\n return $getType['name'];\n }\n\n public function getReportPeriodName(AutomatedReportResult $report): string\n {\n $from = $report->getFromDate();\n $to = $report->getToDate();\n $frequency = $report->getReport()->getFrequency();\n\n if ($from === null || $to === null) {\n if (! $report->getReport()->isAskJiminnyReport()) {\n $invalidPeriod = $from === null ? 'from' : 'to';\n\n throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);\n }\n\n $period = $this->calculateFromAndToDatePeriod($frequency);\n $from = $period['fromDate'];\n $to = $period['toDate'];\n }\n\n return $this->formatReportPeriodName($frequency, $from, $to);\n }\n\n private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string\n {\n $fromYear = $from->format('Y');\n $toYear = $to->format('Y');\n $differentYears = $fromYear !== $toYear;\n\n switch ($frequency) {\n case self::FREQUENCY_DAILY:\n return $from->format('j M Y');\n\n case self::FREQUENCY_QUARTERLY:\n // 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ\n $startMonth = $from->format('M');\n $endMonth = $to->copy()->subMonth();\n $endMonthName = $endMonth->format('M');\n $endMonthYear = $endMonth->format('Y');\n\n if ($differentYears) {\n return \"{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}\";\n }\n\n return \"{$startMonth} - {$endMonthName} {$toYear}\";\n\n case self::FREQUENCY_MONTHLY:\n // 'May 2025' - monthly reports are always within the same year\n return $from->format('M Y');\n\n case self::FREQUENCY_WEEKLY:\n // '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ\n $startDay = $from->format('j');\n $endDay = $to->format('j');\n $startMonth = $from->format('M');\n $endMonth = $to->format('M');\n\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n if ($startMonth !== $endMonth) {\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n return \"{$startDay} - {$endDay} {$endMonth} {$toYear}\";\n\n case self::FREQUENCY_ONE_OFF:\n // '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ\n $startDay = $from->format('j');\n $startMonth = $from->format('M');\n $endDay = $to->format('j');\n $endMonth = $to->format('M');\n\n // If same month and year, use a format like '2-31 May 2025'\n if ($startMonth === $endMonth && ! $differentYears) {\n return \"{$startDay} - {$endDay} {$startMonth} {$toYear}\";\n }\n\n // If different years, include both years\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n // Same year but different months\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n\n default:\n // Default format for unknown frequencies\n return $from->format('j M Y') . ' - ' . $to->format('j M Y');\n }\n }\n\n public function getReportTeamsName(AutomatedReportResult $report): string\n {\n $groups = $report->getGroups();\n\n if (empty($groups)) {\n return 'All';\n }\n\n // Get group names from repository\n $groupNames = [];\n foreach ($groups as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group) {\n $groupNames[] = $group->getName();\n }\n }\n\n if (count($groupNames) === 1) {\n // Single team format\n $teamsName = $groupNames[0];\n } else {\n // Multiple teams format\n $teamsName = implode(', ', $groupNames);\n }\n\n return $teamsName;\n }\n\n public function getReportFileName(AutomatedReportResult $report): string\n {\n $customName = $report->getReport()->getCustomName();\n $periodName = $this->getReportPeriodName($report);\n $filenameSuffix = $this->getFilenameSuffix($report);\n\n if ($customName) {\n if ($filenameSuffix) {\n $customName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$customName} - {$periodName}\");\n }\n\n $baseName = $this->getReportTypeName($report);\n\n if ($filenameSuffix) {\n $baseName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}\");\n }\n\n public function getReportFileNameWithExtension(AutomatedReportResult $result): string\n {\n $extension = $this->getMediaTypeMetadata($result)['extension'];\n\n return $this->getReportFileName($result) . '.' . $extension;\n }\n\n public function sanitizeFileName(string $fileName): string\n {\n return str_replace(['/', '\\\\'], '-', $fileName);\n }\n\n public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool\n {\n $recipients = array_map('intval', $report->getRecipients()['users'] ?? []);\n\n return in_array($user->getId(), $recipients);\n }\n\n public function transformReportResults(Collection $automatedReportResults): array\n {\n $data = [];\n foreach ($automatedReportResults as $automatedReportResult) {\n /** @var AutomatedReportResult $automatedReportResult */\n\n $report = $automatedReportResult->getReport();\n\n $createdBy = $report->getCreator();\n $creator = [\n 'id' => $createdBy?->getUuid(),\n 'name' => $createdBy?->getName(),\n 'email' => $createdBy?->getEmailAddress(),\n 'photoUrl' => $createdBy?->getPhotoUrl(),\n ];\n\n $recipients = $this->buildRecipients($report);\n\n $data[] = [\n 'id' => $automatedReportResult->getUuid(),\n 'name' => $automatedReportResult->getName(),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n 'recipients' => $recipients,\n 'recipients' => [\n ...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),\n ...array_values($this->transformRecipients($report->getRecipients())),\n ],\n 'report_type' => $this->transformReportType($report->getType()),\n 'media_type' => $automatedReportResult->getMediaType(),\n 'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),\n 'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),\n 'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),\n 'creator' => $creator,\n ];\n \n \n }\n\n return $data;\n }\n\n private function buildRecipients(AutomatedReport $report)\n {\n \n }\n\n public function hasCallTypeConference(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);\n }\n\n public function hasCallTypeDialer(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);\n }\n\n // transformers\n private function transformTeam(Team $team): array\n {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n return [];\n }\n\n return [\n 'id' => $team->getUuid(),\n 'name' => $team->getName(),\n ];\n }\n\n private function transformReportFullView(AutomatedReport $report): array\n {\n $base = $this->transformReportBase($report);\n\n return $report->getType() === self::TYPE_ASK_JIMINNY\n ? $base + $this->transformAskJiminnyFields($report)\n : $base + $this->transformStandardReportFields($report);\n }\n\n private function transformReportBase(AutomatedReport $report): array\n {\n return [\n 'id' => $report->getUuid(),\n 'organization' => $this->transformOrganization(team: $report->getTeam()),\n 'report_type' => $this->transformReportType($report->getType()),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n ];\n }\n\n private function transformStandardReportFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n\n return [\n 'report_enabled' => $report->getStatus(),\n 'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),\n 'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),\n 'deal_value_min' => $report->getDealValueMin(),\n 'deal_value_max' => $report->getDealValueMax(),\n 'call_types' => $this->transformCallType($report->getCallTypes()),\n 'media_types' => $this->transformMediaTypes($report),\n 'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),\n 'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),\n 'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),\n 'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),\n 'recipients' => $this->transformRecipients($report->getRecipients()),\n 'created_by' => $this->transformCreator($report->getCreator()),\n 'additional_prompt_input' => $report->getAdditionalPromptInput(),\n 'custom_name' => $report->getCustomName(),\n 'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),\n 'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),\n 'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),\n ];\n }\n\n private function transformAskJiminnyFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n $creatorId = $report->getAttribute('created_by');\n $explicitUserIds = array_values(array_filter(\n $report->getRecipients()['users'] ?? [],\n static fn ($id) => $id !== $creatorId\n ));\n\n return [\n 'report_name' => $report->getCustomName(),\n 'enabled' => $report->getStatus(),\n 'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),\n 'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),\n 'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),\n 'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),\n ];\n }\n\n private function transformOrganization(?Team $team): array\n {\n return [\n 'id' => $team?->getUuid(),\n 'name' => $team?->getName(),\n ];\n }\n\n private function transformReportType(string $type): array\n {\n foreach (self::ALL_TYPES as $typeItem) {\n if ($typeItem['id'] === $type) {\n return $typeItem;\n }\n }\n\n return [];\n }\n\n private function transformCallType(array $types): array\n {\n $result = [];\n $callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];\n\n foreach ($types as $type) {\n foreach ($callTypes as $callTypeItem) {\n if ($callTypeItem['id'] === $type) {\n $result[] = $callTypeItem;\n\n break;\n }\n }\n }\n\n return $result;\n }\n\n private function transformMediaTypes(AutomatedReport $report): array\n {\n $values = [];\n\n foreach ($report->getMediaTypes() as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n continue;\n }\n\n $values[] = match ($mediaType) {\n self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,\n self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,\n };\n }\n\n return $values;\n }\n\n private function transformFrequency(string $frequency): array\n {\n foreach (self::ALL_FREQUENCIES as $frequencyItem) {\n if ($frequencyItem['id'] === $frequency) {\n return $frequencyItem;\n }\n }\n\n return [];\n }\n\n public function transformDurationToMinutes(?int $duration): ?int\n {\n if (! $duration) {\n return null;\n }\n\n return (int) ($duration / 60);\n }\n\n private function transformGroups(?Team $team, array $groupsIds): array\n {\n if (empty($groupsIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($groupsIds as $groupId) {\n $group = $team->groups()->where('id', $groupId)->first();\n\n if ($group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n 'photoUrl' => $group->getPhotoUrl(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformStages(?Team $team, array $stagesIds): array\n {\n if (empty($stagesIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($stagesIds as $stageId) {\n $stage = $team->stages()->where('id', $stageId)->first();\n\n if ($stage) {\n $data[] = [\n 'id' => $stage->getUuid(),\n 'name' => $stage->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformRecipients(array $recipients): array\n {\n $users = [];\n foreach ($recipients['users'] ?? [] as $userId) {\n $users[] = $this->transformUser($userId);\n }\n\n return $users;\n }\n\n private function transformCreator(?User $user): ?array\n {\n if ($user === null) {\n return null;\n }\n\n return $this->transformUser($user->getId());\n }\n\n private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array\n {\n if ($prompt === null) {\n return null;\n }\n\n return [\n 'id' => $prompt->getUuid(),\n 'name' => $prompt->getTitle(),\n ];\n }\n\n private function transformSafeSearch(?Search $search): ?array\n {\n if ($search === null) {\n return null;\n }\n\n return [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ];\n }\n\n private function transformUser(int $userId): array\n {\n /* @var ?User $user */\n $user = $this->userRepository->find($userId);\n\n return [\n 'id' => $user?->getUuid(),\n 'name' => $user?->getName(),\n 'email' => $user?->getEmailAddress(),\n 'photoUrl' => $user?->getPhotoUrl(),\n ];\n }\n\n public function create(array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $validatedData['created_by'] = auth()->id();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function update(string $uuid, array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $report = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $report) {\n throw new InvalidArgumentException('Report not found');\n }\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Create an Ask Jiminny report.\n */\n public function createAskJiminnyReport(array $data, User $creator): array\n {\n $validatedData = $this->validateAskJiminnyReportData($data, $creator);\n $validatedData['created_by'] = $creator->getId();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Update an Ask Jiminny report.\n */\n public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array\n {\n if (! $report->isAskJiminnyReport()) {\n throw new InvalidArgumentException('Report is not an Ask Jiminny report');\n }\n\n $validatedData = $this->validateAskJiminnyReportData($data, $user);\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array\n {\n $this->automatedReportsRepository->update($report, ['status' => $status]);\n\n return $this->transformReportFullView($report->fresh());\n }\n\n /**\n * Validate and transform data for Ask Jiminny reports.\n */\n private function validateAskJiminnyReportData(array $data, User $user): array\n {\n // Validate name\n $name = trim($data['report_name'] ?? '');\n if (empty($name)) {\n throw new InvalidArgumentException('Report name is required');\n }\n if (mb_strlen($name) > 50) {\n throw new InvalidArgumentException('Report name must be 50 characters or less');\n }\n\n // Validate frequency (only daily, weekly, monthly for Ask Jiminny)\n $frequency = $data['frequency'] ?? null;\n $askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];\n if (! in_array($frequency, $askJiminnyFrequencies, true)) {\n throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');\n }\n\n // Validate expiration date\n $expiresAt = $data['expires_on'] ?? null;\n if (empty($expiresAt)) {\n throw new InvalidArgumentException('Expiration date is required');\n }\n\n try {\n $expiresAtDate = Carbon::parse($expiresAt);\n } catch (InvalidFormatException $e) {\n throw new InvalidArgumentException('Expiration date format is invalid');\n }\n $maxExpiration = Carbon::now()->addYear()->endOfDay();\n if ($expiresAtDate->gt($maxExpiration)) {\n throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');\n }\n if ($expiresAtDate->isPast()) {\n throw new InvalidArgumentException('Expiration date cannot be in the past');\n }\n\n // Validate saved search\n $activitySearchId = $data['saved_search'] ?? null;\n if (empty($activitySearchId)) {\n throw new InvalidArgumentException('Saved search is required');\n }\n $savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);\n if (! $savedSearch) {\n throw new InvalidArgumentException('Saved search not found or does not belong to you');\n }\n\n // Validate saved prompt\n $askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;\n if (empty($askAnythingPromptId)) {\n throw new InvalidArgumentException('Ask Jiminny prompt is required');\n }\n $prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);\n if (! $prompt) {\n throw new InvalidArgumentException('Ask Jiminny prompt not found');\n }\n\n // Validate status\n $status = $data['enabled'] ?? false;\n\n $recipientUserIds = [$user->getId()];\n\n if (! empty($data['share_users'])) {\n $sharedUserIds = $this->validateAndGetUserIdsByTeam(\n $user->team,\n (array) $data['share_users']\n );\n $recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);\n }\n\n $sharedGroupIds = [];\n if (! empty($data['share_teams'])) {\n $sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);\n }\n\n $recipientUserIds = array_values(array_unique($recipientUserIds));\n\n return [\n 'team_id' => $user->getTeamId(),\n 'type' => self::TYPE_ASK_JIMINNY,\n 'status' => (bool) $status,\n 'frequency' => $frequency,\n 'custom_name' => $name,\n 'activity_search_id' => $savedSearch->getId(),\n 'ask_anything_prompt_id' => $prompt->getId(),\n 'expires_at' => $expiresAtDate->toDateString(),\n 'media_types' => [self::MEDIA_TYPE_PDF],\n 'call_types' => [],\n 'recipients' => ['users' => $recipientUserIds],\n 'groups' => $sharedGroupIds,\n ];\n }\n\n public static function getAskJiminnyFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::ASK_JIMINNY_FREQUENCIES);\n }\n\n public function getAskJiminnyReportFilters(User $user): array\n {\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n return [\n [\n 'id' => 'prompt',\n 'label' => 'Prompt',\n 'options' => $prompts,\n ],\n [\n 'id' => 'saved_search',\n 'label' => 'Saved Search',\n 'options' => $savedSearches,\n ],\n ];\n }\n\n public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array\n {\n $team = $user->getTeam();\n $userTimezone = $user->getTimezone();\n\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n $teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ])->values()->all();\n\n $shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];\n\n $sharedTeamsValue = [];\n $sharedUsersValue = [];\n if ($report) {\n $sharedTeamsValue = $this->transformGroups($team, $report->getGroups());\n\n $recipientUserIds = $report->getRecipients()['users'] ?? [];\n $creatorId = $report->getAttribute('created_by');\n $sharedUserIds = array_values(array_filter(\n $recipientUserIds,\n static fn ($id) => $id !== $creatorId\n ));\n $sharedUsersValue = collect($sharedUserIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (User $u) => [\n 'id' => $u->getUuid(),\n 'name' => $u->getName(),\n ])\n ->values()\n ->all();\n }\n\n return [\n 'fields' => [\n [\n 'id' => 'enabled',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'label' => '',\n 'value' => $report?->getStatus() ?? false,\n ],\n [\n 'id' => 'report_name',\n 'inputType' => InputTypeEnum::TEXT,\n 'label' => 'Name',\n 'placeholder' => 'Enter name',\n 'required' => true,\n 'validation' => ['maxLength' => 50],\n 'value' => $report?->getCustomName() ?? '',\n ],\n [\n 'id' => 'frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Frequency',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::ASK_JIMINNY_FREQUENCIES,\n 'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,\n ],\n [\n 'id' => 'expires_on',\n 'inputType' => InputTypeEnum::DATE,\n 'label' => 'Expires on',\n 'required' => true,\n 'placeholder' => 'Select',\n 'validation' => [\n 'minDate' => now($userTimezone)->toDateString(),\n 'maxDate' => now($userTimezone)->addYear()->toDateString(),\n ],\n 'value' => $report?->getExpiresAt()?->toDateString(),\n ],\n [\n 'id' => 'share_teams',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team',\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $teamGroups,\n 'value' => $sharedTeamsValue,\n ],\n [\n 'id' => 'share_users',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team member',\n 'required' => false,\n 'placeholder' => 'Select',\n 'groupLabelKey' => 'label',\n 'groupValuesKey' => 'users',\n 'optionLabelKey' => 'name',\n 'optionValueKey' => 'id',\n 'options' => $shareUsers,\n 'value' => $sharedUsersValue,\n ],\n [\n 'id' => 'saved_search',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Saved search',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $savedSearches,\n 'value' => $report && $report->getSavedSearch() ? [\n 'id' => $report->getSavedSearch()->getUuid(),\n 'name' => $report->getSavedSearch()->getName(),\n ] : null,\n ],\n [\n 'id' => 'ask_jiminny_prompt',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Ask Jiminny prompt',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $prompts,\n 'value' => $report && $report->getAskAnythingPrompt() ? [\n 'id' => $report->getAskAnythingPrompt()->getUuid(),\n 'name' => $report->getAskAnythingPrompt()->getTitle(),\n ] : null,\n ],\n ],\n ];\n }\n\n private function updateResultNames(AutomatedReport $automatedReport): void\n {\n $results = $this->automatedReportsRepository->getResultsByReport($automatedReport);\n\n foreach ($results as $result) {\n $result->update(['name' => $this->getReportFileName($result)]);\n }\n }\n\n public function updateStatus(string $uuid, array $data): array\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $automatedReport->update([\n 'status' => $status,\n ]);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n private function generateOneOffReport(AutomatedReport $automatedReport): void\n {\n // the scheduler handles all the other frequency types\n if ($automatedReport->getStatus() === false || $automatedReport->getFrequency() !== self::FREQUENCY_ONE_OFF) {\n return;\n }\n\n $this->dispatcher->dispatch(new RequestGenerateReportJob($automatedReport->getUuid()));\n }\n\n public function getReport(string $uuid): AutomatedReport\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n return $automatedReport;\n }\n\n public function get(string $uuid): array\n {\n $automatedReport = $this->getReport($uuid);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function list(string $sortColumn = 'created_at', string $sortDirection = 'desc'): array\n {\n $results = [];\n $collection = $this->automatedReportsRepository->getAllStandardReports($sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function listAskJiminnyReports(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): array {\n $results = [];\n $collection = $this->automatedReportsRepository->getAskJiminnyReportsByUser($user, $sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function delete(string $uuid): void\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $automatedReport->delete();\n }\n\n public function createReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n return $this->automatedReportsRepository->createResult(\n array_merge(\n [\n 'report_id' => $automatedReport->getId(),\n 'status' => AutomatedReportResult::STATUS_DEFAULT,\n ],\n $data\n )\n );\n }\n\n public function getOrCreateReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n $existing = $this->automatedReportsRepository->findLatestDefaultOrFailedResult($automatedReport);\n\n if ($existing !== null) {\n $existing->update(['status' => AutomatedReportResult::STATUS_DEFAULT]);\n\n return $existing;\n }\n\n return $this->createReportResult($automatedReport, $data);\n }\n\n public function getReportResult(string $resultUuid): AutomatedReportResult\n {\n $report = $this->automatedReportsRepository->findResultByUuid($resultUuid);\n\n if (! $report) {\n throw new ModelNotFoundException('Report Result not found');\n }\n\n return $report;\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return $this->automatedReportsRepository->findChildResult($result, $type);\n }\n\n // prophet API calls\n /**\n * @throws ApplicationException\n */\n public function getGenerateReportPayload(AutomatedReport $automatedReport, string $reportResultUuid): array\n {\n $period = $this->calculateFromAndToDate($automatedReport);\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n return [\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResultUuid,\n 'report_type' => $automatedReport->getType(),\n 'media_types' => $automatedReport->getMediaTypes(),\n 'from_date' => $fromDate->startOfDay()->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->endOfDay()->format(DateTimeInterface::RFC3339),\n 'group_ids' => $automatedReport->getGroups(),\n 'call_deal_stage' => $automatedReport->getDealAtCallStages(),\n 'current_deal_stage' => $automatedReport->getCurrentDealStages(),\n 'deal_min_value' => $automatedReport->getDealValueMin(),\n 'deal_max_value' => $automatedReport->getDealValueMax(),\n 'call_types' => $automatedReport->getCallTypes(),\n 'call_duration_min_seconds' => $automatedReport->getCallDurationMin(),\n 'call_duration_max_seconds' => $automatedReport->getCallDurationMax(),\n 'special_requirements' => $automatedReport->getAdditionalPromptInput(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->formatReportPeriodName(\n $automatedReport->getFrequency(),\n $fromDate,\n $toDate,\n ),\n 'playbook_categories' => $automatedReport->getPlaybookCategories(),\n 'custom_name' => $automatedReport->getCustomName(),\n ];\n }\n\n // $inputPayload - FE payload structure\n public function getActivitiesCountPayload(array $inputPayload): array\n {\n // Use validateAndTransformData to validate and normalize input\n $validatedData = $this->validateAndTransformData($inputPayload);\n $period = $this->calculateFromAndToDatePeriod(\n $validatedData['frequency'],\n Carbon::parse($validatedData['from']),\n Carbon::parse($validatedData['to']),\n );\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n // Create payload similar to getGenerateReportPayload\n return [\n 'team_id' => $validatedData['team_id'],\n 'group_ids' => $validatedData['groups'] ?? [],\n 'report_type' => $validatedData['type'],\n 'from_date' => $fromDate->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->format(DateTimeInterface::RFC3339),\n 'call_deal_stage' => $validatedData['deal_at_call_stages'] ?? [],\n 'current_deal_stage' => $validatedData['current_deal_stages'] ?? [],\n 'deal_min_value' => $validatedData['deal_value_min'] ?? null,\n 'deal_max_value' => $validatedData['deal_value_max'] ?? null,\n 'call_types' => $validatedData['call_types'],\n 'call_duration_min_seconds' => $validatedData['call_duration_min'] ?? null,\n 'call_duration_max_seconds' => $validatedData['call_duration_max'] ?? null,\n 'special_requirements' => $validatedData['additional_prompt_input'] ?? null,\n 'playbook_categories' => $validatedData['playbook_categories'] ?? [],\n 'request_id' => null,\n 'callback_url' => null,\n ];\n }\n\n public function shouldSendReport(array $users, ?CarbonInterface $generatedAt = null): bool\n {\n if (empty($users)) {\n return false;\n }\n\n $earliestTz = collect($users)\n ->mapWithKeys(function (array $user) {\n $tz = new DateTimeZone($user['timezone']);\n $nowUtc = new DateTime('now', new DateTimeZone('UTC'));\n $offset = $tz->getOffset($nowUtc);\n\n return [$user['timezone'] => $offset];\n })\n ->sortDesc()\n ->keys()\n ->first();\n\n $now = Carbon::now($earliestTz);\n $isScheduledTime = (int) $now->format('H') === self::SENT_REPORT_AT_HOURS;\n\n if ($isScheduledTime) {\n return true;\n }\n\n return $this->hasPassedScheduledTime($generatedAt, $earliestTz);\n }\n\n public function hasPassedScheduledTime(?CarbonInterface $generatedAt, string $timezone): bool\n {\n if ($generatedAt === null) {\n return false;\n }\n\n $now = Carbon::now($timezone);\n $scheduledTime = $now->copy()->setTime(self::SENT_REPORT_AT_HOURS, 0, 0);\n\n if ($now->hour < self::SENT_REPORT_AT_HOURS) {\n $scheduledTime = $scheduledTime->subDay();\n }\n\n $scheduledTimeUtc = $scheduledTime->copy()->utc();\n $generatedAtUtc = $generatedAt->copy()->utc();\n $nowUtc = $now->copy()->utc();\n\n return $generatedAtUtc->lt($scheduledTimeUtc) && $nowUtc->gt($scheduledTimeUtc);\n }\n\n public function calculateFromAndToDatePeriod(\n string $frequency,\n ?Carbon $fromDate = null,\n ?Carbon $toDate = null\n ): array {\n if ($frequency === self::FREQUENCY_ONE_OFF) {\n return [\n 'fromDate' => $fromDate,\n 'toDate' => $toDate,\n ];\n }\n\n $now = Carbon::now();\n\n return match ($frequency) {\n self::FREQUENCY_DAILY => [\n 'fromDate' => $now->copy()->subDay()->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_WEEKLY => [\n 'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_MONTHLY => [\n 'fromDate' => $now->copy()->subMonths(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_QUARTERLY => [\n 'fromDate' => $now->copy()->subMonths(3)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n default => throw new InvalidArgumentException(\"Unsupported frequency: {$frequency}\"),\n };\n }\n\n private function calculateFromAndToDate(AutomatedReport $automatedReport): array\n {\n return $this->calculateFromAndToDatePeriod(\n $automatedReport->getFrequency(),\n $automatedReport->getFrom(),\n $automatedReport->getTo()\n );\n }\n\n public function getAskJiminnyGenerateReportPayload(\n AutomatedReport $automatedReport,\n AutomatedReportResult $reportResult,\n array $activityIds,\n ): array {\n return [\n 'user_question' => $automatedReport->getAskAnythingPrompt()?->getContent(),\n 'call_ids' => array_map('strval', $activityIds),\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResult->getUuid(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->getReportPeriodName($reportResult),\n 'report_name' => $automatedReport->getCustomName(),\n ];\n }\n\n private function getCallbackUrl(): string\n {\n return $this->webhookService->route('jiminny.webhook.reports.ready');\n }\n\n /**\n * Validate and transform payload data for automated reports\n *\n * @param array $data\n *\n * @throws InvalidArgumentException\n *\n * @return array\n */\n private function validateAndTransformData(array $data): array\n {\n // Validate organization (team) and check feature\n $team = $this->validateOrganization($data['organization'] ?? null);\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $type = $this->validateReportType($data['report_type'] ?? null);\n $frequency = $this->validateFrequency($data['frequency'] ?? null);\n $additionalPromptInput = $this->validateAdditionalPromptInput(\n $data['additional_prompt_input'] ?? null\n );\n $customReportName = $this->validateCustomReportName($data['custom_name'] ?? null);\n\n // Prepare data for the database\n $reportData = [\n 'team_id' => $team->getId(),\n 'type' => $type,\n 'status' => $status,\n 'frequency' => $frequency,\n 'additional_prompt_input' => $additionalPromptInput,\n 'custom_name' => $customReportName,\n ];\n\n // Validate deal values\n $reportData = $this->validateDealValues($data, $reportData);\n\n // Validate date range\n $reportData = $this->validateDateRange($data, $reportData, $frequency);\n\n // Validate call durations\n $reportData = $this->validateCallDurations($data, $reportData);\n\n // Validate call types\n $reportData = $this->validateCallTypes($data, $reportData);\n\n // Validate media types\n $reportData = $this->validateMediaTypes($data, $reportData);\n\n // Validate groups\n if (isset($data['teams'])) {\n $reportData['groups'] = $this->validateAndGetGroupIds($team, $data['teams']);\n }\n\n // Validate deal stages\n $reportData = $this->validateDealStages($data, $reportData, $team, $type);\n\n // Validate playbook categories\n $reportData = $this->validatePlaybookCategories($data, $reportData, $team);\n\n // Validate recipients\n $reportData['recipients'] = [\n 'users' => $this->validateAndGetUserIdsByTeam($team, $data['recipients'] ?? []),\n ];\n\n if (isset($data['jiminny_recipients'])) {\n // Validate Jiminny recipients\n $reportData['jiminny_recipients'] = [\n 'users' => $this->validateAndGetJiminnyUserIds((array) $data['jiminny_recipients']),\n ];\n }\n\n return $reportData;\n }\n\n private function validateDealValues(array $data, array $reportData): array\n {\n if (isset($data['min_deal_value'])) {\n $reportData['deal_value_min'] = (int) $data['min_deal_value'];\n\n if ($reportData['deal_value_min'] > 4294967295 || $reportData['deal_value_min'] < 0) {\n throw new InvalidArgumentException('Min deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_deal_value'])) {\n $reportData['deal_value_max'] = (int) $data['max_deal_value'];\n\n if ($reportData['deal_value_max'] > 4294967295 || $reportData['deal_value_max'] < 0) {\n throw new InvalidArgumentException('Max deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['min_deal_value'], $data['max_deal_value'])\n && $data['min_deal_value'] > $data['max_deal_value']\n ) {\n throw new InvalidArgumentException('Min deal value cannot be greater than max deal value');\n }\n\n return $reportData;\n }\n\n private function validateDateRange(array $data, array $reportData, string $frequency): array\n {\n // Set date range only for one_off frequency\n if ($frequency === 'one_off') {\n if (isset($data['start_date_period'])) {\n $reportData['from'] = $this->parseDate($data['start_date_period']);\n }\n\n if (isset($data['end_date_period'])) {\n $reportData['to'] = $this->parseDate($data['end_date_period']);\n }\n\n if (empty($reportData['from']) || empty($reportData['to'])) {\n throw new InvalidArgumentException(\n 'Start date and end date are required for one_off frequency'\n );\n }\n } else {\n $reportData['from'] = null;\n $reportData['to'] = null;\n }\n\n return $reportData;\n }\n\n private function validateCallDurations(array $data, array $reportData): array\n {\n // Convert call durations from minutes to seconds\n if (isset($data['min_call_duration'])) {\n $reportData['call_duration_min'] = (int) $data['min_call_duration'] * 60;\n\n if ($reportData['call_duration_min'] > 4294967295 || $reportData['call_duration_min'] < 0) {\n throw new InvalidArgumentException('Min call duration should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_call_duration'])) {\n $reportData['call_duration_max'] = (int) $data['max_call_duration'] * 60;\n\n if ($reportData['call_duration_max'] > 4294967295 || $reportData['call_duration_max'] < 0) {\n throw new InvalidArgumentException('Max call duration should be between 0 and 4294967295');\n }\n }\n\n return $reportData;\n }\n\n private function validateCallTypes(array $data, array $reportData): array\n {\n // Set call types\n $reportData['call_types'] = $data['call_type'] ?? [];\n if (empty($reportData['call_types'])) {\n $reportData['call_types'] = self::getCallTypes();\n }\n\n foreach ($reportData['call_types'] as $callType) {\n if (! in_array($callType, self::getCallTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Call type %s is invalid', $callType));\n }\n }\n\n return $reportData;\n }\n\n private function validateMediaTypes(array $data, array $reportData): array\n {\n // Set media types from input data\n $reportData['media_types'] = $data['media_types'] ?? [];\n\n if (empty($reportData['media_types'])) {\n throw new InvalidArgumentException('Media types are required');\n }\n\n foreach ($reportData['media_types'] as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n throw new InvalidArgumentException(sprintf('Media type %s is invalid', $mediaType));\n }\n }\n\n return $reportData;\n }\n\n private function validateDealStages(array $data, array $reportData, Team $team, string $reportType): array\n {\n // Validate and set deal stages\n if (isset($data['deal_stage_at_call'])) {\n $reportData['deal_at_call_stages'] =\n $this->validateAndGetDealStageIds($team, $data['deal_stage_at_call'], 'Deal stage at call');\n }\n\n if (isset($data['current_deal_stage'])) {\n $reportData['current_deal_stages'] =\n $this->validateAndGetDealStageIds($team, $data['current_deal_stage'], 'Current deal stage');\n }\n\n // Ensure current_deal_stage is not provided for loss_analysis report type\n if ($reportType === self::TYPE_LOSS_ANALYSIS && ! empty($data['current_deal_stage'])) {\n throw new InvalidArgumentException('Current deal stage is not applicable for Loss Analysis reports');\n }\n\n return $reportData;\n }\n\n // transform uuid to id\n private function validatePlaybookCategories(array $data, array $reportData, Team $team): array\n {\n $key = 'playbook_categories';\n\n if (isset($data[$key])) {\n $payloadIds = $data[$key];\n $ids = [];\n\n foreach ($payloadIds as $uuid) {\n $uuid = (string) $uuid;\n\n try {\n $playbookCategory = $this->playbookCategoryRepository->findByUuid($uuid);\n } catch (Throwable $throwable) {\n Log::error(__METHOD__ . ' ' . $throwable->getMessage());\n\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory) {\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory->hasPlaybook()) {\n throw new InvalidArgumentException(sprintf('Playbook category %s has no playbook', $uuid));\n }\n\n if ($playbookCategory->getPlaybook()->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Playbook category %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $ids[] = $playbookCategory->getId();\n }\n\n $reportData[$key] = $ids;\n }\n\n return $reportData;\n }\n\n private function validateReportStatus($status): bool\n {\n if (! in_array($status, [true, false], true)) {\n throw new InvalidArgumentException('Report status is invalid');\n }\n\n return $status;\n }\n\n private function validateReportType($type): string\n {\n if (! in_array($type, self::getTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Report type is invalid: %s', $type));\n }\n\n return $type;\n }\n\n private function validateFrequency($frequency): string\n {\n if (! in_array($frequency, self::getFrequencies(), true)) {\n throw new InvalidArgumentException('Frequency is invalid');\n }\n\n return $frequency;\n }\n\n private function validateAdditionalPromptInput(?string $additionalPromptInput): ?string\n {\n if ($additionalPromptInput && strlen($additionalPromptInput) > 5000) {\n throw new InvalidArgumentException('Additional Prompt Input should be less than 5000 characters');\n }\n\n return $additionalPromptInput;\n }\n\n private function validateCustomReportName(?string $customReportName): ?string\n {\n if ($customReportName === null || $customReportName === '') {\n return null;\n }\n\n if (strlen($customReportName) > 70) {\n throw new InvalidArgumentException('Custom report name should be less than 70 characters');\n }\n\n return $customReportName;\n }\n\n private function validateOrganization(?string $organizationUuid): Team\n {\n if (! $organizationUuid) {\n throw new InvalidArgumentException('Organization is required');\n }\n\n $team = $this->teamRepository->idOrUuid($organizationUuid);\n\n if (! $team) {\n throw new InvalidArgumentException('Organization not found');\n }\n\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n throw new InvalidArgumentException('Organization does not have the Automated Reports feature');\n }\n\n return $team;\n }\n\n private function validateAndGetGroupIds(Team $team, array $teamUuids): array\n {\n $groupIds = [];\n\n foreach ($teamUuids as $uuid) {\n $group = $this->groupRepository->findByUuid($uuid);\n\n if ($group === null || $group->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Group %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $groupIds[] = $group->getId();\n\n }\n\n return $groupIds;\n }\n\n private function validateAndGetDealStageIds(Team $team, array $stageUuids, string $propertyLabel): array\n {\n $stageIds = [];\n\n foreach ($stageUuids as $uuid) {\n $stage = $this->stageRepository->findByUuid($uuid);\n\n if ($stage === null || $stage->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Stage %s not found for team %s for %s', $uuid, $team->getUuid(), $propertyLabel)\n );\n }\n\n $stageIds[] = $stage->getId();\n }\n\n return $stageIds;\n }\n\n private function validateAndGetUserIds(array $userUuids, callable $teamCheck): array\n {\n if (empty($userUuids)) {\n return [];\n }\n\n $userIds = [];\n\n foreach ($userUuids as $uuid) {\n $user = $this->userRepository->findByUuid($uuid);\n\n if (! $user || ! $user->isStatusActive()) {\n throw new InvalidArgumentException(\n sprintf('User %s not found or is not active', $uuid)\n );\n }\n\n if (! $teamCheck($user)) {\n throw new InvalidArgumentException(\n sprintf('User %s does not belong to the allowed team(s)', $uuid)\n );\n }\n\n $userIds[] = $user->getId();\n }\n\n return $userIds;\n }\n\n private function validateAndGetUserIdsByTeam(Team $team, array $userUuids): array\n {\n return $this->validateAndGetUserIds($userUuids, fn ($user) => $user->getTeamId() === $team->getId());\n }\n\n private function validateAndGetJiminnyUserIds(array $userUuids): array\n {\n $allowedTeamIds = config('kiosk.teamIds', []);\n\n return $this->validateAndGetUserIds($userUuids, fn ($user) => in_array($user->getTeamId(), $allowedTeamIds, true));\n }\n\n private function parseDate(string $dateString): string\n {\n return date('Y-m-d H:i:s', strtotime($dateString));\n }\n\n private function generateReportResultViewUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.view', ['uuid' => $result->getUuid()]);\n }\n\n private function generateReportResultDownloadUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.download', ['uuid' => $result->getUuid()]);\n }\n\n private function getReportMediaRouteResource(AutomatedReportResult $result): string\n {\n if ($result->getMediaType() === self::MEDIA_TYPE_PDF) {\n return self::PDF_KEY;\n } elseif ($result->getMediaType() === self::MEDIA_TYPE_PODCAST) {\n return self::AUDIO_KEY;\n }\n\n throw new \\InvalidArgumentException('Unknown media type.');\n }\n\n public function getMediaPath(AutomatedReportResult $result): ?string\n {\n $url = match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => $result->getPdfUrl(),\n self::MEDIA_TYPE_PODCAST => $result->getPodcastAudioUrl(),\n default => null,\n };\n\n if ($url === null) {\n return null;\n }\n\n $path = parse_url(trim($url, '\"\\''), PHP_URL_PATH);\n\n return $path ?: null;\n }\n\n public function getFilenameSuffix(AutomatedReportResult $result): ?string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => 'Podcast',\n default => null,\n };\n }\n\n public function getMailSubjectSuffix(AutomatedReportResult $result): string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => 'report',\n self::MEDIA_TYPE_PODCAST => 'podcast',\n default => '',\n };\n }\n\n public function getMediaTypeMetadata(AutomatedReportResult $result): array\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => ['extension' => 'mp3', 'mime' => 'audio/mpeg'],\n self::MEDIA_TYPE_PDF => ['extension' => 'pdf', 'mime' => 'application/pdf'],\n default => ['extension' => null, 'mime' => null],\n };\n }\n\n public function deleteS3Files(AutomatedReportResult $result): void\n {\n $teamUuid = $result->getReport()->getTeam()->getUuid();\n $reportUuid = $result->getUuid();\n\n // delete all files for a report uuid no mather of pdf, podcast, or both\n // in case of both - the podcast files are linked to the pdf (parent) uuid\n // pdf and podcast date times should be close\n $path = sprintf('%s/%s/%s', $teamUuid, self::S3_DIR, $reportUuid);\n\n foreach (self::FILE_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted S3 file', [\n 'path' => $file,\n ]);\n }\n }\n\n foreach (self::FILE_PODCAST_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '_podcast.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted Podcast S3 file', [\n 'path' => $file,\n ]);\n }\n }\n }\n\n /**\n *\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): Collection\n {\n return $this->automatedReportsRepository->getTeamIdsWithReportsResults($teamId);\n }\n\n /**\n * Core delete logic for report results using a query\n *\n * @param Builder $query\n * @param array $logContext\n *\n * @return int\n */\n private function deleteReportResultsByQuery(Builder $query, array $logContext = []): int\n {\n $deletedCount = 0;\n\n if ($query->exists()) {\n Log::info(\n 'Run delete report results',\n array_merge(\n $logContext,\n [\n 'service' => 'AutomatedReportsService',\n ]\n )\n );\n\n $query->chunkById(50, function ($results) use (&$deletedCount, $logContext) {\n foreach ($results as $result) {\n $this->deleteReportResult($result);\n $deletedCount++;\n\n Log::info(\n 'Deleted a report result',\n array_merge(\n $logContext,\n [\n 'result_id' => $result->getId(),\n 'report_id' => $result->getReportId(),\n ]\n )\n );\n }\n });\n }\n\n return $deletedCount;\n }\n\n /**\n * Delete report results for a team by retention period\n *\n * @param Team $team\n * @param CarbonImmutable $retentionDate\n *\n * @return int Number of deleted report results\n */\n public function deleteReportsResultsInRetentionPeriod(Team $team, CarbonImmutable $retentionDate): int\n {\n $reportIds = $this->automatedReportsRepository->getReportIdsByTeam($team);\n\n if ($reportIds->isEmpty()) {\n return 0;\n }\n\n $query = $this->automatedReportsRepository\n ->getReportResultsQueryForRetention($team, $retentionDate);\n\n return $this->deleteReportResultsByQuery($query, [\n 'team_id' => $team->getId(),\n 'retention_date' => $retentionDate->toDateTimeString(),\n ]);\n }\n\n /**\n * Delete ALL report results for a specific automated report\n *\n * @param string $uuid\n *\n * @return int\n */\n public function deleteReportResults(string $uuid): int\n {\n $report = $this->getReport($uuid);\n\n $query = $this->automatedReportsRepository->getResultsByReportQuery($report);\n\n return $this->deleteReportResultsByQuery($query, [\n 'report_uuid' => $uuid,\n 'report_id' => $report->getId(),\n ]);\n }\n\n public function deleteReportResult(AutomatedReportResult $result): void\n {\n $this->deleteS3Files($result);\n\n $result->delete();\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getTeamReports(Team $team): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getReportsByTeam($team);\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getReportResults(AutomatedReport $report): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getResultsByReport($report);\n }\n\n public function deleteAllReportResults(AutomatedReport $report): void\n {\n $results = $this->getReportResults($report);\n\n /** @var AutomatedReportResult $result */\n foreach ($results as $result) {\n Log::info('Deleting result', [\n 'report' => $report->getId(),\n 'result' => $result->getId(),\n ]);\n\n $this->deleteReportResult($result);\n }\n }\n\n public function deleteAllData(Team $team): void\n {\n Log::info('Deleting automated report and results for team', [\n 'team' => $team->getId(),\n ]);\n\n $reports = $this->getTeamReports($team);\n\n /** @var AutomatedReport $report */\n foreach ($reports as $report) {\n Log::info('Deleting report', [\n 'team' => $team->getId(),\n 'report' => $report->getId(),\n ]);\n\n $this->deleteAllReportResults($report);\n\n $report->delete();\n }\n }\n}","depth":4,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Kiosk\\AutomatedReports;\n\nuse Carbon\\CarbonImmutable;\nuse Carbon\\CarbonInterface;\nuse Carbon\\Exceptions\\InvalidFormatException;\nuse DateTime;\nuse DateTimeInterface;\nuse DateTimeZone;\nuse Illuminate\\Contracts\\Bus\\Dispatcher as BusDispatcher;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Support\\Facades\\Log;\nuse Illuminate\\Support\\Facades\\Storage;\nuse Jiminny\\Component\\ActivitySearch\\FilterDefinition\\InputTypeEnum;\nuse Jiminny\\Component\\AskAnything\\AskAnythingPromptService;\nuse Jiminny\\Component\\AskAnything\\Dtos\\AskAnythingPromptDto;\nuse Jiminny\\Component\\UrlGenerator\\Webhook;\nuse Jiminny\\Contracts\\Repositories\\PlaybookCategoryRepository;\nuse Jiminny\\Contracts\\Repositories\\TeamRepository;\nuse Jiminny\\Contracts\\Repositories\\UserRepository;\nuse Jiminny\\Exceptions\\ApplicationException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Exceptions\\ModelNotFoundException;\nuse Jiminny\\Jobs\\AutomatedReports\\RequestGenerateReportJob;\nuse Jiminny\\Models\\Activity\\Search;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPrompt;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPromptTarget;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Contracts\\UserContract;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Repositories\\AskAnythingRepository;\nuse Jiminny\\Repositories\\AutomatedReportsRepository;\nuse Jiminny\\Repositories\\GroupRepository;\nuse Jiminny\\Repositories\\SearchRepository;\nuse Jiminny\\Repositories\\StageRepository;\nuse Throwable;\n\nclass AutomatedReportsService\n{\n public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';\n public const string TYPE_ASK_JIMINNY = 'ask_jiminny';\n\n /**\n * Standard report types (used by kiosk for existing automated reports).\n */\n // @TODO this will add filter, however if we need to control feature by FF we need conditional logic\n public const array TYPES = [\n ['id' => 'exec_summary', 'name' => 'Exec Summary'],\n ['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],\n ['id' => 'product_feedback', 'name' => 'Product Feedback'],\n ['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],\n// ['id' => 'questions', 'name' => 'Questions'],\n// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],\n ];\n\n public const array ALL_TYPES = [\n ...self::TYPES,\n ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],\n ];\n\n public const string FREQUENCY_DAILY = 'daily';\n public const string FREQUENCY_WEEKLY = 'weekly';\n public const string FREQUENCY_MONTHLY = 'monthly';\n public const string FREQUENCY_QUARTERLY = 'quarterly';\n public const string FREQUENCY_ONE_OFF = 'one_off';\n\n /**\n * Frequencies for standard (non-Ask Jiminny) reports.\n */\n public const array FREQUENCIES = [\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n\n /**\n * Frequencies for Ask Jiminny reports.\n */\n public const array ASK_JIMINNY_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ];\n\n public const string MEDIA_TYPE_PDF = 'pdf';\n public const string MEDIA_TYPE_PODCAST = 'podcast';\n public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];\n public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];\n public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];\n public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];\n\n public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];\n public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];\n public const int SENT_REPORT_AT_HOURS = 5;\n public const string PDF_KEY = 'pdf';\n public const string AUDIO_KEY = 'audio';\n\n private const array ALL_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n private const string S3_DIR = 'reports';\n private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];\n private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];\n\n public function __construct(\n private readonly TeamRepository $teamRepository,\n private readonly GroupRepository $groupRepository,\n private readonly UserRepository $userRepository,\n private readonly StageRepository $stageRepository,\n private readonly DealStagesService $dealStagesService,\n private readonly RecipientsService $recipientsService,\n private readonly AutomatedReportsRepository $automatedReportsRepository,\n private readonly Webhook $webhookService,\n private readonly BusDispatcher $dispatcher,\n private readonly ActivityTypeService $activityTypeService,\n private readonly PlaybookCategoryRepository $playbookCategoryRepository,\n private readonly AskAnythingPromptService $askAnythingPromptService,\n private readonly SearchRepository $activitySearchRepository,\n private readonly AskAnythingRepository $askAnythingRepository,\n ) {\n }\n\n public static function getTypes(): array\n {\n $types = self::TYPES;\n\n return array_map(static function ($type) {\n return $type['id'];\n }, $types);\n }\n\n public static function getCallTypes(): array\n {\n return array_map(static function ($callType) {\n return $callType['id'];\n }, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);\n }\n\n public static function getFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::FREQUENCIES);\n }\n\n // front-facing structure\n public function getReportEnabledFieldData(bool $value = false): array\n {\n return [\n 'id' => 'report_enabled',\n 'label' => '',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'value' => $value,\n ];\n }\n\n // Organizations = Teams\n public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array\n {\n $options = $this->getTeams();\n\n if ($shortVersion) {\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value,\n 'dependencies' => [\n 'teams',\n 'deal_stage_at_call',\n 'current_deal_stage',\n 'recipients',\n ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,\n ],\n 'dependsOn' => [],\n ];\n }\n\n // Teams = Groups\n public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array\n {\n if ($shortVersion) {\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value, // value should be an array of objects {id, name}\n 'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],\n 'dependsOn' => [],\n ];\n }\n\n public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array\n {\n $types = [];\n if ($team instanceof Team) {\n if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n $types = self::TYPES;\n }\n if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {\n $types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];\n }\n } else {\n $types = self::TYPES;\n }\n\n if ($shortVersion) {\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'options' => $types,\n ];\n }\n\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $types,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getFrequencyFieldData(?string $value = null): array\n {\n return [\n 'id' => 'frequency',\n 'label' => 'Frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::FREQUENCIES,\n 'value' => $value,\n 'dependencies' => ['period'],\n 'dependsOn' => [],\n ];\n }\n\n public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array\n {\n return [\n 'id' => 'period',\n 'label' => 'Select one-off period',\n 'inputType' => InputTypeEnum::DATE_RANGE,\n 'required' => true,\n 'placeholder' => 'Select',\n 'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],\n 'queryParams' => [\n 'startDate' => 'start_date_period',\n 'endDate' => 'end_date_period',\n ],\n 'dependencies' => [],\n 'dependsOn' => ['frequency'],\n ];\n }\n\n public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array\n {\n return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);\n }\n\n public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);\n }\n\n public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);\n }\n\n public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'deal_value',\n 'label' => 'Deal Value',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_deal_value',\n 'max' => 'max_deal_value',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array\n {\n $value = [];\n $conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;\n $dialerOn && $value[] = self::CALL_TYPE_DIALER;\n\n return [\n 'id' => 'call_type',\n 'label' => 'Call Type',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => [\n self::CALL_TYPE_CONFERENCE,\n self::CALL_TYPE_DIALER,\n ],\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getMediaTypeFieldData(?AutomatedReport $report = null): array\n {\n $value = [];\n\n if ($report) {\n $value = $this->transformMediaTypes($report);\n }\n\n return [\n 'id' => 'media_types',\n 'label' => 'Export as',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => self::MEDIA_TYPE_OBJECTS,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'call_duration',\n 'label' => 'Call Duration',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_call_duration',\n 'max' => 'max_call_duration',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getRecipientsFieldData(?Team $team = null, array $value = []): array\n {\n return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);\n }\n\n public function getJiminnyRecipientsFieldData(array $value = []): array\n {\n return $this->recipientsService->getJiminnyRecipientsFieldData($value);\n }\n\n public function getAdditionalPromptInputFieldData(?string $value = null): array\n {\n return [\n 'id' => 'additional_prompt_input',\n 'label' => 'Special requirements',\n 'inputType' => InputTypeEnum::TEXTAREA,\n 'required' => false,\n 'placeholder' => 'What should be the focus of the report?',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCustomReportNameFieldData(?string $value = null): array\n {\n return [\n 'id' => 'custom_name',\n 'label' => 'Custom report name',\n 'inputType' => InputTypeEnum::TEXT,\n 'required' => false,\n 'placeholder' => 'Enter custom name',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n // data providers\n public function getTeams(): array\n {\n $teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);\n\n $teamData = [];\n foreach ($teams as $team) {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n continue;\n }\n\n $teamData[] = $this->transformTeam($team);\n }\n\n return $teamData;\n }\n\n public function getTeamGroups(string $teamUuid): array\n {\n $data = [];\n $team = $this->getTeam($teamUuid);\n\n if ($team !== null) {\n $groups = $team->groups()->get();\n\n foreach ($groups as $group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n public function getTeamsGroupsOptions(array $filterTeamUuids = []): array\n {\n $data = [];\n $teams = $this->getTeams();\n\n foreach ($teams as $team) {\n if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {\n continue;\n }\n\n $data[] = [\n 'label' => $team['name'],\n 'groups' => $this->getTeamGroups($team['id']),\n ];\n }\n\n return $data;\n }\n\n public function getTeam(string $teamUuid): ?Team\n {\n return $this->teamRepository->idOrUuid($teamUuid);\n }\n\n public function getTeamById(int $teamId): ?Team\n {\n return $this->teamRepository->find($teamId);\n }\n\n public function getGroupsUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportGroups = $report->getGroups();\n foreach ($reportGroups as $groupId) {\n if ($group = $this->groupRepository->find($groupId)) {\n $uuids[] = $group->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getPlaybookCategoriesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $playbookCategories = $report->getPlaybookCategories();\n foreach ($playbookCategories as $id) {\n if ($category = $this->playbookCategoryRepository->find($id)) {\n $uuids[] = $category->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getDealAtCallStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getDealAtCallStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getCurrentDealStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getCurrentDealStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getRecipients());\n }\n\n public function getJiminnyUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function extractUserUuids(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => $user->getUuid())\n ->values()\n ->all();\n }\n\n // get mail data\n public function getRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getRecipients());\n }\n\n /**\n * @return array<UserContract>\n */\n public function getRecipientUserObjects(AutomatedReport $report): array\n {\n $userIds = $report->getRecipients()['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->values()\n ->all();\n }\n\n private function getJiminnyRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function buildRecipientUsers(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => [\n 'email' => $user->getEmailAddress(),\n 'name' => $user->getName(),\n 'timezone' => $user->getTimezone()->getName(),\n ])\n ->values()\n ->all();\n }\n\n public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array\n {\n if ($report->isAskJiminnyReport()) {\n $recipients = $this->resolveAskJiminnyRecipients($report);\n } else {\n $recipients = $this->getRecipientUsers($report);\n if ($includeJiminny) {\n $recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));\n }\n }\n\n $emails = [];\n\n return array_values(array_filter(\n $recipients,\n static function ($recipient) use (&$emails) {\n if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {\n return false;\n }\n $emails[] = $recipient['email'];\n\n return true;\n }\n ));\n }\n\n private function resolveAskJiminnyRecipients(AutomatedReport $report): array\n {\n $recipients = [];\n\n $creator = $report->getCreator();\n if ($creator !== null) {\n $recipients[] = [\n 'email' => $creator->getEmailAddress(),\n 'name' => $creator->getName(),\n 'timezone' => $creator->getTimezone()->getName(),\n ];\n }\n\n return array_merge(\n $recipients,\n $this->buildRecipientUsers($report->getRecipients()),\n $this->getGroupRecipientUsers($report),\n );\n }\n\n private function getGroupRecipientUsers(AutomatedReport $report): array\n {\n $users = [];\n foreach ($report->getGroups() as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group === null) {\n continue;\n }\n foreach ($group->getMembers() as $member) {\n $users[] = [\n 'email' => $member->getEmailAddress(),\n 'name' => $member->getName(),\n 'timezone' => $member->getTimezone()->getName(),\n ];\n }\n }\n\n return $users;\n }\n\n public function getReportTypeName(AutomatedReportResult $report): string\n {\n $type = $report->getReport()->getType();\n\n $getType = $this->transformReportType($type);\n\n return $getType['name'];\n }\n\n public function getReportPeriodName(AutomatedReportResult $report): string\n {\n $from = $report->getFromDate();\n $to = $report->getToDate();\n $frequency = $report->getReport()->getFrequency();\n\n if ($from === null || $to === null) {\n if (! $report->getReport()->isAskJiminnyReport()) {\n $invalidPeriod = $from === null ? 'from' : 'to';\n\n throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);\n }\n\n $period = $this->calculateFromAndToDatePeriod($frequency);\n $from = $period['fromDate'];\n $to = $period['toDate'];\n }\n\n return $this->formatReportPeriodName($frequency, $from, $to);\n }\n\n private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string\n {\n $fromYear = $from->format('Y');\n $toYear = $to->format('Y');\n $differentYears = $fromYear !== $toYear;\n\n switch ($frequency) {\n case self::FREQUENCY_DAILY:\n return $from->format('j M Y');\n\n case self::FREQUENCY_QUARTERLY:\n // 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ\n $startMonth = $from->format('M');\n $endMonth = $to->copy()->subMonth();\n $endMonthName = $endMonth->format('M');\n $endMonthYear = $endMonth->format('Y');\n\n if ($differentYears) {\n return \"{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}\";\n }\n\n return \"{$startMonth} - {$endMonthName} {$toYear}\";\n\n case self::FREQUENCY_MONTHLY:\n // 'May 2025' - monthly reports are always within the same year\n return $from->format('M Y');\n\n case self::FREQUENCY_WEEKLY:\n // '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ\n $startDay = $from->format('j');\n $endDay = $to->format('j');\n $startMonth = $from->format('M');\n $endMonth = $to->format('M');\n\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n if ($startMonth !== $endMonth) {\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n return \"{$startDay} - {$endDay} {$endMonth} {$toYear}\";\n\n case self::FREQUENCY_ONE_OFF:\n // '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ\n $startDay = $from->format('j');\n $startMonth = $from->format('M');\n $endDay = $to->format('j');\n $endMonth = $to->format('M');\n\n // If same month and year, use a format like '2-31 May 2025'\n if ($startMonth === $endMonth && ! $differentYears) {\n return \"{$startDay} - {$endDay} {$startMonth} {$toYear}\";\n }\n\n // If different years, include both years\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n // Same year but different months\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n\n default:\n // Default format for unknown frequencies\n return $from->format('j M Y') . ' - ' . $to->format('j M Y');\n }\n }\n\n public function getReportTeamsName(AutomatedReportResult $report): string\n {\n $groups = $report->getGroups();\n\n if (empty($groups)) {\n return 'All';\n }\n\n // Get group names from repository\n $groupNames = [];\n foreach ($groups as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group) {\n $groupNames[] = $group->getName();\n }\n }\n\n if (count($groupNames) === 1) {\n // Single team format\n $teamsName = $groupNames[0];\n } else {\n // Multiple teams format\n $teamsName = implode(', ', $groupNames);\n }\n\n return $teamsName;\n }\n\n public function getReportFileName(AutomatedReportResult $report): string\n {\n $customName = $report->getReport()->getCustomName();\n $periodName = $this->getReportPeriodName($report);\n $filenameSuffix = $this->getFilenameSuffix($report);\n\n if ($customName) {\n if ($filenameSuffix) {\n $customName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$customName} - {$periodName}\");\n }\n\n $baseName = $this->getReportTypeName($report);\n\n if ($filenameSuffix) {\n $baseName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}\");\n }\n\n public function getReportFileNameWithExtension(AutomatedReportResult $result): string\n {\n $extension = $this->getMediaTypeMetadata($result)['extension'];\n\n return $this->getReportFileName($result) . '.' . $extension;\n }\n\n public function sanitizeFileName(string $fileName): string\n {\n return str_replace(['/', '\\\\'], '-', $fileName);\n }\n\n public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool\n {\n $recipients = array_map('intval', $report->getRecipients()['users'] ?? []);\n\n return in_array($user->getId(), $recipients);\n }\n\n public function transformReportResults(Collection $automatedReportResults): array\n {\n $data = [];\n foreach ($automatedReportResults as $automatedReportResult) {\n /** @var AutomatedReportResult $automatedReportResult */\n\n $report = $automatedReportResult->getReport();\n\n $createdBy = $report->getCreator();\n $creator = [\n 'id' => $createdBy?->getUuid(),\n 'name' => $createdBy?->getName(),\n 'email' => $createdBy?->getEmailAddress(),\n 'photoUrl' => $createdBy?->getPhotoUrl(),\n ];\n\n $recipients = $this->buildRecipients($report);\n\n $data[] = [\n 'id' => $automatedReportResult->getUuid(),\n 'name' => $automatedReportResult->getName(),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n 'recipients' => $recipients,\n 'recipients' => [\n ...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),\n ...array_values($this->transformRecipients($report->getRecipients())),\n ],\n 'report_type' => $this->transformReportType($report->getType()),\n 'media_type' => $automatedReportResult->getMediaType(),\n 'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),\n 'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),\n 'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),\n 'creator' => $creator,\n ];\n \n \n }\n\n return $data;\n }\n\n private function buildRecipients(AutomatedReport $report)\n {\n \n }\n\n public function hasCallTypeConference(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);\n }\n\n public function hasCallTypeDialer(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);\n }\n\n // transformers\n private function transformTeam(Team $team): array\n {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n return [];\n }\n\n return [\n 'id' => $team->getUuid(),\n 'name' => $team->getName(),\n ];\n }\n\n private function transformReportFullView(AutomatedReport $report): array\n {\n $base = $this->transformReportBase($report);\n\n return $report->getType() === self::TYPE_ASK_JIMINNY\n ? $base + $this->transformAskJiminnyFields($report)\n : $base + $this->transformStandardReportFields($report);\n }\n\n private function transformReportBase(AutomatedReport $report): array\n {\n return [\n 'id' => $report->getUuid(),\n 'organization' => $this->transformOrganization(team: $report->getTeam()),\n 'report_type' => $this->transformReportType($report->getType()),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n ];\n }\n\n private function transformStandardReportFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n\n return [\n 'report_enabled' => $report->getStatus(),\n 'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),\n 'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),\n 'deal_value_min' => $report->getDealValueMin(),\n 'deal_value_max' => $report->getDealValueMax(),\n 'call_types' => $this->transformCallType($report->getCallTypes()),\n 'media_types' => $this->transformMediaTypes($report),\n 'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),\n 'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),\n 'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),\n 'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),\n 'recipients' => $this->transformRecipients($report->getRecipients()),\n 'created_by' => $this->transformCreator($report->getCreator()),\n 'additional_prompt_input' => $report->getAdditionalPromptInput(),\n 'custom_name' => $report->getCustomName(),\n 'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),\n 'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),\n 'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),\n ];\n }\n\n private function transformAskJiminnyFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n $creatorId = $report->getAttribute('created_by');\n $explicitUserIds = array_values(array_filter(\n $report->getRecipients()['users'] ?? [],\n static fn ($id) => $id !== $creatorId\n ));\n\n return [\n 'report_name' => $report->getCustomName(),\n 'enabled' => $report->getStatus(),\n 'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),\n 'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),\n 'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),\n 'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),\n ];\n }\n\n private function transformOrganization(?Team $team): array\n {\n return [\n 'id' => $team?->getUuid(),\n 'name' => $team?->getName(),\n ];\n }\n\n private function transformReportType(string $type): array\n {\n foreach (self::ALL_TYPES as $typeItem) {\n if ($typeItem['id'] === $type) {\n return $typeItem;\n }\n }\n\n return [];\n }\n\n private function transformCallType(array $types): array\n {\n $result = [];\n $callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];\n\n foreach ($types as $type) {\n foreach ($callTypes as $callTypeItem) {\n if ($callTypeItem['id'] === $type) {\n $result[] = $callTypeItem;\n\n break;\n }\n }\n }\n\n return $result;\n }\n\n private function transformMediaTypes(AutomatedReport $report): array\n {\n $values = [];\n\n foreach ($report->getMediaTypes() as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n continue;\n }\n\n $values[] = match ($mediaType) {\n self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,\n self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,\n };\n }\n\n return $values;\n }\n\n private function transformFrequency(string $frequency): array\n {\n foreach (self::ALL_FREQUENCIES as $frequencyItem) {\n if ($frequencyItem['id'] === $frequency) {\n return $frequencyItem;\n }\n }\n\n return [];\n }\n\n public function transformDurationToMinutes(?int $duration): ?int\n {\n if (! $duration) {\n return null;\n }\n\n return (int) ($duration / 60);\n }\n\n private function transformGroups(?Team $team, array $groupsIds): array\n {\n if (empty($groupsIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($groupsIds as $groupId) {\n $group = $team->groups()->where('id', $groupId)->first();\n\n if ($group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n 'photoUrl' => $group->getPhotoUrl(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformStages(?Team $team, array $stagesIds): array\n {\n if (empty($stagesIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($stagesIds as $stageId) {\n $stage = $team->stages()->where('id', $stageId)->first();\n\n if ($stage) {\n $data[] = [\n 'id' => $stage->getUuid(),\n 'name' => $stage->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformRecipients(array $recipients): array\n {\n $users = [];\n foreach ($recipients['users'] ?? [] as $userId) {\n $users[] = $this->transformUser($userId);\n }\n\n return $users;\n }\n\n private function transformCreator(?User $user): ?array\n {\n if ($user === null) {\n return null;\n }\n\n return $this->transformUser($user->getId());\n }\n\n private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array\n {\n if ($prompt === null) {\n return null;\n }\n\n return [\n 'id' => $prompt->getUuid(),\n 'name' => $prompt->getTitle(),\n ];\n }\n\n private function transformSafeSearch(?Search $search): ?array\n {\n if ($search === null) {\n return null;\n }\n\n return [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ];\n }\n\n private function transformUser(int $userId): array\n {\n /* @var ?User $user */\n $user = $this->userRepository->find($userId);\n\n return [\n 'id' => $user?->getUuid(),\n 'name' => $user?->getName(),\n 'email' => $user?->getEmailAddress(),\n 'photoUrl' => $user?->getPhotoUrl(),\n ];\n }\n\n public function create(array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $validatedData['created_by'] = auth()->id();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function update(string $uuid, array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $report = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $report) {\n throw new InvalidArgumentException('Report not found');\n }\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Create an Ask Jiminny report.\n */\n public function createAskJiminnyReport(array $data, User $creator): array\n {\n $validatedData = $this->validateAskJiminnyReportData($data, $creator);\n $validatedData['created_by'] = $creator->getId();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Update an Ask Jiminny report.\n */\n public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array\n {\n if (! $report->isAskJiminnyReport()) {\n throw new InvalidArgumentException('Report is not an Ask Jiminny report');\n }\n\n $validatedData = $this->validateAskJiminnyReportData($data, $user);\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array\n {\n $this->automatedReportsRepository->update($report, ['status' => $status]);\n\n return $this->transformReportFullView($report->fresh());\n }\n\n /**\n * Validate and transform data for Ask Jiminny reports.\n */\n private function validateAskJiminnyReportData(array $data, User $user): array\n {\n // Validate name\n $name = trim($data['report_name'] ?? '');\n if (empty($name)) {\n throw new InvalidArgumentException('Report name is required');\n }\n if (mb_strlen($name) > 50) {\n throw new InvalidArgumentException('Report name must be 50 characters or less');\n }\n\n // Validate frequency (only daily, weekly, monthly for Ask Jiminny)\n $frequency = $data['frequency'] ?? null;\n $askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];\n if (! in_array($frequency, $askJiminnyFrequencies, true)) {\n throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');\n }\n\n // Validate expiration date\n $expiresAt = $data['expires_on'] ?? null;\n if (empty($expiresAt)) {\n throw new InvalidArgumentException('Expiration date is required');\n }\n\n try {\n $expiresAtDate = Carbon::parse($expiresAt);\n } catch (InvalidFormatException $e) {\n throw new InvalidArgumentException('Expiration date format is invalid');\n }\n $maxExpiration = Carbon::now()->addYear()->endOfDay();\n if ($expiresAtDate->gt($maxExpiration)) {\n throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');\n }\n if ($expiresAtDate->isPast()) {\n throw new InvalidArgumentException('Expiration date cannot be in the past');\n }\n\n // Validate saved search\n $activitySearchId = $data['saved_search'] ?? null;\n if (empty($activitySearchId)) {\n throw new InvalidArgumentException('Saved search is required');\n }\n $savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);\n if (! $savedSearch) {\n throw new InvalidArgumentException('Saved search not found or does not belong to you');\n }\n\n // Validate saved prompt\n $askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;\n if (empty($askAnythingPromptId)) {\n throw new InvalidArgumentException('Ask Jiminny prompt is required');\n }\n $prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);\n if (! $prompt) {\n throw new InvalidArgumentException('Ask Jiminny prompt not found');\n }\n\n // Validate status\n $status = $data['enabled'] ?? false;\n\n $recipientUserIds = [$user->getId()];\n\n if (! empty($data['share_users'])) {\n $sharedUserIds = $this->validateAndGetUserIdsByTeam(\n $user->team,\n (array) $data['share_users']\n );\n $recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);\n }\n\n $sharedGroupIds = [];\n if (! empty($data['share_teams'])) {\n $sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);\n }\n\n $recipientUserIds = array_values(array_unique($recipientUserIds));\n\n return [\n 'team_id' => $user->getTeamId(),\n 'type' => self::TYPE_ASK_JIMINNY,\n 'status' => (bool) $status,\n 'frequency' => $frequency,\n 'custom_name' => $name,\n 'activity_search_id' => $savedSearch->getId(),\n 'ask_anything_prompt_id' => $prompt->getId(),\n 'expires_at' => $expiresAtDate->toDateString(),\n 'media_types' => [self::MEDIA_TYPE_PDF],\n 'call_types' => [],\n 'recipients' => ['users' => $recipientUserIds],\n 'groups' => $sharedGroupIds,\n ];\n }\n\n public static function getAskJiminnyFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::ASK_JIMINNY_FREQUENCIES);\n }\n\n public function getAskJiminnyReportFilters(User $user): array\n {\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n return [\n [\n 'id' => 'prompt',\n 'label' => 'Prompt',\n 'options' => $prompts,\n ],\n [\n 'id' => 'saved_search',\n 'label' => 'Saved Search',\n 'options' => $savedSearches,\n ],\n ];\n }\n\n public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array\n {\n $team = $user->getTeam();\n $userTimezone = $user->getTimezone();\n\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n $teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ])->values()->all();\n\n $shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];\n\n $sharedTeamsValue = [];\n $sharedUsersValue = [];\n if ($report) {\n $sharedTeamsValue = $this->transformGroups($team, $report->getGroups());\n\n $recipientUserIds = $report->getRecipients()['users'] ?? [];\n $creatorId = $report->getAttribute('created_by');\n $sharedUserIds = array_values(array_filter(\n $recipientUserIds,\n static fn ($id) => $id !== $creatorId\n ));\n $sharedUsersValue = collect($sharedUserIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (User $u) => [\n 'id' => $u->getUuid(),\n 'name' => $u->getName(),\n ])\n ->values()\n ->all();\n }\n\n return [\n 'fields' => [\n [\n 'id' => 'enabled',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'label' => '',\n 'value' => $report?->getStatus() ?? false,\n ],\n [\n 'id' => 'report_name',\n 'inputType' => InputTypeEnum::TEXT,\n 'label' => 'Name',\n 'placeholder' => 'Enter name',\n 'required' => true,\n 'validation' => ['maxLength' => 50],\n 'value' => $report?->getCustomName() ?? '',\n ],\n [\n 'id' => 'frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Frequency',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::ASK_JIMINNY_FREQUENCIES,\n 'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,\n ],\n [\n 'id' => 'expires_on',\n 'inputType' => InputTypeEnum::DATE,\n 'label' => 'Expires on',\n 'required' => true,\n 'placeholder' => 'Select',\n 'validation' => [\n 'minDate' => now($userTimezone)->toDateString(),\n 'maxDate' => now($userTimezone)->addYear()->toDateString(),\n ],\n 'value' => $report?->getExpiresAt()?->toDateString(),\n ],\n [\n 'id' => 'share_teams',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team',\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $teamGroups,\n 'value' => $sharedTeamsValue,\n ],\n [\n 'id' => 'share_users',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team member',\n 'required' => false,\n 'placeholder' => 'Select',\n 'groupLabelKey' => 'label',\n 'groupValuesKey' => 'users',\n 'optionLabelKey' => 'name',\n 'optionValueKey' => 'id',\n 'options' => $shareUsers,\n 'value' => $sharedUsersValue,\n ],\n [\n 'id' => 'saved_search',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Saved search',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $savedSearches,\n 'value' => $report && $report->getSavedSearch() ? [\n 'id' => $report->getSavedSearch()->getUuid(),\n 'name' => $report->getSavedSearch()->getName(),\n ] : null,\n ],\n [\n 'id' => 'ask_jiminny_prompt',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Ask Jiminny prompt',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $prompts,\n 'value' => $report && $report->getAskAnythingPrompt() ? [\n 'id' => $report->getAskAnythingPrompt()->getUuid(),\n 'name' => $report->getAskAnythingPrompt()->getTitle(),\n ] : null,\n ],\n ],\n ];\n }\n\n private function updateResultNames(AutomatedReport $automatedReport): void\n {\n $results = $this->automatedReportsRepository->getResultsByReport($automatedReport);\n\n foreach ($results as $result) {\n $result->update(['name' => $this->getReportFileName($result)]);\n }\n }\n\n public function updateStatus(string $uuid, array $data): array\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $automatedReport->update([\n 'status' => $status,\n ]);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n private function generateOneOffReport(AutomatedReport $automatedReport): void\n {\n // the scheduler handles all the other frequency types\n if ($automatedReport->getStatus() === false || $automatedReport->getFrequency() !== self::FREQUENCY_ONE_OFF) {\n return;\n }\n\n $this->dispatcher->dispatch(new RequestGenerateReportJob($automatedReport->getUuid()));\n }\n\n public function getReport(string $uuid): AutomatedReport\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n return $automatedReport;\n }\n\n public function get(string $uuid): array\n {\n $automatedReport = $this->getReport($uuid);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function list(string $sortColumn = 'created_at', string $sortDirection = 'desc'): array\n {\n $results = [];\n $collection = $this->automatedReportsRepository->getAllStandardReports($sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function listAskJiminnyReports(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): array {\n $results = [];\n $collection = $this->automatedReportsRepository->getAskJiminnyReportsByUser($user, $sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function delete(string $uuid): void\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $automatedReport->delete();\n }\n\n public function createReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n return $this->automatedReportsRepository->createResult(\n array_merge(\n [\n 'report_id' => $automatedReport->getId(),\n 'status' => AutomatedReportResult::STATUS_DEFAULT,\n ],\n $data\n )\n );\n }\n\n public function getOrCreateReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n $existing = $this->automatedReportsRepository->findLatestDefaultOrFailedResult($automatedReport);\n\n if ($existing !== null) {\n $existing->update(['status' => AutomatedReportResult::STATUS_DEFAULT]);\n\n return $existing;\n }\n\n return $this->createReportResult($automatedReport, $data);\n }\n\n public function getReportResult(string $resultUuid): AutomatedReportResult\n {\n $report = $this->automatedReportsRepository->findResultByUuid($resultUuid);\n\n if (! $report) {\n throw new ModelNotFoundException('Report Result not found');\n }\n\n return $report;\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return $this->automatedReportsRepository->findChildResult($result, $type);\n }\n\n // prophet API calls\n /**\n * @throws ApplicationException\n */\n public function getGenerateReportPayload(AutomatedReport $automatedReport, string $reportResultUuid): array\n {\n $period = $this->calculateFromAndToDate($automatedReport);\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n return [\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResultUuid,\n 'report_type' => $automatedReport->getType(),\n 'media_types' => $automatedReport->getMediaTypes(),\n 'from_date' => $fromDate->startOfDay()->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->endOfDay()->format(DateTimeInterface::RFC3339),\n 'group_ids' => $automatedReport->getGroups(),\n 'call_deal_stage' => $automatedReport->getDealAtCallStages(),\n 'current_deal_stage' => $automatedReport->getCurrentDealStages(),\n 'deal_min_value' => $automatedReport->getDealValueMin(),\n 'deal_max_value' => $automatedReport->getDealValueMax(),\n 'call_types' => $automatedReport->getCallTypes(),\n 'call_duration_min_seconds' => $automatedReport->getCallDurationMin(),\n 'call_duration_max_seconds' => $automatedReport->getCallDurationMax(),\n 'special_requirements' => $automatedReport->getAdditionalPromptInput(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->formatReportPeriodName(\n $automatedReport->getFrequency(),\n $fromDate,\n $toDate,\n ),\n 'playbook_categories' => $automatedReport->getPlaybookCategories(),\n 'custom_name' => $automatedReport->getCustomName(),\n ];\n }\n\n // $inputPayload - FE payload structure\n public function getActivitiesCountPayload(array $inputPayload): array\n {\n // Use validateAndTransformData to validate and normalize input\n $validatedData = $this->validateAndTransformData($inputPayload);\n $period = $this->calculateFromAndToDatePeriod(\n $validatedData['frequency'],\n Carbon::parse($validatedData['from']),\n Carbon::parse($validatedData['to']),\n );\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n // Create payload similar to getGenerateReportPayload\n return [\n 'team_id' => $validatedData['team_id'],\n 'group_ids' => $validatedData['groups'] ?? [],\n 'report_type' => $validatedData['type'],\n 'from_date' => $fromDate->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->format(DateTimeInterface::RFC3339),\n 'call_deal_stage' => $validatedData['deal_at_call_stages'] ?? [],\n 'current_deal_stage' => $validatedData['current_deal_stages'] ?? [],\n 'deal_min_value' => $validatedData['deal_value_min'] ?? null,\n 'deal_max_value' => $validatedData['deal_value_max'] ?? null,\n 'call_types' => $validatedData['call_types'],\n 'call_duration_min_seconds' => $validatedData['call_duration_min'] ?? null,\n 'call_duration_max_seconds' => $validatedData['call_duration_max'] ?? null,\n 'special_requirements' => $validatedData['additional_prompt_input'] ?? null,\n 'playbook_categories' => $validatedData['playbook_categories'] ?? [],\n 'request_id' => null,\n 'callback_url' => null,\n ];\n }\n\n public function shouldSendReport(array $users, ?CarbonInterface $generatedAt = null): bool\n {\n if (empty($users)) {\n return false;\n }\n\n $earliestTz = collect($users)\n ->mapWithKeys(function (array $user) {\n $tz = new DateTimeZone($user['timezone']);\n $nowUtc = new DateTime('now', new DateTimeZone('UTC'));\n $offset = $tz->getOffset($nowUtc);\n\n return [$user['timezone'] => $offset];\n })\n ->sortDesc()\n ->keys()\n ->first();\n\n $now = Carbon::now($earliestTz);\n $isScheduledTime = (int) $now->format('H') === self::SENT_REPORT_AT_HOURS;\n\n if ($isScheduledTime) {\n return true;\n }\n\n return $this->hasPassedScheduledTime($generatedAt, $earliestTz);\n }\n\n public function hasPassedScheduledTime(?CarbonInterface $generatedAt, string $timezone): bool\n {\n if ($generatedAt === null) {\n return false;\n }\n\n $now = Carbon::now($timezone);\n $scheduledTime = $now->copy()->setTime(self::SENT_REPORT_AT_HOURS, 0, 0);\n\n if ($now->hour < self::SENT_REPORT_AT_HOURS) {\n $scheduledTime = $scheduledTime->subDay();\n }\n\n $scheduledTimeUtc = $scheduledTime->copy()->utc();\n $generatedAtUtc = $generatedAt->copy()->utc();\n $nowUtc = $now->copy()->utc();\n\n return $generatedAtUtc->lt($scheduledTimeUtc) && $nowUtc->gt($scheduledTimeUtc);\n }\n\n public function calculateFromAndToDatePeriod(\n string $frequency,\n ?Carbon $fromDate = null,\n ?Carbon $toDate = null\n ): array {\n if ($frequency === self::FREQUENCY_ONE_OFF) {\n return [\n 'fromDate' => $fromDate,\n 'toDate' => $toDate,\n ];\n }\n\n $now = Carbon::now();\n\n return match ($frequency) {\n self::FREQUENCY_DAILY => [\n 'fromDate' => $now->copy()->subDay()->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_WEEKLY => [\n 'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_MONTHLY => [\n 'fromDate' => $now->copy()->subMonths(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_QUARTERLY => [\n 'fromDate' => $now->copy()->subMonths(3)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n default => throw new InvalidArgumentException(\"Unsupported frequency: {$frequency}\"),\n };\n }\n\n private function calculateFromAndToDate(AutomatedReport $automatedReport): array\n {\n return $this->calculateFromAndToDatePeriod(\n $automatedReport->getFrequency(),\n $automatedReport->getFrom(),\n $automatedReport->getTo()\n );\n }\n\n public function getAskJiminnyGenerateReportPayload(\n AutomatedReport $automatedReport,\n AutomatedReportResult $reportResult,\n array $activityIds,\n ): array {\n return [\n 'user_question' => $automatedReport->getAskAnythingPrompt()?->getContent(),\n 'call_ids' => array_map('strval', $activityIds),\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResult->getUuid(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->getReportPeriodName($reportResult),\n 'report_name' => $automatedReport->getCustomName(),\n ];\n }\n\n private function getCallbackUrl(): string\n {\n return $this->webhookService->route('jiminny.webhook.reports.ready');\n }\n\n /**\n * Validate and transform payload data for automated reports\n *\n * @param array $data\n *\n * @throws InvalidArgumentException\n *\n * @return array\n */\n private function validateAndTransformData(array $data): array\n {\n // Validate organization (team) and check feature\n $team = $this->validateOrganization($data['organization'] ?? null);\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $type = $this->validateReportType($data['report_type'] ?? null);\n $frequency = $this->validateFrequency($data['frequency'] ?? null);\n $additionalPromptInput = $this->validateAdditionalPromptInput(\n $data['additional_prompt_input'] ?? null\n );\n $customReportName = $this->validateCustomReportName($data['custom_name'] ?? null);\n\n // Prepare data for the database\n $reportData = [\n 'team_id' => $team->getId(),\n 'type' => $type,\n 'status' => $status,\n 'frequency' => $frequency,\n 'additional_prompt_input' => $additionalPromptInput,\n 'custom_name' => $customReportName,\n ];\n\n // Validate deal values\n $reportData = $this->validateDealValues($data, $reportData);\n\n // Validate date range\n $reportData = $this->validateDateRange($data, $reportData, $frequency);\n\n // Validate call durations\n $reportData = $this->validateCallDurations($data, $reportData);\n\n // Validate call types\n $reportData = $this->validateCallTypes($data, $reportData);\n\n // Validate media types\n $reportData = $this->validateMediaTypes($data, $reportData);\n\n // Validate groups\n if (isset($data['teams'])) {\n $reportData['groups'] = $this->validateAndGetGroupIds($team, $data['teams']);\n }\n\n // Validate deal stages\n $reportData = $this->validateDealStages($data, $reportData, $team, $type);\n\n // Validate playbook categories\n $reportData = $this->validatePlaybookCategories($data, $reportData, $team);\n\n // Validate recipients\n $reportData['recipients'] = [\n 'users' => $this->validateAndGetUserIdsByTeam($team, $data['recipients'] ?? []),\n ];\n\n if (isset($data['jiminny_recipients'])) {\n // Validate Jiminny recipients\n $reportData['jiminny_recipients'] = [\n 'users' => $this->validateAndGetJiminnyUserIds((array) $data['jiminny_recipients']),\n ];\n }\n\n return $reportData;\n }\n\n private function validateDealValues(array $data, array $reportData): array\n {\n if (isset($data['min_deal_value'])) {\n $reportData['deal_value_min'] = (int) $data['min_deal_value'];\n\n if ($reportData['deal_value_min'] > 4294967295 || $reportData['deal_value_min'] < 0) {\n throw new InvalidArgumentException('Min deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_deal_value'])) {\n $reportData['deal_value_max'] = (int) $data['max_deal_value'];\n\n if ($reportData['deal_value_max'] > 4294967295 || $reportData['deal_value_max'] < 0) {\n throw new InvalidArgumentException('Max deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['min_deal_value'], $data['max_deal_value'])\n && $data['min_deal_value'] > $data['max_deal_value']\n ) {\n throw new InvalidArgumentException('Min deal value cannot be greater than max deal value');\n }\n\n return $reportData;\n }\n\n private function validateDateRange(array $data, array $reportData, string $frequency): array\n {\n // Set date range only for one_off frequency\n if ($frequency === 'one_off') {\n if (isset($data['start_date_period'])) {\n $reportData['from'] = $this->parseDate($data['start_date_period']);\n }\n\n if (isset($data['end_date_period'])) {\n $reportData['to'] = $this->parseDate($data['end_date_period']);\n }\n\n if (empty($reportData['from']) || empty($reportData['to'])) {\n throw new InvalidArgumentException(\n 'Start date and end date are required for one_off frequency'\n );\n }\n } else {\n $reportData['from'] = null;\n $reportData['to'] = null;\n }\n\n return $reportData;\n }\n\n private function validateCallDurations(array $data, array $reportData): array\n {\n // Convert call durations from minutes to seconds\n if (isset($data['min_call_duration'])) {\n $reportData['call_duration_min'] = (int) $data['min_call_duration'] * 60;\n\n if ($reportData['call_duration_min'] > 4294967295 || $reportData['call_duration_min'] < 0) {\n throw new InvalidArgumentException('Min call duration should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_call_duration'])) {\n $reportData['call_duration_max'] = (int) $data['max_call_duration'] * 60;\n\n if ($reportData['call_duration_max'] > 4294967295 || $reportData['call_duration_max'] < 0) {\n throw new InvalidArgumentException('Max call duration should be between 0 and 4294967295');\n }\n }\n\n return $reportData;\n }\n\n private function validateCallTypes(array $data, array $reportData): array\n {\n // Set call types\n $reportData['call_types'] = $data['call_type'] ?? [];\n if (empty($reportData['call_types'])) {\n $reportData['call_types'] = self::getCallTypes();\n }\n\n foreach ($reportData['call_types'] as $callType) {\n if (! in_array($callType, self::getCallTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Call type %s is invalid', $callType));\n }\n }\n\n return $reportData;\n }\n\n private function validateMediaTypes(array $data, array $reportData): array\n {\n // Set media types from input data\n $reportData['media_types'] = $data['media_types'] ?? [];\n\n if (empty($reportData['media_types'])) {\n throw new InvalidArgumentException('Media types are required');\n }\n\n foreach ($reportData['media_types'] as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n throw new InvalidArgumentException(sprintf('Media type %s is invalid', $mediaType));\n }\n }\n\n return $reportData;\n }\n\n private function validateDealStages(array $data, array $reportData, Team $team, string $reportType): array\n {\n // Validate and set deal stages\n if (isset($data['deal_stage_at_call'])) {\n $reportData['deal_at_call_stages'] =\n $this->validateAndGetDealStageIds($team, $data['deal_stage_at_call'], 'Deal stage at call');\n }\n\n if (isset($data['current_deal_stage'])) {\n $reportData['current_deal_stages'] =\n $this->validateAndGetDealStageIds($team, $data['current_deal_stage'], 'Current deal stage');\n }\n\n // Ensure current_deal_stage is not provided for loss_analysis report type\n if ($reportType === self::TYPE_LOSS_ANALYSIS && ! empty($data['current_deal_stage'])) {\n throw new InvalidArgumentException('Current deal stage is not applicable for Loss Analysis reports');\n }\n\n return $reportData;\n }\n\n // transform uuid to id\n private function validatePlaybookCategories(array $data, array $reportData, Team $team): array\n {\n $key = 'playbook_categories';\n\n if (isset($data[$key])) {\n $payloadIds = $data[$key];\n $ids = [];\n\n foreach ($payloadIds as $uuid) {\n $uuid = (string) $uuid;\n\n try {\n $playbookCategory = $this->playbookCategoryRepository->findByUuid($uuid);\n } catch (Throwable $throwable) {\n Log::error(__METHOD__ . ' ' . $throwable->getMessage());\n\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory) {\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory->hasPlaybook()) {\n throw new InvalidArgumentException(sprintf('Playbook category %s has no playbook', $uuid));\n }\n\n if ($playbookCategory->getPlaybook()->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Playbook category %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $ids[] = $playbookCategory->getId();\n }\n\n $reportData[$key] = $ids;\n }\n\n return $reportData;\n }\n\n private function validateReportStatus($status): bool\n {\n if (! in_array($status, [true, false], true)) {\n throw new InvalidArgumentException('Report status is invalid');\n }\n\n return $status;\n }\n\n private function validateReportType($type): string\n {\n if (! in_array($type, self::getTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Report type is invalid: %s', $type));\n }\n\n return $type;\n }\n\n private function validateFrequency($frequency): string\n {\n if (! in_array($frequency, self::getFrequencies(), true)) {\n throw new InvalidArgumentException('Frequency is invalid');\n }\n\n return $frequency;\n }\n\n private function validateAdditionalPromptInput(?string $additionalPromptInput): ?string\n {\n if ($additionalPromptInput && strlen($additionalPromptInput) > 5000) {\n throw new InvalidArgumentException('Additional Prompt Input should be less than 5000 characters');\n }\n\n return $additionalPromptInput;\n }\n\n private function validateCustomReportName(?string $customReportName): ?string\n {\n if ($customReportName === null || $customReportName === '') {\n return null;\n }\n\n if (strlen($customReportName) > 70) {\n throw new InvalidArgumentException('Custom report name should be less than 70 characters');\n }\n\n return $customReportName;\n }\n\n private function validateOrganization(?string $organizationUuid): Team\n {\n if (! $organizationUuid) {\n throw new InvalidArgumentException('Organization is required');\n }\n\n $team = $this->teamRepository->idOrUuid($organizationUuid);\n\n if (! $team) {\n throw new InvalidArgumentException('Organization not found');\n }\n\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n throw new InvalidArgumentException('Organization does not have the Automated Reports feature');\n }\n\n return $team;\n }\n\n private function validateAndGetGroupIds(Team $team, array $teamUuids): array\n {\n $groupIds = [];\n\n foreach ($teamUuids as $uuid) {\n $group = $this->groupRepository->findByUuid($uuid);\n\n if ($group === null || $group->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Group %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $groupIds[] = $group->getId();\n\n }\n\n return $groupIds;\n }\n\n private function validateAndGetDealStageIds(Team $team, array $stageUuids, string $propertyLabel): array\n {\n $stageIds = [];\n\n foreach ($stageUuids as $uuid) {\n $stage = $this->stageRepository->findByUuid($uuid);\n\n if ($stage === null || $stage->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Stage %s not found for team %s for %s', $uuid, $team->getUuid(), $propertyLabel)\n );\n }\n\n $stageIds[] = $stage->getId();\n }\n\n return $stageIds;\n }\n\n private function validateAndGetUserIds(array $userUuids, callable $teamCheck): array\n {\n if (empty($userUuids)) {\n return [];\n }\n\n $userIds = [];\n\n foreach ($userUuids as $uuid) {\n $user = $this->userRepository->findByUuid($uuid);\n\n if (! $user || ! $user->isStatusActive()) {\n throw new InvalidArgumentException(\n sprintf('User %s not found or is not active', $uuid)\n );\n }\n\n if (! $teamCheck($user)) {\n throw new InvalidArgumentException(\n sprintf('User %s does not belong to the allowed team(s)', $uuid)\n );\n }\n\n $userIds[] = $user->getId();\n }\n\n return $userIds;\n }\n\n private function validateAndGetUserIdsByTeam(Team $team, array $userUuids): array\n {\n return $this->validateAndGetUserIds($userUuids, fn ($user) => $user->getTeamId() === $team->getId());\n }\n\n private function validateAndGetJiminnyUserIds(array $userUuids): array\n {\n $allowedTeamIds = config('kiosk.teamIds', []);\n\n return $this->validateAndGetUserIds($userUuids, fn ($user) => in_array($user->getTeamId(), $allowedTeamIds, true));\n }\n\n private function parseDate(string $dateString): string\n {\n return date('Y-m-d H:i:s', strtotime($dateString));\n }\n\n private function generateReportResultViewUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.view', ['uuid' => $result->getUuid()]);\n }\n\n private function generateReportResultDownloadUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.download', ['uuid' => $result->getUuid()]);\n }\n\n private function getReportMediaRouteResource(AutomatedReportResult $result): string\n {\n if ($result->getMediaType() === self::MEDIA_TYPE_PDF) {\n return self::PDF_KEY;\n } elseif ($result->getMediaType() === self::MEDIA_TYPE_PODCAST) {\n return self::AUDIO_KEY;\n }\n\n throw new \\InvalidArgumentException('Unknown media type.');\n }\n\n public function getMediaPath(AutomatedReportResult $result): ?string\n {\n $url = match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => $result->getPdfUrl(),\n self::MEDIA_TYPE_PODCAST => $result->getPodcastAudioUrl(),\n default => null,\n };\n\n if ($url === null) {\n return null;\n }\n\n $path = parse_url(trim($url, '\"\\''), PHP_URL_PATH);\n\n return $path ?: null;\n }\n\n public function getFilenameSuffix(AutomatedReportResult $result): ?string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => 'Podcast',\n default => null,\n };\n }\n\n public function getMailSubjectSuffix(AutomatedReportResult $result): string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => 'report',\n self::MEDIA_TYPE_PODCAST => 'podcast',\n default => '',\n };\n }\n\n public function getMediaTypeMetadata(AutomatedReportResult $result): array\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => ['extension' => 'mp3', 'mime' => 'audio/mpeg'],\n self::MEDIA_TYPE_PDF => ['extension' => 'pdf', 'mime' => 'application/pdf'],\n default => ['extension' => null, 'mime' => null],\n };\n }\n\n public function deleteS3Files(AutomatedReportResult $result): void\n {\n $teamUuid = $result->getReport()->getTeam()->getUuid();\n $reportUuid = $result->getUuid();\n\n // delete all files for a report uuid no mather of pdf, podcast, or both\n // in case of both - the podcast files are linked to the pdf (parent) uuid\n // pdf and podcast date times should be close\n $path = sprintf('%s/%s/%s', $teamUuid, self::S3_DIR, $reportUuid);\n\n foreach (self::FILE_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted S3 file', [\n 'path' => $file,\n ]);\n }\n }\n\n foreach (self::FILE_PODCAST_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '_podcast.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted Podcast S3 file', [\n 'path' => $file,\n ]);\n }\n }\n }\n\n /**\n *\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): Collection\n {\n return $this->automatedReportsRepository->getTeamIdsWithReportsResults($teamId);\n }\n\n /**\n * Core delete logic for report results using a query\n *\n * @param Builder $query\n * @param array $logContext\n *\n * @return int\n */\n private function deleteReportResultsByQuery(Builder $query, array $logContext = []): int\n {\n $deletedCount = 0;\n\n if ($query->exists()) {\n Log::info(\n 'Run delete report results',\n array_merge(\n $logContext,\n [\n 'service' => 'AutomatedReportsService',\n ]\n )\n );\n\n $query->chunkById(50, function ($results) use (&$deletedCount, $logContext) {\n foreach ($results as $result) {\n $this->deleteReportResult($result);\n $deletedCount++;\n\n Log::info(\n 'Deleted a report result',\n array_merge(\n $logContext,\n [\n 'result_id' => $result->getId(),\n 'report_id' => $result->getReportId(),\n ]\n )\n );\n }\n });\n }\n\n return $deletedCount;\n }\n\n /**\n * Delete report results for a team by retention period\n *\n * @param Team $team\n * @param CarbonImmutable $retentionDate\n *\n * @return int Number of deleted report results\n */\n public function deleteReportsResultsInRetentionPeriod(Team $team, CarbonImmutable $retentionDate): int\n {\n $reportIds = $this->automatedReportsRepository->getReportIdsByTeam($team);\n\n if ($reportIds->isEmpty()) {\n return 0;\n }\n\n $query = $this->automatedReportsRepository\n ->getReportResultsQueryForRetention($team, $retentionDate);\n\n return $this->deleteReportResultsByQuery($query, [\n 'team_id' => $team->getId(),\n 'retention_date' => $retentionDate->toDateTimeString(),\n ]);\n }\n\n /**\n * Delete ALL report results for a specific automated report\n *\n * @param string $uuid\n *\n * @return int\n */\n public function deleteReportResults(string $uuid): int\n {\n $report = $this->getReport($uuid);\n\n $query = $this->automatedReportsRepository->getResultsByReportQuery($report);\n\n return $this->deleteReportResultsByQuery($query, [\n 'report_uuid' => $uuid,\n 'report_id' => $report->getId(),\n ]);\n }\n\n public function deleteReportResult(AutomatedReportResult $result): void\n {\n $this->deleteS3Files($result);\n\n $result->delete();\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getTeamReports(Team $team): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getReportsByTeam($team);\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getReportResults(AutomatedReport $report): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getResultsByReport($report);\n }\n\n public function deleteAllReportResults(AutomatedReport $report): void\n {\n $results = $this->getReportResults($report);\n\n /** @var AutomatedReportResult $result */\n foreach ($results as $result) {\n Log::info('Deleting result', [\n 'report' => $report->getId(),\n 'result' => $result->getId(),\n ]);\n\n $this->deleteReportResult($result);\n }\n }\n\n public function deleteAllData(Team $team): void\n {\n Log::info('Deleting automated report and results for team', [\n 'team' => $team->getId(),\n ]);\n\n $reports = $this->getTeamReports($team);\n\n /** @var AutomatedReport $report */\n foreach ($reports as $report) {\n Log::info('Deleting report', [\n 'team' => $team->getId(),\n 'report' => $report->getId(),\n ]);\n\n $this->deleteAllReportResults($report);\n\n $report->delete();\n }\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"bounds":{"left":0.50166225,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"bounds":{"left":0.5103058,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"bounds":{"left":0.5212766,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"bounds":{"left":0.5299202,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"bounds":{"left":0.53856385,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"bounds":{"left":0.54953456,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"bounds":{"left":0.56050533,"top":0.14844373,"width":0.024268618,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"bounds":{"left":0.58710104,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"bounds":{"left":0.5980718,"top":0.14844373,"width":0.029587766,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"bounds":{"left":0.6599069,"top":0.14844373,"width":0.02825798,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"18","depth":4,"bounds":{"left":0.63231385,"top":0.17318435,"width":0.009640957,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"14","depth":4,"bounds":{"left":0.64394945,"top":0.17318435,"width":0.009640957,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"2","depth":4,"bounds":{"left":0.6555851,"top":0.17318435,"width":0.007978723,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"4","depth":4,"bounds":{"left":0.6655585,"top":0.17318435,"width":0.007978723,"height":0.015163607},"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.67519945,"top":0.17158818,"width":0.00731383,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.6825133,"top":0.17158818,"width":0.006981383,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o\nJOIN activities a ON o.id = a.opportunity_id\nWHERE a.crm_configuration_id = 39\nAND a.actual_start_time > '2025-10-13'\nAND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM activities\nWHERE crm_configuration_id = 39 and user_id = 143\nand actual_start_time >= '2025-10-13'\nAND type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM opportunities WHERE account_id IN (178);\nselect * from activities where id IN (620137, 620187, 620188, 620189, 620230);\n\n# HS\nSELECT * FROM opportunities WHERE id IN (238);\nselect * from activities where id IN (477,2076);\n\nselect * from users;\n\nSELECT COUNT(*) FROM users;\nSELECT COUNT(*) FROM activities;\nSELECT COUNT(*) FROM opportunities;\n\nUPDATE activities\nSET\n actual_start_time = '2025-12-19 09:00:00',\n actual_end_time = '2025-12-19 10:30:00',\n scheduled_start_time = '2025-12-19 09:00:00',\n scheduled_end_time = '2025-12-19 10:30:00'\nWHERE id IN (407509,407375);\n\nselect * from partners;\n\nSELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id\nFROM activities\nWHERE user_id = 143\nAND actual_start_time >= '2025-10-13 00:00:00'\nAND actual_start_time <= '2026-01-13 23:59:59'\nORDER BY actual_start_time DESC;\n\nSELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;\nSELECT * FROM crm_layouts where crm_configuration_id = 39;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;\n# lead_id\n# account_id 177\n# contact_id 3969\n# opportunity_id\n# stage_id 203\n\nSELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;\n\nSELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'\nAND user_id = 143 and actual_start_time >= '2025-10-13';\n\nSELECT * FROM activities a\n# JOIN opportunities o ON a.opportunity_id = o.id\nWHERE a.crm_configuration_id = 39 AND a.type = 'conference'\nand status = 'completed' and recording_state = 'recorded'\nand a.actual_start_time >= '2025-10-13'\nAND a.user_id = 143\n;\n\nselect * from leads\nwhere crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707\n\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310);\nSELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198\nSELECT * FROM activities WHERE id IN (356001, 356008); # contacts:\n\nSELECT * FROM opportunities WHERE id IN (1707);\nSELECT * FROM stages where id IN (204, 198);\nSELECT * FROM opportunities WHERE account_id IN (178);\nSELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';\nSELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal\n\nSELECT * FROM activities where crm_configuration_id = 39\nAND opportunity_id IS NULL\nAND is_internal = false\nand status = 'completed' and recording_state = 'recorded'\nAND actual_start_time >= '2025-10-13'\nAND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)\n# AND lead_id IN (112, 109)\n;\n\nSELECT * FROM crm_profiles WHERE user_id = 143;\n\nselect * from inboxes; # 212\nselect * from users where id = 143; # 143\nselect * from inbox_email_batches where inbox_id = 212\nand updated_at >= '2026-01-28 00:00:00' order by id desc;\nselect * from inbox_emails where inbox_id = 212\nand batch_id = 95885 order by id desc;\nselect * from email_messages where origin_user_id = 143;\nselect * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';\nselect * from participants where activity_id = 620247;\n\nselect * from crm_profiles where user_id = 143;\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001\nselect * from transcription where activity_id = 356001; # 6943\nselect * from ai_prompts where transcription_id = 6943;\nSELECT * FROM activity_summary_logs where activity_id = 356001;\n\nSELECT * FROM social_accounts WHERE sociable_id = 143;\n\n# ************************************************************************************\nSELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;\n# 422515 softphone tr. 8100\n\nSELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;\n# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS\n\nselect * from ai_prompts where transcription_id IN (8100, 7670);\nselect * from activity_summary_logs where activity_id = 407509;\n\nselect * from sidekick_settings;\nselect * from default_activity_types;\n\nSELECT * FROM contacts WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\nSELECT * FROM leads WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\n\nSELECT * FROM activity_searches where user_id = 143;\nSELECT * FROM groups where team_id = 1;\n\nselect * from teams where id = 1;\nselect * from groups where team_id = 1; # 1150 - 7e75f8025c22\nselect id, name, group_id, status, deleted_at, email\nfrom users where team_id = 1 order by group_id desc ;\n\nselect * from activity_searches where id in (1977, 1978, 1979);\nselect * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);\nselect * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277\nselect * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879\n\nINSERT INTO `activity_search_filters`\n(`activity_search_id`, `filter`, `value`) VALUES\n(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')\n;\n\nselect * from crm_configurations where id = 39;\n\n\nselect sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id\nwhere u.team_id = 1;\nSELECT * FROM social_accounts WHERE sociable_id = 1635;\nSELECT * FROM users WHERE id = 1635;\n\nselect * from teams where id = 1;\nselect * from users where team_id = 1;\nselect * from team_features where team_id = 1;\nselect * from features;\n\nSELECT * FROM activity_searches where id = 1982; # 1981\nSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;\n\nSELECT * FROM automated_reports where id = 68;\nUPDATE automated_reports set playbook_categories = NULL where id = 68;\nSELECT * FROM automated_report_results where id = 275;\n\nSELECT * FROM automated_reports order by id desc;\nSELECT * FROM automated_report_results order by id desc;\nselect * from activity_searches where user_id = 143;\nselect * from ask_anything_prompts;\n\nSELECT * FROM groups WHERE id = 1439;\nSELECT * FROM users WHERE group_id = 1439;\n\nselect * from permissions; # 158\nselect * from roles;\nselect * from permission_role\n\nselect * from teams where id = 1;\nselect * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;\nselect * from groups where id = 28;\nselect * from playbooks where team_id = 1;\nselect * from playbooks where id = 179;\nselect * from playbook_categories where id = 1391;\nselect * from users where id = 143;\nselect * from crm_profiles where user_id = 143;\nselect * from activities where crm_configuration_id = 39 and type = 'conference'\nand crm_provider_id IS NOT NULL ORDER by id desc;\nselect * from activities where id = 422003; # 00UO400000pB6fpMAC\n\nSELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type\nFROM automated_report_results ar\nJOIN automated_reports a ON a.id = ar.report_id\nWHERE a.type = 'ask_jiminny'\nLIMIT 10;\n\nSELECT `automated_report_results`.* FROM `automated_report_results`\nINNER JOIN `automated_reports`\n ON `automated_report_results`.`report_id` = `automated_reports`.`id`\nWHERE `automated_report_results`.`generated_at` IS NOT NULL\n AND `automated_reports`.`team_id` = 1\n AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$.\"users\"')\n;\n\n\nselect * from teams where id = 3143;\nselect * from crm_configurations where id = 500;\nselect * from users where name = 'Integration Account'; # 1695\nSELECT * FROM social_accounts WHERE sociable_id = 1695;\n\nselect * from activities where crm_configuration_id = 39\nand recording_state = 'recorded' and duration > 60\nand status = 'completed' and actual_start_time >= '2025-12-01';\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;\n\nselect * from leads;","depth":4,"value":"SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o\nJOIN activities a ON o.id = a.opportunity_id\nWHERE a.crm_configuration_id = 39\nAND a.actual_start_time > '2025-10-13'\nAND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM activities\nWHERE crm_configuration_id = 39 and user_id = 143\nand actual_start_time >= '2025-10-13'\nAND type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM opportunities WHERE account_id IN (178);\nselect * from activities where id IN (620137, 620187, 620188, 620189, 620230);\n\n# HS\nSELECT * FROM opportunities WHERE id IN (238);\nselect * from activities where id IN (477,2076);\n\nselect * from users;\n\nSELECT COUNT(*) FROM users;\nSELECT COUNT(*) FROM activities;\nSELECT COUNT(*) FROM opportunities;\n\nUPDATE activities\nSET\n actual_start_time = '2025-12-19 09:00:00',\n actual_end_time = '2025-12-19 10:30:00',\n scheduled_start_time = '2025-12-19 09:00:00',\n scheduled_end_time = '2025-12-19 10:30:00'\nWHERE id IN (407509,407375);\n\nselect * from partners;\n\nSELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id\nFROM activities\nWHERE user_id = 143\nAND actual_start_time >= '2025-10-13 00:00:00'\nAND actual_start_time <= '2026-01-13 23:59:59'\nORDER BY actual_start_time DESC;\n\nSELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;\nSELECT * FROM crm_layouts where crm_configuration_id = 39;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;\n# lead_id\n# account_id 177\n# contact_id 3969\n# opportunity_id\n# stage_id 203\n\nSELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;\n\nSELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'\nAND user_id = 143 and actual_start_time >= '2025-10-13';\n\nSELECT * FROM activities a\n# JOIN opportunities o ON a.opportunity_id = o.id\nWHERE a.crm_configuration_id = 39 AND a.type = 'conference'\nand status = 'completed' and recording_state = 'recorded'\nand a.actual_start_time >= '2025-10-13'\nAND a.user_id = 143\n;\n\nselect * from leads\nwhere crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707\n\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310);\nSELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198\nSELECT * FROM activities WHERE id IN (356001, 356008); # contacts:\n\nSELECT * FROM opportunities WHERE id IN (1707);\nSELECT * FROM stages where id IN (204, 198);\nSELECT * FROM opportunities WHERE account_id IN (178);\nSELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';\nSELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal\n\nSELECT * FROM activities where crm_configuration_id = 39\nAND opportunity_id IS NULL\nAND is_internal = false\nand status = 'completed' and recording_state = 'recorded'\nAND actual_start_time >= '2025-10-13'\nAND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)\n# AND lead_id IN (112, 109)\n;\n\nSELECT * FROM crm_profiles WHERE user_id = 143;\n\nselect * from inboxes; # 212\nselect * from users where id = 143; # 143\nselect * from inbox_email_batches where inbox_id = 212\nand updated_at >= '2026-01-28 00:00:00' order by id desc;\nselect * from inbox_emails where inbox_id = 212\nand batch_id = 95885 order by id desc;\nselect * from email_messages where origin_user_id = 143;\nselect * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';\nselect * from participants where activity_id = 620247;\n\nselect * from crm_profiles where user_id = 143;\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001\nselect * from transcription where activity_id = 356001; # 6943\nselect * from ai_prompts where transcription_id = 6943;\nSELECT * FROM activity_summary_logs where activity_id = 356001;\n\nSELECT * FROM social_accounts WHERE sociable_id = 143;\n\n# ************************************************************************************\nSELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;\n# 422515 softphone tr. 8100\n\nSELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;\n# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS\n\nselect * from ai_prompts where transcription_id IN (8100, 7670);\nselect * from activity_summary_logs where activity_id = 407509;\n\nselect * from sidekick_settings;\nselect * from default_activity_types;\n\nSELECT * FROM contacts WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\nSELECT * FROM leads WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\n\nSELECT * FROM activity_searches where user_id = 143;\nSELECT * FROM groups where team_id = 1;\n\nselect * from teams where id = 1;\nselect * from groups where team_id = 1; # 1150 - 7e75f8025c22\nselect id, name, group_id, status, deleted_at, email\nfrom users where team_id = 1 order by group_id desc ;\n\nselect * from activity_searches where id in (1977, 1978, 1979);\nselect * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);\nselect * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277\nselect * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879\n\nINSERT INTO `activity_search_filters`\n(`activity_search_id`, `filter`, `value`) VALUES\n(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')\n;\n\nselect * from crm_configurations where id = 39;\n\n\nselect sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id\nwhere u.team_id = 1;\nSELECT * FROM social_accounts WHERE sociable_id = 1635;\nSELECT * FROM users WHERE id = 1635;\n\nselect * from teams where id = 1;\nselect * from users where team_id = 1;\nselect * from team_features where team_id = 1;\nselect * from features;\n\nSELECT * FROM activity_searches where id = 1982; # 1981\nSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;\n\nSELECT * FROM automated_reports where id = 68;\nUPDATE automated_reports set playbook_categories = NULL where id = 68;\nSELECT * FROM automated_report_results where id = 275;\n\nSELECT * FROM automated_reports order by id desc;\nSELECT * FROM automated_report_results order by id desc;\nselect * from activity_searches where user_id = 143;\nselect * from ask_anything_prompts;\n\nSELECT * FROM groups WHERE id = 1439;\nSELECT * FROM users WHERE group_id = 1439;\n\nselect * from permissions; # 158\nselect * from roles;\nselect * from permission_role\n\nselect * from teams where id = 1;\nselect * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;\nselect * from groups where id = 28;\nselect * from playbooks where team_id = 1;\nselect * from playbooks where id = 179;\nselect * from playbook_categories where id = 1391;\nselect * from users where id = 143;\nselect * from crm_profiles where user_id = 143;\nselect * from activities where crm_configuration_id = 39 and type = 'conference'\nand crm_provider_id IS NOT NULL ORDER by id desc;\nselect * from activities where id = 422003; # 00UO400000pB6fpMAC\n\nSELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type\nFROM automated_report_results ar\nJOIN automated_reports a ON a.id = ar.report_id\nWHERE a.type = 'ask_jiminny'\nLIMIT 10;\n\nSELECT `automated_report_results`.* FROM `automated_report_results`\nINNER JOIN `automated_reports`\n ON `automated_report_results`.`report_id` = `automated_reports`.`id`\nWHERE `automated_report_results`.`generated_at` IS NOT NULL\n AND `automated_reports`.`team_id` = 1\n AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$.\"users\"')\n;\n\n\nselect * from teams where id = 3143;\nselect * from crm_configurations where id = 500;\nselect * from users where name = 'Integration Account'; # 1695\nSELECT * FROM social_accounts WHERE sociable_id = 1695;\n\nselect * from activities where crm_configuration_id = 39\nand recording_state = 'recorded' and duration > 60\nand status = 'completed' and actual_start_time >= '2025-12-01';\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;\n\nselect * from leads;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"bounds":{"left":0.011968086,"top":0.047885075,"width":0.024268618,"height":0.024740623},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-3163136488953525261
|
1126710648141684156
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsRepositoryTest
Run 'AutomatedReportsRepositoryTest'
Debug 'AutomatedReportsRepositoryTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
3
102
3
34
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Kiosk\AutomatedReports;
use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Carbon\Exceptions\InvalidFormatException;
use DateTime;
use DateTimeInterface;
use DateTimeZone;
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcher;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Jiminny\Component\ActivitySearch\FilterDefinition\InputTypeEnum;
use Jiminny\Component\AskAnything\AskAnythingPromptService;
use Jiminny\Component\AskAnything\Dtos\AskAnythingPromptDto;
use Jiminny\Component\UrlGenerator\Webhook;
use Jiminny\Contracts\Repositories\PlaybookCategoryRepository;
use Jiminny\Contracts\Repositories\TeamRepository;
use Jiminny\Contracts\Repositories\UserRepository;
use Jiminny\Exceptions\ApplicationException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Exceptions\ModelNotFoundException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateReportJob;
use Jiminny\Models\Activity\Search;
use Jiminny\Models\AskAnything\AskAnythingPrompt;
use Jiminny\Models\AskAnything\AskAnythingPromptTarget;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Contracts\UserContract;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AskAnythingRepository;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Repositories\GroupRepository;
use Jiminny\Repositories\SearchRepository;
use Jiminny\Repositories\StageRepository;
use Throwable;
class AutomatedReportsService
{
public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';
public const string TYPE_ASK_JIMINNY = 'ask_jiminny';
/**
* Standard report types (used by kiosk for existing automated reports).
*/
// @TODO this will add filter, however if we need to control feature by FF we need conditional logic
public const array TYPES = [
['id' => 'exec_summary', 'name' => 'Exec Summary'],
['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],
['id' => 'product_feedback', 'name' => 'Product Feedback'],
['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],
// ['id' => 'questions', 'name' => 'Questions'],
// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],
];
public const array ALL_TYPES = [
...self::TYPES,
['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],
];
public const string FREQUENCY_DAILY = 'daily';
public const string FREQUENCY_WEEKLY = 'weekly';
public const string FREQUENCY_MONTHLY = 'monthly';
public const string FREQUENCY_QUARTERLY = 'quarterly';
public const string FREQUENCY_ONE_OFF = 'one_off';
/**
* Frequencies for standard (non-Ask Jiminny) reports.
*/
public const array FREQUENCIES = [
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
/**
* Frequencies for Ask Jiminny reports.
*/
public const array ASK_JIMINNY_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
];
public const string MEDIA_TYPE_PDF = 'pdf';
public const string MEDIA_TYPE_PODCAST = 'podcast';
public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];
public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];
public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];
public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];
public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];
public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];
public const int SENT_REPORT_AT_HOURS = 5;
public const string PDF_KEY = 'pdf';
public const string AUDIO_KEY = 'audio';
private const array ALL_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
private const string S3_DIR = 'reports';
private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];
private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];
public function __construct(
private readonly TeamRepository $teamRepository,
private readonly GroupRepository $groupRepository,
private readonly UserRepository $userRepository,
private readonly StageRepository $stageRepository,
private readonly DealStagesService $dealStagesService,
private readonly RecipientsService $recipientsService,
private readonly AutomatedReportsRepository $automatedReportsRepository,
private readonly Webhook $webhookService,
private readonly BusDispatcher $dispatcher,
private readonly ActivityTypeService $activityTypeService,
private readonly PlaybookCategoryRepository $playbookCategoryRepository,
private readonly AskAnythingPromptService $askAnythingPromptService,
private readonly SearchRepository $activitySearchRepository,
private readonly AskAnythingRepository $askAnythingRepository,
) {
}
public static function getTypes(): array
{
$types = self::TYPES;
return array_map(static function ($type) {
return $type['id'];
}, $types);
}
public static function getCallTypes(): array
{
return array_map(static function ($callType) {
return $callType['id'];
}, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);
}
public static function getFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::FREQUENCIES);
}
// front-facing structure
public function getReportEnabledFieldData(bool $value = false): array
{
return [
'id' => 'report_enabled',
'label' => '',
'inputType' => InputTypeEnum::TOGGLE,
'value' => $value,
];
}
// Organizations = Teams
public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array
{
$options = $this->getTeams();
if ($shortVersion) {
return [
'id' => 'organization',
'label' => 'Organization',
'options' => $options,
];
}
return [
'id' => 'organization',
'label' => 'Organization',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $options,
'value' => $value,
'dependencies' => [
'teams',
'deal_stage_at_call',
'current_deal_stage',
'recipients',
ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,
],
'dependsOn' => [],
];
}
// Teams = Groups
public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array
{
if ($shortVersion) {
return [
'id' => 'teams',
'label' => 'Team',
'options' => $options,
];
}
return [
'id' => 'teams',
'label' => 'Team',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => false,
'placeholder' => 'Select',
'options' => $options,
'value' => $value, // value should be an array of objects {id, name}
'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],
'dependsOn' => [],
];
}
public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array
{
$types = [];
if ($team instanceof Team) {
if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
$types = self::TYPES;
}
if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {
$types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];
}
} else {
$types = self::TYPES;
}
if ($shortVersion) {
return [
'id' => 'report_type',
'label' => 'Report Type',
'options' => $types,
];
}
return [
'id' => 'report_type',
'label' => 'Report Type',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $types,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getFrequencyFieldData(?string $value = null): array
{
return [
'id' => 'frequency',
'label' => 'Frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => self::FREQUENCIES,
'value' => $value,
'dependencies' => ['period'],
'dependsOn' => [],
];
}
public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array
{
return [
'id' => 'period',
'label' => 'Select one-off period',
'inputType' => InputTypeEnum::DATE_RANGE,
'required' => true,
'placeholder' => 'Select',
'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],
'queryParams' => [
'startDate' => 'start_date_period',
'endDate' => 'end_date_period',
],
'dependencies' => [],
'dependsOn' => ['frequency'],
];
}
public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array
{
return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);
}
public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);
}
public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);
}
public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'deal_value',
'label' => 'Deal Value',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_deal_value',
'max' => 'max_deal_value',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array
{
$value = [];
$conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;
$dialerOn && $value[] = self::CALL_TYPE_DIALER;
return [
'id' => 'call_type',
'label' => 'Call Type',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => [
self::CALL_TYPE_CONFERENCE,
self::CALL_TYPE_DIALER,
],
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getMediaTypeFieldData(?AutomatedReport $report = null): array
{
$value = [];
if ($report) {
$value = $this->transformMediaTypes($report);
}
return [
'id' => 'media_types',
'label' => 'Export as',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => self::MEDIA_TYPE_OBJECTS,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'call_duration',
'label' => 'Call Duration',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_call_duration',
'max' => 'max_call_duration',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getRecipientsFieldData(?Team $team = null, array $value = []): array
{
return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);
}
public function getJiminnyRecipientsFieldData(array $value = []): array
{
return $this->recipientsService->getJiminnyRecipientsFieldData($value);
}
public function getAdditionalPromptInputFieldData(?string $value = null): array
{
return [
'id' => 'additional_prompt_input',
'label' => 'Special requirements',
'inputType' => InputTypeEnum::TEXTAREA,
'required' => false,
'placeholder' => 'What should be the focus of the report?',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCustomReportNameFieldData(?string $value = null): array
{
return [
'id' => 'custom_name',
'label' => 'Custom report name',
'inputType' => InputTypeEnum::TEXT,
'required' => false,
'placeholder' => 'Enter custom name',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
// data providers
public function getTeams(): array
{
$teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);
$teamData = [];
foreach ($teams as $team) {
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
continue;
}
$teamData[] = $this->transformTeam($team);
}
return $teamData;
}
public function getTeamGroups(string $teamUuid): array
{
$data = [];
$team = $this->getTeam($teamUuid);
if ($team !== null) {
$groups = $team->groups()->get();
foreach ($groups as $group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
];
}
}
return $data;
}
public function getTeamsGroupsOptions(array $filterTeamUuids = []): array
{
$data = [];
$teams = $this->getTeams();
foreach ($teams as $team) {
if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {
continue;
}
$data[] = [
'label' => $team['name'],
'groups' => $this->getTeamGroups($team['id']),
];
}
return $data;
}
public function getTeam(string $teamUuid): ?Team
{
return $this->teamRepository->idOrUuid($teamUuid);
}
public function getTeamById(int $teamId): ?Team
{
return $this->teamRepository->find($teamId);
}
public function getGroupsUuids(AutomatedReport $report): array
{
$uuids = [];
$reportGroups = $report->getGroups();
foreach ($reportGroups as $groupId) {
if ($group = $this->groupRepository->find($groupId)) {
$uuids[] = $group->getUuid();
}
}
return $uuids;
}
public function getPlaybookCategoriesUuids(AutomatedReport $report): array
{
$uuids = [];
$playbookCategories = $report->getPlaybookCategories();
foreach ($playbookCategories as $id) {
if ($category = $this->playbookCategoryRepository->find($id)) {
$uuids[] = $category->getUuid();
}
}
return $uuids;
}
public function getDealAtCallStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getDealAtCallStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getCurrentDealStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getCurrentDealStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getRecipients());
}
public function getJiminnyUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function extractUserUuids(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => $user->getUuid())
->values()
->all();
}
// get mail data
public function getRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getRecipients());
}
/**
* @return array<UserContract>
*/
public function getRecipientUserObjects(AutomatedReport $report): array
{
$userIds = $report->getRecipients()['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->values()
->all();
}
private function getJiminnyRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function buildRecipientUsers(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => [
'email' => $user->getEmailAddress(),
'name' => $user->getName(),
'timezone' => $user->getTimezone()->getName(),
])
->values()
->all();
}
public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array
{
if ($report->isAskJiminnyReport()) {
$recipients = $this->resolveAskJiminnyRecipients($report);
} else {
$recipients = $this->getRecipientUsers($report);
if ($includeJiminny) {
$recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));
}
}
$emails = [];
return array_values(array_filter(
$recipients,
static function ($recipient) use (&$emails) {
if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {
return false;
}
$emails[] = $recipient['email'];
return true;
}
));
}
private function resolveAskJiminnyRecipients(AutomatedReport $report): array
{
$recipients = [];
$creator = $report->getCreator();
if ($creator !== null) {
$recipients[] = [
'email' => $creator->getEmailAddress(),
'name' => $creator->getName(),
'timezone' => $creator->getTimezone()->getName(),
];
}
return array_merge(
$recipients,
$this->buildRecipientUsers($report->getRecipients()),
$this->getGroupRecipientUsers($report),
);
}
private function getGroupRecipientUsers(AutomatedReport $report): array
{
$users = [];
foreach ($report->getGroups() as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group === null) {
continue;
}
foreach ($group->getMembers() as $member) {
$users[] = [
'email' => $member->getEmailAddress(),
'name' => $member->getName(),
'timezone' => $member->getTimezone()->getName(),
];
}
}
return $users;
}
public function getReportTypeName(AutomatedReportResult $report): string
{
$type = $report->getReport()->getType();
$getType = $this->transformReportType($type);
return $getType['name'];
}
public function getReportPeriodName(AutomatedReportResult $report): string
{
$from = $report->getFromDate();
$to = $report->getToDate();
$frequency = $report->getReport()->getFrequency();
if ($from === null || $to === null) {
if (! $report->getReport()->isAskJiminnyReport()) {
$invalidPeriod = $from === null ? 'from' : 'to';
throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);
}
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
}
return $this->formatReportPeriodName($frequency, $from, $to);
}
private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string
{
$fromYear = $from->format('Y');
$toYear = $to->format('Y');
$differentYears = $fromYear !== $toYear;
switch ($frequency) {
case self::FREQUENCY_DAILY:
return $from->format('j M Y');
case self::FREQUENCY_QUARTERLY:
// 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ
$startMonth = $from->format('M');
$endMonth = $to->copy()->subMonth();
$endMonthName = $endMonth->format('M');
$endMonthYear = $endMonth->format('Y');
if ($differentYears) {
return "{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}";
}
return "{$startMonth} - {$endMonthName} {$toYear}";
case self::FREQUENCY_MONTHLY:
// 'May 2025' - monthly reports are always within the same year
return $from->format('M Y');
case self::FREQUENCY_WEEKLY:
// '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ
$startDay = $from->format('j');
$endDay = $to->format('j');
$startMonth = $from->format('M');
$endMonth = $to->format('M');
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
if ($startMonth !== $endMonth) {
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
}
return "{$startDay} - {$endDay} {$endMonth} {$toYear}";
case self::FREQUENCY_ONE_OFF:
// '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ
$startDay = $from->format('j');
$startMonth = $from->format('M');
$endDay = $to->format('j');
$endMonth = $to->format('M');
// If same month and year, use a format like '2-31 May 2025'
if ($startMonth === $endMonth && ! $differentYears) {
return "{$startDay} - {$endDay} {$startMonth} {$toYear}";
}
// If different years, include both years
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
// Same year but different months
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
default:
// Default format for unknown frequencies
return $from->format('j M Y') . ' - ' . $to->format('j M Y');
}
}
public function getReportTeamsName(AutomatedReportResult $report): string
{
$groups = $report->getGroups();
if (empty($groups)) {
return 'All';
}
// Get group names from repository
$groupNames = [];
foreach ($groups as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group) {
$groupNames[] = $group->getName();
}
}
if (count($groupNames) === 1) {
// Single team format
$teamsName = $groupNames[0];
} else {
// Multiple teams format
$teamsName = implode(', ', $groupNames);
}
return $teamsName;
}
public function getReportFileName(AutomatedReportResult $report): string
{
$customName = $report->getReport()->getCustomName();
$periodName = $this->getReportPeriodName($report);
$filenameSuffix = $this->getFilenameSuffix($report);
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$customName} - {$periodName}");
}
$baseName = $this->getReportTypeName($report);
if ($filenameSuffix) {
$baseName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}");
}
public function getReportFileNameWithExtension(AutomatedReportResult $result): string
{
$extension = $this->getMediaTypeMetadata($result)['extension'];
return $this->getReportFileName($result) . '.' . $extension;
}
public function sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool
{
$recipients = array_map('intval', $report->getRecipients()['users'] ?? []);
return in_array($user->getId(), $recipients);
}
public function transformReportResults(Collection $automatedReportResults): array
{
$data = [];
foreach ($automatedReportResults as $automatedReportResult) {
/** @var AutomatedReportResult $automatedReportResult */
$report = $automatedReportResult->getReport();
$createdBy = $report->getCreator();
$creator = [
'id' => $createdBy?->getUuid(),
'name' => $createdBy?->getName(),
'email' => $createdBy?->getEmailAddress(),
'photoUrl' => $createdBy?->getPhotoUrl(),
];
$recipients = $this->buildRecipients($report);
$data[] = [
'id' => $automatedReportResult->getUuid(),
'name' => $automatedReportResult->getName(),
'frequency' => $this->transformFrequency($report->getFrequency()),
'recipients' => $recipients,
'recipients' => [
...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),
...array_values($this->transformRecipients($report->getRecipients())),
],
'report_type' => $this->transformReportType($report->getType()),
'media_type' => $automatedReportResult->getMediaType(),
'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),
'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),
'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),
'creator' => $creator,
];
}
return $data;
}
private function buildRecipients(AutomatedReport $report)
{
}
public function hasCallTypeConference(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);
}
public function hasCallTypeDialer(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);
}
// transformers
private function transformTeam(Team $team): array
{
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
return [];
}
return [
'id' => $team->getUuid(),
'name' => $team->getName(),
];
}
private function transformReportFullView(AutomatedReport $report): array
{
$base = $this->transformReportBase($report);
return $report->getType() === self::TYPE_ASK_JIMINNY
? $base + $this->transformAskJiminnyFields($report)
: $base + $this->transformStandardReportFields($report);
}
private function transformReportBase(AutomatedReport $report): array
{
return [
'id' => $report->getUuid(),
'organization' => $this->transformOrganization(team: $report->getTeam()),
'report_type' => $this->transformReportType($report->getType()),
'frequency' => $this->transformFrequency($report->getFrequency()),
];
}
private function transformStandardReportFields(AutomatedReport $report): array
{
$team = $report->getTeam();
return [
'report_enabled' => $report->getStatus(),
'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),
'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),
'deal_value_min' => $report->getDealValueMin(),
'deal_value_max' => $report->getDealValueMax(),
'call_types' => $this->transformCallType($report->getCallTypes()),
'media_types' => $this->transformMediaTypes($report),
'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),
'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),
'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),
'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),
'recipients' => $this->transformRecipients($report->getRecipients()),
'created_by' => $this->transformCreator($report->getCreator()),
'additional_prompt_input' => $report->getAdditionalPromptInput(),
'custom_name' => $report->getCustomName(),
'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),
'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),
'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),
];
}
private function transformAskJiminnyFields(AutomatedReport $report): array
{
$team = $report->getTeam();
$creatorId = $report->getAttribute('created_by');
$explicitUserIds = array_values(array_filter(
$report->getRecipients()['users'] ?? [],
static fn ($id) => $id !== $creatorId
));
return [
'report_name' => $report->getCustomName(),
'enabled' => $report->getStatus(),
'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),
'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),
'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),
'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),
];
}
private function transformOrganization(?Team $team): array
{
return [
'id' => $team?->getUuid(),
'name' => $team?->getName(),
];
}
private function transformReportType(string $type): array
{
foreach (self::ALL_TYPES as $typeItem) {
if ($typeItem['id'] === $type) {
return $typeItem;
}
}
return [];
}
private function transformCallType(array $types): array
{
$result = [];
$callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];
foreach ($types as $type) {
foreach ($callTypes as $callTypeItem) {
if ($callTypeItem['id'] === $type) {
$result[] = $callTypeItem;
break;
}
}
}
return $result;
}
private function transformMediaTypes(AutomatedReport $report): array
{
$values = [];
foreach ($report->getMediaTypes() as $mediaType) {
if (! in_array($mediaType, self::MEDIA_TYPES, true)) {
continue;
}
$values[] = match ($mediaType) {
self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,
self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,
};
}
return $values;
}
private function transformFrequency(string $frequency): array
{
foreach (self::ALL_FREQUENCIES as $frequencyItem) {
if ($frequencyItem['id'] === $frequency) {
return $frequencyItem;
}
}
return [];
}
public function transformDurationToMinutes(?int $duration): ?int
{
if (! $duration) {
return null;
}
return (int) ($duration / 60);
}
private function transformGroups(?Team $team, array $groupsIds): array
{
if (empty($groupsIds) || ! $team) {
return [];
}
$data = [];
foreach ($groupsIds as $groupId) {
$group = $team->groups()->where('id', $groupId)->first();
if ($group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
'photoUrl' => $group->getPhotoUrl(),
];
}
}
return $data;
}
private function transformStages(?Team $team, array $stagesIds): array
{
if (empty($stagesIds) || ! $team) {
return [];
}
$data = [];
foreach ($stagesIds as $stageId) {
$stage = $team->stages()->where('id', $stageId)->first();
if ($stage) {
$data[] = [
'id' => $stage->getUuid(),
'name' => $stage->getName(),
];
}
}
return $data;
}
private function transformRecipients(array $recipients): array
{
$users = [];
foreach ($recipients['users'] ?? [] as $userId) {
$users[] = $this->transformUser($userId);
}
return $users;
}
private function transformCreator(?User $user): ?array
{
if ($user === null) {
return null;
}
return $this->transformUser($user->getId());
}
private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array
{
if ($prompt === null) {
return null;
}
return [
'id' => $prompt->getUuid(),
'name' => $prompt->getTitle(),
];
}
private function transformSafeSearch(?Search $search): ?array
{
if ($search === null) {
return null;
}
return [
'id' => $search->getUuid(),
'name' => $search->getName(),
];
}
private function transformUser(int $userId): array
{
/* @var ?User $user */
$user = $this->userRepository->find($userId);
return [
'id' => $user?->getUuid(),
'name' => $user?->getName(),
'email' => $user?->getEmailAddress(),
'photoUrl' => $user?->getPhotoUrl(),
];
}
public function create(array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$validatedData['created_by'] = auth()->id();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
public function update(string $uuid, array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$report = $this->automatedReportsRepository->findByUuid($uuid);
if (! $report) {
throw new InvalidArgumentException('Report not found');
}
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
/**
* Create an Ask Jiminny report.
*/
public function createAskJiminnyReport(array $data, User $creator): array
{
$validatedData = $this->validateAskJiminnyReportData($data, $creator);
$validatedData['created_by'] = $creator->getId();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
return $this->transformReportFullView($automatedReport);
}
/**
* Update an Ask Jiminny report.
*/
public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array
{
if (! $report->isAskJiminnyReport()) {
throw new InvalidArgumentException('Report is not an Ask Jiminny report');
}
$validatedData = $this->validateAskJiminnyReportData($data, $user);
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
return $this->transformReportFullView($automatedReport);
}
public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array
{
$this->automatedReportsRepository->update($report, ['status' => $status]);
return $this->transformReportFullView($report->fresh());
}
/**
* Validate and transform data for Ask Jiminny reports.
*/
private function validateAskJiminnyReportData(array $data, User $user): array
{
// Validate name
$name = trim($data['report_name'] ?? '');
if (empty($name)) {
throw new InvalidArgumentException('Report name is required');
}
if (mb_strlen($name) > 50) {
throw new InvalidArgumentException('Report name must be 50 characters or less');
}
// Validate frequency (only daily, weekly, monthly for Ask Jiminny)
$frequency = $data['frequency'] ?? null;
$askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];
if (! in_array($frequency, $askJiminnyFrequencies, true)) {
throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');
}
// Validate expiration date
$expiresAt = $data['expires_on'] ?? null;
if (empty($expiresAt)) {
throw new InvalidArgumentException('Expiration date is required');
}
try {
$expiresAtDate = Carbon::parse($expiresAt);
} catch (InvalidFormatException $e) {
throw new InvalidArgumentException('Expiration date format is invalid');
}
$maxExpiration = Carbon::now()->addYear()->endOfDay();
if ($expiresAtDate->gt($maxExpiration)) {
throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');
}
if ($expiresAtDate->isPast()) {
throw new InvalidArgumentException('Expiration date cannot be in the past');
}
// Validate saved search
$activitySearchId = $data['saved_search'] ?? null;
if (empty($activitySearchId)) {
throw new InvalidArgumentException('Saved search is required');
}
$savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);
if (! $savedSearch) {
throw new InvalidArgumentException('Saved search not found or does not belong to you');
}
// Validate saved prompt
$askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;
if (empty($askAnythingPromptId)) {
throw new InvalidArgumentException('Ask Jiminny prompt is required');
}
$prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);
if (! $prompt) {
throw new InvalidArgumentException('Ask Jiminny prompt not found');
}
// Validate status
$status = $data['enabled'] ?? false;
$recipientUserIds = [$user->getId()];
if (! empty($data['share_users'])) {
$sharedUserIds = $this->validateAndGetUserIdsByTeam(
$user->team,
(array) $data['share_users']
);
$recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);
}
$sharedGroupIds = [];
if (! empty($data['share_teams'])) {
$sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);
}
$recipientUserIds = array_values(array_unique($recipientUserIds));
return [
'team_id' => $user->getTeamId(),
'type' => self::TYPE_ASK_JIMINNY,
'status' => (bool) $status,
'frequency' => $frequency,
'custom_name' => $name,
'activity_search_id' => $savedSearch->getId(),
'ask_anything_prompt_id' => $prompt->getId(),
'expires_at' => $expiresAtDate->toDateString(),
'media_types' => [self::MEDIA_TYPE_PDF],
'call_types' => [],
'recipients' => ['users' => $recipientUserIds],
'groups' => $sharedGroupIds,
];
}
public static function getAskJiminnyFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::ASK_JIMINNY_FREQUENCIES);
}
public function getAskJiminnyReportFilters(User $user): array
{
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
return [
[
'id' => 'prompt',
'label' => 'Prompt',
'options' => $prompts,
],
[
'id' => 'saved_search',
'label' => 'Saved Search',
'options' => $savedSearches,
],
];
}
public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array
{
$team = $user->getTeam();
$userTimezone = $user->getTimezone();
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
$teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [
'id' => $group->getUuid(),
'name' => $group->getName(),
])->values()->all();
$shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];
$sharedTeamsValue = [];
$sharedUsersValue = [];
if ($report) {
$sharedTeamsValue = $this->transformGroups($team, $report->getGroups());
$recipientUserIds = $report->getRecipients()['users'] ?? [];
$creatorId = $report->getAttribute('created_by');
$sharedUserIds = array_values(array_filter(
$recipientUserIds,
static fn ($id) => $id !== $creatorId
));
$sharedUsersValue = collect($sharedUserIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (User $u) => [
'id' => $u->getUuid(),
'name' => $u->getName(),
])
->values()
->all();
}
return [
'fields' => [
[
'id' => 'enabled',
'inputType' => InputTypeEnum::TOGGLE,
'label' => '',
'value' => $report?->getStatus() ?? false,
],
[
'id' => 'report_name',
'inputType' => InputTypeEnum::TEXT,
'label' => 'Name',
'placeholder' => 'Enter name',
'required' => true,
'validation' => ['maxLength' => 50],
'value' => $report?->getCustomName() ?? '',
],
[
'id' => 'frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'label' => 'Frequency',
'required' => true,
'placeholder' => 'Select',
'options' => self::ASK_JIMINNY_FREQUENCIES,
'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,
],
[
'id' => 'expires_on',
'inputType' => InputTypeEnum::DATE,
'label' => 'Expires on',
'required' => true,
'placeholder' => 'Select',
'validation' => [
'minDate' => now($userTimezone)->toDateString(),
'maxDate' => now($userTimezone)->addYear()->toDateString(),
],
'value' => $report?->getExpiresAt()?->toDateString(),
],
[
...
|
NULL
|
|
66651
|
NULL
|
0
|
2026-04-21T14:53:44.197828+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776783224197_m2.jpg...
|
Slack
|
Aneliya Angelova, Nikolay Yankov, Steliyan Georgie Aneliya Angelova, Nikolay Yankov, Steliyan Georgiev (DM) - Jiminny Inc - 1 new item - Slack...
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Aneliya Angelova
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Apr 17th at 5:05:23 PM
5:05
и втория тикет не успявам до го репродусна
[URL_WITH_CREDENTIALS] Yankov
@Nikolay Yankov
Ники има една промяна която Галя иска в колоната SHARED
значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като "Shared With"
Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:45:41 PM
5:45
тази промяна за теб ли е
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Nikolay Yankov
Today at 5:48:38 PM
5:48 PM
ами от BE идва инфото какво да се покаже в тази колона -
recipients
полето
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:49:13 PM
5:49
Лукаш, можеш ли да го промениш
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 5:49:18 PM
5:49 PM
oki
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:49:35 PM
5:49
ще го опиша в сторито и това
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 5:50:29 PM
5:50 PM
да може
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:51:41 PM
5:51
това е само при Ask Jiminny или всички
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 5:52:05 PM
5:52 PM
Ask Jiminny
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Nikolay Yankov
is typing
Todor Stamatov, Direct Message, 1 of 15 suggestions
Nikolay Yankov is typing...
|
[{"role":"AXPopUpButton","text [{"role":"AXPopUpButton","text":"Switch workspaces… (Jiminny Inc) Has new messages","depth":14,"bounds":{"left":0.0056515955,"top":0.058260176,"width":0.011968086,"height":0.028731046},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"Home","depth":14,"bounds":{"left":0.0029920214,"top":0.10055866,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Home","depth":16,"bounds":{"left":0.0066489363,"top":0.13806863,"width":0.009973404,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"DMs","depth":14,"bounds":{"left":0.0029920214,"top":0.15482841,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"DMs","depth":16,"bounds":{"left":0.0076462766,"top":0.19233839,"width":0.007978723,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Activity","depth":14,"bounds":{"left":0.0029920214,"top":0.20909816,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Activity","depth":16,"bounds":{"left":0.004986702,"top":0.24660814,"width":0.012965426,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":14,"bounds":{"left":0.0029920214,"top":0.26336792,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":16,"bounds":{"left":0.0076462766,"top":0.3008779,"width":0.0076462766,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Later","depth":14,"bounds":{"left":0.0029920214,"top":0.31763768,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Later","depth":16,"bounds":{"left":0.00731383,"top":0.35514766,"width":0.008643617,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"More…","depth":14,"bounds":{"left":0.0029920214,"top":0.3719074,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More","depth":16,"bounds":{"left":0.006981383,"top":0.4094174,"width":0.008976064,"height":0.0103751},"role_description":"text"},{"role":"AXStaticText","text":"Unreads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Threads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Huddles","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Drafts & sent","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Directories","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-x-integration-app","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-inner-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"ai-chapter","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"alerts","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"backend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"c-learning-people","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"confusion-clinic","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"curiosity_lab","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"engineering","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"frontend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"general","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"infra-changes","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-bg","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-copilot-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-zoom-phone-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-tickets","depth":23,"bounds":{"left":0.042220745,"top":0.096568234,"width":0.034906916,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"product_launches","depth":23,"bounds":{"left":0.042220745,"top":0.118914604,"width":0.03856383,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"random","depth":23,"bounds":{"left":0.042220745,"top":0.14126097,"width":0.01662234,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"releases","depth":23,"bounds":{"left":0.042220745,"top":0.16360734,"width":0.01761968,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"support","depth":23,"bounds":{"left":0.042220745,"top":0.1859537,"width":0.016954787,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"thank-yous","depth":23,"bounds":{"left":0.042220745,"top":0.20830008,"width":0.024268618,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"the_people_of_jiminny","depth":23,"bounds":{"left":0.042220745,"top":0.23064645,"width":0.04488032,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"bounds":{"left":0.042220745,"top":0.28332004,"width":0.03756649,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"bounds":{"left":0.07945479,"top":0.28332004,"width":0.0063164895,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"bounds":{"left":0.08211436,"top":0.28332004,"width":0.014295213,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"bounds":{"left":0.09607713,"top":0.3008779,"width":0.0003324468,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Steliyan Georgiev","depth":23,"bounds":{"left":0.09607713,"top":0.3008779,"width":0.0003324468,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"bounds":{"left":0.042220745,"top":0.3056664,"width":0.03756649,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Mario Georgiev","depth":23,"bounds":{"left":0.042220745,"top":0.32801276,"width":0.033909574,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"bounds":{"left":0.042220745,"top":0.35035914,"width":0.032912236,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Todor Stamatov","depth":23,"bounds":{"left":0.042220745,"top":0.37270552,"width":0.034242023,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Gabriela Dureva","depth":23,"bounds":{"left":0.042220745,"top":0.39505187,"width":0.03523936,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Petko Kashinski","depth":23,"bounds":{"left":0.042220745,"top":0.41739824,"width":0.034242023,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Vasil Vasilev","depth":23,"bounds":{"left":0.042220745,"top":0.43974462,"width":0.026263298,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Nikolov","depth":23,"bounds":{"left":0.042220745,"top":0.46209097,"width":0.034242023,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Galya Dimitrova","depth":23,"bounds":{"left":0.042220745,"top":0.48443735,"width":0.034906916,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Stefka Stoyanova","depth":23,"bounds":{"left":0.042220745,"top":0.5067837,"width":0.03756649,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tomov","depth":23,"bounds":{"left":0.042220745,"top":0.5291301,"width":0.030585106,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tanev","depth":23,"bounds":{"left":0.042220745,"top":0.5514765,"width":0.028922873,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Ivanov","depth":23,"bounds":{"left":0.042220745,"top":0.5738228,"width":0.031914894,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Ves","depth":23,"bounds":{"left":0.042220745,"top":0.5961692,"width":0.0076462766,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Jira Cloud","depth":23,"bounds":{"left":0.042220745,"top":0.64884275,"width":0.021609042,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Toast","depth":23,"bounds":{"left":0.042220745,"top":0.6711891,"width":0.011635638,"height":0.014365523},"role_description":"text"},{"role":"AXRadioButton","text":"Messages","depth":17,"bounds":{"left":0.10206117,"top":0.09177973,"width":0.030585106,"height":0.030327214},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Messages","depth":19,"bounds":{"left":0.111369684,"top":0.10055866,"width":0.01861702,"height":0.012769354},"role_description":"text"},{"role":"AXRadioButton","text":"Add canvas","depth":18,"bounds":{"left":0.13397606,"top":0.09177973,"width":0.033909574,"height":0.030327214},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Add canvas","depth":20,"bounds":{"left":0.14328457,"top":0.10055866,"width":0.021941489,"height":0.012769354},"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":17,"bounds":{"left":0.16921543,"top":0.09177973,"width":0.020944148,"height":0.030327214},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":19,"bounds":{"left":0.17852394,"top":0.10055866,"width":0.008976064,"height":0.012769354},"role_description":"text"},{"role":"AXPopUpButton","text":"Add and Edit Channel Tabs","depth":17,"bounds":{"left":0.19115691,"top":0.09177973,"width":0.010970744,"height":0.030327214},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Canvas","depth":17,"bounds":{"left":0.096409574,"top":0.0518755,"width":0.015625,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"List","depth":17,"bounds":{"left":0.096409574,"top":0.0518755,"width":0.0076462766,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Folder","depth":17,"bounds":{"left":0.096409574,"top":0.0518755,"width":0.013962766,"height":0.0007980846},"role_description":"text"},{"role":"AXPopUpButton","text":"Jump to date","depth":23,"bounds":{"left":0.1392952,"top":0.11572227,"width":0.046875,"height":0.022346368},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Apr 17th at 5:05:23 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:05","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"и втория тикет не успявам до го репродусна","depth":25,"role_description":"text"},{"role":"AXLink","text":"https://jiminny.atlassian.net/browse/JY-20694","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"https://jiminny.atlassian.net/browse/JY-20694","depth":26,"role_description":"text"},{"role":"AXButton","text":"Remove preview","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"JY-20694 Incorrect \"expiration date\" error is displayed when changing freque…","depth":27,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"JY-20694 Incorrect \"expiration date\" error is displayed when changing freque…","depth":28,"role_description":"text"},{"role":"AXStaticText","text":"Status:","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"Ready for Dev","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"Type:","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"Sub-bug","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"Assignee:","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"Lukas","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"Kovalik","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"Priority:","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"Medium","depth":26,"role_description":"text"},{"role":"AXButton","text":"Assign","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Assign","depth":28,"role_description":"text"},{"role":"AXButton","text":"Change status","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Change status","depth":28,"role_description":"text"},{"role":"AXButton","text":"sparkles emoji AI Summarise","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"AI Summarise","depth":28,"role_description":"text"},{"role":"AXComboBox","text":"More actions...","depth":27,"placeholder":"More actions...","role_description":"combo box","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Added by","depth":26,"role_description":"text"},{"role":"AXLink","text":"Jira Cloud","depth":26,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Jira Cloud","depth":27,"role_description":"text"},{"role":"AXButton","text":"Nikolay Yankov","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Apr 17th at 5:21:50 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:21 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"и аз виждам тиретата сега","depth":25,"role_description":"text"},{"role":"AXLink","text":"Apr 17th at 5:21:56 PM","depth":25,"bounds":{"left":0.107380316,"top":0.11572227,"width":0.007978723,"height":0.0103751},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:21","depth":26,"bounds":{"left":0.107380316,"top":0.11572227,"width":0.007978723,"height":0.0103751},"role_description":"text"},{"role":"AXStaticText","text":"не мога да го възпроизведа","depth":25,"bounds":{"left":0.11801862,"top":0.11572227,"width":0.06349734,"height":0.0103751},"role_description":"text"},{"role":"AXPopUpButton","text":"Jump to date","depth":23,"bounds":{"left":0.15026596,"top":0.14205906,"width":0.025265958,"height":0.022346368},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"bounds":{"left":0.11801862,"top":0.17318435,"width":0.038896278,"height":0.017557861},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.15658244,"top":0.17478053,"width":0.0029920214,"height":0.014365523},"role_description":"text"},{"role":"AXLink","text":"Today at 5:45:34 PM","depth":24,"bounds":{"left":0.15924202,"top":0.17717478,"width":0.015292553,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:45 PM","depth":25,"bounds":{"left":0.15924202,"top":0.17717478,"width":0.015292553,"height":0.011971269},"role_description":"text"},{"role":"AXLink","text":"@Nikolay Yankov","depth":25,"bounds":{"left":0.11801862,"top":0.1915403,"width":0.038231384,"height":0.015961692},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"@Nikolay Yankov","depth":26,"bounds":{"left":0.11868351,"top":0.19233839,"width":0.036901597,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Ники има една промяна която Галя иска в колоната SHARED","depth":25,"bounds":{"left":0.11801862,"top":0.19233839,"width":0.09507979,"height":0.031923383},"role_description":"text"},{"role":"AXStaticText","text":"значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като \"Shared With\"","depth":25,"bounds":{"left":0.11801862,"top":0.22745411,"width":0.10172872,"height":0.049481247},"role_description":"text"},{"role":"AXStaticText","text":"Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна","depth":25,"bounds":{"left":0.11801862,"top":0.2801277,"width":0.102726065,"height":0.049481247},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13696809,"top":0.16041501,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14760639,"top":0.16041501,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15824468,"top":0.16041501,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16888298,"top":0.16041501,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17952128,"top":0.16041501,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.19015957,"top":0.16041501,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.20079787,"top":0.16041501,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.21143617,"top":0.16041501,"width":0.010638298,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:45:41 PM","depth":25,"bounds":{"left":0.107380316,"top":0.3415802,"width":0.007978723,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:45","depth":26,"bounds":{"left":0.107380316,"top":0.3415802,"width":0.007978723,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"тази промяна за теб ли е","depth":25,"bounds":{"left":0.11801862,"top":0.33918595,"width":0.05718085,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.31444532,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.31444532,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.31444532,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.31444532,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.31444532,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.31444532,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.31444532,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.31444532,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Nikolay Yankov","depth":24,"bounds":{"left":0.11801862,"top":0.36153233,"width":0.034242023,"height":0.017557861},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.15226063,"top":0.36312848,"width":0.0026595744,"height":0.014365523},"role_description":"text"},{"role":"AXLink","text":"Today at 5:48:38 PM","depth":24,"bounds":{"left":0.1549202,"top":0.36552274,"width":0.014960106,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:48 PM","depth":25,"bounds":{"left":0.1549202,"top":0.36552274,"width":0.014960106,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"ами от BE идва инфото какво да се покаже в тази колона -","depth":25,"bounds":{"left":0.11801862,"top":0.38068634,"width":0.102726065,"height":0.031923383},"role_description":"text"},{"role":"AXStaticText","text":"recipients","depth":26,"bounds":{"left":0.1512633,"top":0.40063846,"width":0.023936171,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"полето","depth":25,"bounds":{"left":0.17652926,"top":0.3982442,"width":0.01761968,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.34796488,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.34796488,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.34796488,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.34796488,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.34796488,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.34796488,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.34796488,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.34796488,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:49:13 PM","depth":25,"bounds":{"left":0.107380316,"top":0.424581,"width":0.007978723,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:49","depth":26,"bounds":{"left":0.107380316,"top":0.424581,"width":0.007978723,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"Лукаш, можеш ли да го промениш","depth":25,"bounds":{"left":0.11801862,"top":0.42218676,"width":0.080119684,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.39744613,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.39744613,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.39744613,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.39744613,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.39744613,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.39744613,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.39744613,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.39744613,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"bounds":{"left":0.11801862,"top":0.4445331,"width":0.038896278,"height":0.017557861},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.15658244,"top":0.4461293,"width":0.0029920214,"height":0.014365523},"role_description":"text"},{"role":"AXLink","text":"Today at 5:49:18 PM","depth":24,"bounds":{"left":0.15924202,"top":0.44852355,"width":0.015292553,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:49 PM","depth":25,"bounds":{"left":0.15924202,"top":0.44852355,"width":0.015292553,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"oki","depth":25,"bounds":{"left":0.11801862,"top":0.46368715,"width":0.0066489363,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.4309657,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.4309657,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.4309657,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.4309657,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.4309657,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.4309657,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.4309657,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.4309657,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:49:35 PM","depth":25,"bounds":{"left":0.107380316,"top":0.49002394,"width":0.007978723,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:49","depth":26,"bounds":{"left":0.107380316,"top":0.49002394,"width":0.007978723,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"ще го опиша в сторито и това","depth":25,"bounds":{"left":0.11801862,"top":0.48762968,"width":0.068484046,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.46288908,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.46288908,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.46288908,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.46288908,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.46288908,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.46288908,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.46288908,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.46288908,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"bounds":{"left":0.11801862,"top":0.509976,"width":0.030917553,"height":0.017557861},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.14860372,"top":0.51157224,"width":0.0029920214,"height":0.014365523},"role_description":"text"},{"role":"AXLink","text":"Today at 5:50:29 PM","depth":24,"bounds":{"left":0.1512633,"top":0.5139665,"width":0.015292553,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:50 PM","depth":25,"bounds":{"left":0.1512633,"top":0.5139665,"width":0.015292553,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"да може","depth":25,"bounds":{"left":0.11801862,"top":0.5291301,"width":0.019614361,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.4964086,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.4964086,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.4964086,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.4964086,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.4964086,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.4964086,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.4964086,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.4964086,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:51:41 PM","depth":25,"bounds":{"left":0.107380316,"top":0.5554669,"width":0.007978723,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:51","depth":26,"bounds":{"left":0.107380316,"top":0.5554669,"width":0.007978723,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"това е само при Ask Jiminny или всички","depth":25,"bounds":{"left":0.11801862,"top":0.55307263,"width":0.09042553,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.528332,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.528332,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.528332,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.528332,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.528332,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.528332,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.528332,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.528332,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"bounds":{"left":0.11801862,"top":0.575419,"width":0.038896278,"height":0.017557861},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.15658244,"top":0.57701516,"width":0.0029920214,"height":0.014365523},"role_description":"text"},{"role":"AXLink","text":"Today at 5:52:05 PM","depth":24,"bounds":{"left":0.15924202,"top":0.5794094,"width":0.015292553,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:52 PM","depth":25,"bounds":{"left":0.15924202,"top":0.5794094,"width":0.015292553,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"Ask Jiminny","depth":25,"bounds":{"left":0.11801862,"top":0.594573,"width":0.025930852,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.56185156,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.56185156,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.56185156,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.56185156,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.56185156,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.56185156,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.56185156,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.56185156,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"","depth":23,"bounds":{"left":0.10372341,"top":0.6272945,"width":0.118351065,"height":0.030327214},"value":"","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Nikolay Yankov","depth":19,"bounds":{"left":0.107380316,"top":0.6943336,"width":0.023603724,"height":0.0103751},"role_description":"text"},{"role":"AXStaticText","text":"is typing","depth":19,"bounds":{"left":0.1306516,"top":0.6943336,"width":0.013962766,"height":0.0103751},"role_description":"text"},{"role":"AXStaticText","text":"Todor Stamatov, Direct Message, 1 of 15 suggestions","depth":11,"bounds":{"left":0.0,"top":0.7126895,"width":0.026263298,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov is typing","depth":11,"bounds":{"left":0.0,"top":0.7126895,"width":0.015625,"height":0.0007980846},"role_description":"text"}]...
|
6879345585135723292
|
-1284768519847247808
|
click
|
hybrid
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Aneliya Angelova
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Apr 17th at 5:05:23 PM
5:05
и втория тикет не успявам до го репродусна
[URL_WITH_CREDENTIALS] Yankov
@Nikolay Yankov
Ники има една промяна която Галя иска в колоната SHARED
значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като "Shared With"
Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:45:41 PM
5:45
тази промяна за теб ли е
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Nikolay Yankov
Today at 5:48:38 PM
5:48 PM
ами от BE идва инфото какво да се покаже в тази колона -
recipients
полето
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:49:13 PM
5:49
Лукаш, можеш ли да го промениш
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 5:49:18 PM
5:49 PM
oki
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:49:35 PM
5:49
ще го опиша в сторито и това
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 5:50:29 PM
5:50 PM
да може
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:51:41 PM
5:51
това е само при Ask Jiminny или всички
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 5:52:05 PM
5:52 PM
Ask Jiminny
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Nikolay Yankov
is typing
Todor Stamatov, Direct Message, 1 of 15 suggestions
Nikolay Yankov is typing
ActivityMoreSlackcalVIewMistonWindowhelp@ Describe what you are looking forJiminny ...* Aneliya Angelova, ...# plattorm-tickets# product launchesMessagesAdd canvaur Filesтот-M Friday, April 17th ~¿randomi# releases99# supportAneliya.# thank-yous# the people of jimi..която таля иска в колоната зпаксьЗеначи създателя на темплейта на АИ• Direct messagesґепоотс страницата вижда винаги и сеое сикато "Shared With"Галя иска ла се махне creator-a ot Shared(3) Aneliva Angelova. .f Aneliya AngelovaMario GeorgievNikolav Yankov3 Todor Stamatovfe Gabriela Dureva• Petko Kashinski• Vasil Vasilev• Nikolav Nikolov.Galya Dimitrova& Stefka StovanovaAa Stovan Tomov* Stoyan TanevNikolav Ivanov::: Aons7" Jira Cloud8 ToastWith 1 ако не е шеонал с никого, то колонаташe е празнатази промяна за тео ли еNikolay Yankov 5:48 PMами от вс идва инфото какво да се покаже втази колона - recipients полетоЛукаш, можеш ли да го променишAneliya Angelova 5:49 PMше го опиша в стопито и товаluukas Kovallk 5.50 pMna moweтова е само пoи Ask Jiminny или всичкиAneliva Angelova 5.52 PMAsk JiminnyMessage Aneliva Angelova, Nikolay Yankov. Steli..Aalaкepoпskepository.onpervice.phpOkeporcontroller.onp© AutomatedReportsCallbackService.phpresultscouLectionsautomatedRenortresults): arrav.dReportResult->qetNameos->transformFrequency(sreport->getFrequencyO).1s->ou1ldReciolents(srevort).chis->transformReportlype (Sreport->getiype)).itomatedRenortResult->getMediatvoeochis->generateReportResultDownloadUrl(SautomatedReportResult),>nenerateRenortResultViewUrlSautomatedRenortResult).SautomatedReportResult->getGeneratedAt()?->toIso8601String(),ts(AutomatedReport $report): array[Sthis->transformRecipients(Sreport->qetRecipients0)):Pure]ction array_values(Sarravarrayketurn all the values of an array©) Acuivily lypeservice.ong© AskJiminnyReportActivityS© AutomatedReportsCallback.array values(stParameters: array Sarray - The array.c) Aulomaredkepor sservice.Returnsarray an indexed array ofwetitec) DealStagesService.ohv© RecipientsService.php() ReportSort.ohphttos:ohp.net/manual/en/function.array-values.phpE) ReportSortDirection.ohonuhiaie Function hascali tvn<stubs> /standard/standard_g.C) KioskService.ohoM MailMeetinaGeneratorRucadespublic function hasCallTyp'array values' on php.netM NotificationM ©Auth2M RecallA/I transformers1usage1 Securityprivate function transformTeam(Team Steam): array{...}C) Service.php© Field.php= custom.log4 SF jiminny@localhost]) XAutomatedReportsSendcommand.ongA HS_local [iminny@localhost)# concole [pponlA console (EU]© TrackProviderInstalledEvent.phpreport-not-generated.blade.phg© SendReportMailJob.phpC) sendreportNotGenerateamallJob.phpO | A102 X3 X34 A V O 159.arouoslds:revort->aettrouosoo.161— 162163164166172176—178180181182=184іl 186187188189190)-191192193194195)=196201204A console [STAGING]e jiminnyseleel * rrun aculvity searches where aSELECT * FROM activity_ search_filters WHERESELECT * FROM automated_ reports where id = 68UPUAIEautomated reports set playbook categories = NULL where icSELECT * FROM automated_ report_ results where id = 275:SELECT * FROM automated_reports order by id desc;SELEcT * FROM automatedreport_results order by 1d desc:select * from activity_searches where user_id = 143;select * from askSELEC * FROM GrOUOS WHERE 10 = 14591SELEC * EROM users WHERE aroun 1d = 1439:select * From permissions: # 158select * from roles:select * from permission roleselect * from teams where id = 1;select * from groups g JOIN playbooks p 1..n<->1: on g.playbook_idselect * from groups where id = 28;select * from playbooks where team_id = 1;select * from playbooks where id = 179;select * from playbook_categories where id = 1391;select * from users where id = 143:select * from crm_profiles where user_id = 143;select * from activities where crm_confiquration id = 39 and typeand crm_provider id IS NOT NULL ORDER by id desc:select * from activities where id = 422003: # 00U0400000pB6fpMAC|SELECT ar.id. ar.uuid. ar.media_type. ar.status, a.typeFROM automated_report_results arJOIN automatedreports a ON a.1d = ar.report1dWHERE a.type ='ask_jiminnyLIME 10:SELECTautomated revort results * FROM 'automated remort res.automated report results', reoort id' = 'automated remort.automated renont resulte' 'aenenated at' IS NoT Mul!lautomated nenonts'."team id' = 1AND JSON_CONTAINS( automated_reports'. 'recipients', 1635, '$.100% S2Tue 21 Apr 17:53:44CascadeReview Planhat IntearAutomated Reports RCalendar Multi-Domal+O •not asomiminny then we swoule not incsadegroups into recipients move to logic to separated methodThought for 1sError while editing AutomatedReportsService.phpThoughts>Read AutomatedReportsService.php #L844-888Thouahts• AutomatedReportsService.php+1-9Now add the buildRecinients method. I'll place it next to the other transform/build heloers.• AutorNow verity no test oreakageo tecterunte dposstories/Auonavendeports/epositoryTest.one age ts/U-z/Services/Kiosk/AutomatedReports/PHPUnit 11.5.55 by Sebastian Beramann and contributors.Runtimuration: PHP 8.3.minnv/phpunit. xmlAll 447 tests passSummarv• Extracted buil dRecioients AutomatedRenort Sreport): arravat AutomatedReportsService.oho:877-889.• Non-Ask-Jiminny reports: returns only explicit recipients.users (no groups) - matches the actual send audience.•Ask Jiminny reports: returns aroups + explicit users (preservina the old visible-audience behavior for those).transformRenortRecultsnow calls sthis-shuildRecinients/<renort)and the commented-out block is aonez.l .Ask anvthina (84-D+ « Code IClaude Qnus 4.7 Medium871-15Po. 4 spac...
|
66649
|
|
66654
|
NULL
|
0
|
2026-04-21T14:54:04.327080+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776783244327_m1.jpg...
|
Slack
|
Aneliya Angelova, Nikolay Yankov, Steliyan Georgie Aneliya Angelova, Nikolay Yankov, Steliyan Georgiev (DM) - Jiminny Inc - 1 new item - Slack...
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Aneliya Angelova
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Apr 17th at 5:05:23 PM
5:05
и втория тикет не успявам до го репродусна
[URL_WITH_CREDENTIALS] Yankov
@Nikolay Yankov
Ники има една промяна която Галя иска в колоната SHARED
значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като "Shared With"
Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:45:41 PM
5:45
тази промяна за теб ли е
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Nikolay Yankov
Today at 5:48:38 PM
5:48 PM
ами от BE идва инфото какво да се покаже в тази колона -
recipients
полето
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:49:13 PM
5:49
Лукаш, можеш ли да го промениш
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 5:49:18 PM
5:49 PM
oki
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:49:35 PM
5:49
ще го опиша в сторито и това
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 5:50:29 PM
5:50 PM
да може
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:51:41 PM
5:51
това е само при Ask Jiminny или всички
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 5:52:05 PM
5:52 PM
Ask Jiminny
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Nikolay Yankov
is typing
Todor Stamatov, Direct Message, 1 of 15 suggestions
Nikolay Yankov is typing
Aneliya Angelova...
|
[{"role":"AXPopUpButton","text [{"role":"AXPopUpButton","text":"Switch workspaces… (Jiminny Inc) Has new messages","depth":14,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"Home","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Home","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"DMs","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"DMs","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"Activity","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Activity","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"Later","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Later","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"More…","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More","depth":16,"role_description":"text"},{"role":"AXStaticText","text":"Unreads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Threads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Huddles","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Drafts & sent","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Directories","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-x-integration-app","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-inner-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"ai-chapter","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"alerts","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"backend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"c-learning-people","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"confusion-clinic","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"curiosity_lab","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"engineering","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"frontend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"general","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"infra-changes","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-bg","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-copilot-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-zoom-phone-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-tickets","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"product_launches","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"random","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"releases","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"support","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"thank-yous","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"the_people_of_jiminny","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Steliyan Georgiev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":24,"role_description":"text"},{"role":"AXStaticText","text":"Mario Georgiev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Todor Stamatov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Gabriela Dureva","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Petko Kashinski","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Vasil Vasilev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Nikolov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Galya Dimitrova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Stefka Stoyanova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tomov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tanev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Ivanov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Ves","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Jira Cloud","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Toast","depth":23,"role_description":"text"},{"role":"AXRadioButton","text":"Messages","depth":17,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Messages","depth":19,"role_description":"text"},{"role":"AXRadioButton","text":"Add canvas","depth":18,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Add canvas","depth":20,"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":17,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":19,"role_description":"text"},{"role":"AXPopUpButton","text":"Add and Edit Channel Tabs","depth":17,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Canvas","depth":17,"role_description":"text"},{"role":"AXStaticText","text":"List","depth":17,"role_description":"text"},{"role":"AXStaticText","text":"Folder","depth":17,"role_description":"text"},{"role":"AXPopUpButton","text":"Jump to date","depth":23,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Apr 17th at 5:05:23 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:05","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"и втория тикет не успявам до го репродусна","depth":25,"role_description":"text"},{"role":"AXLink","text":"https://jiminny.atlassian.net/browse/JY-20694","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"https://jiminny.atlassian.net/browse/JY-20694","depth":26,"role_description":"text"},{"role":"AXButton","text":"Remove preview","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"JY-20694 Incorrect \"expiration date\" error is displayed when changing freque…","depth":27,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"JY-20694 Incorrect \"expiration date\" error is displayed when changing freque…","depth":28,"role_description":"text"},{"role":"AXStaticText","text":"Status:","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"Ready for Dev","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"Type:","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"Sub-bug","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"Assignee:","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"Lukas","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"Kovalik","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"Priority:","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"Medium","depth":26,"role_description":"text"},{"role":"AXButton","text":"Assign","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Assign","depth":28,"role_description":"text"},{"role":"AXButton","text":"Change status","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Change status","depth":28,"role_description":"text"},{"role":"AXButton","text":"sparkles emoji AI Summarise","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"AI Summarise","depth":28,"role_description":"text"},{"role":"AXComboBox","text":"More actions...","depth":27,"placeholder":"More actions...","role_description":"combo box","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Added by","depth":26,"role_description":"text"},{"role":"AXLink","text":"Jira Cloud","depth":26,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Jira Cloud","depth":27,"role_description":"text"},{"role":"AXButton","text":"Nikolay Yankov","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Apr 17th at 5:21:50 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:21 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"и аз виждам тиретата сега","depth":25,"role_description":"text"},{"role":"AXLink","text":"Apr 17th at 5:21:56 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:21","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"не мога да го възпроизведа","depth":25,"role_description":"text"},{"role":"AXPopUpButton","text":"Jump to date","depth":23,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:45:34 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:45 PM","depth":25,"role_description":"text"},{"role":"AXLink","text":"@Nikolay Yankov","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"@Nikolay Yankov","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"Ники има една промяна която Галя иска в колоната SHARED","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като \"Shared With\"","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:45:41 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:45","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"тази промяна за теб ли е","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Nikolay Yankov","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:48:38 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:48 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"ами от BE идва инфото какво да се покаже в тази колона -","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"recipients","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"полето","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:49:13 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:49","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"Лукаш, можеш ли да го промениш","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:49:18 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:49 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"oki","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:49:35 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:49","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"ще го опиша в сторито и това","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:50:29 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:50 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"да може","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:51:41 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:51","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"това е само при Ask Jiminny или всички","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:52:05 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:52 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"Ask Jiminny","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"","depth":23,"value":"","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Nikolay Yankov","depth":19,"role_description":"text"},{"role":"AXStaticText","text":"is typing","depth":19,"role_description":"text"},{"role":"AXStaticText","text":"Todor Stamatov, Direct Message, 1 of 15 suggestions","depth":11,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov is typing","depth":11,"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":13,"role_description":"text"}]...
|
-8346957423117611786
|
-1284768519847247808
|
visual_change
|
hybrid
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Aneliya Angelova
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Apr 17th at 5:05:23 PM
5:05
и втория тикет не успявам до го репродусна
[URL_WITH_CREDENTIALS] Yankov
@Nikolay Yankov
Ники има една промяна която Галя иска в колоната SHARED
значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като "Shared With"
Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:45:41 PM
5:45
тази промяна за теб ли е
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Nikolay Yankov
Today at 5:48:38 PM
5:48 PM
ами от BE идва инфото какво да се покаже в тази колона -
recipients
полето
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:49:13 PM
5:49
Лукаш, можеш ли да го промениш
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 5:49:18 PM
5:49 PM
oki
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:49:35 PM
5:49
ще го опиша в сторито и това
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 5:50:29 PM
5:50 PM
да може
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:51:41 PM
5:51
това е само при Ask Jiminny или всички
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 5:52:05 PM
5:52 PM
Ask Jiminny
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Nikolay Yankov
is typing
Todor Stamatov, Direct Message, 1 of 15 suggestions
Nikolay Yankov is typing
Aneliya Angelova
iTerm2ShellEditViewSessionScriptsProfilesWindowHelp100% C8Tue 21 Apr 17:54:04••0181DOCKERH81X L1DOCKER (docker-compose)'telus''talkdesk'/1'2>&1docker_1amp_1docker_1amp_1RUNNINGdocker_lamp_1docker_lamp_1msDONEdocker_lamp_1docker_lamp_11s DONEdocker_lamp_1-zsh®-₴82* Build full da...• ₴3|-zsh*4--from='2026-04-2114:36:00' --to='2026-04-21 14:52:00' > */proc/1/fdSTAGE (ssh)screenpipe"О 85-zsh|APP (-zsh)T2PROD (ssh)Run'do-release-upgrade' to upgrade to it.ec2-user@ip-..• *82026-04-21 14:52:14 Jiminny\Jobs\Mailbox\CreateBatchesrun_artisan_schedule: Done waitingfor schedule:run2026-04-21 14:52:14 Jiminny\Jobs\Mailbox\CreateBatches52.732026-04-21 14:53:02 Running ['artisan'meeting-bot:schedule-bot]1 '/usr/local/bin/php' 'artisan'meeting-bot: schedule-bot › '/proc/1/docker_1amp_12026-04-21 14:53:03 Running ['artisan' dialers:monitor-activities].1sDONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' dialers:monitor-activities › '/proc/1/fd/1'2>&1docker_1amp_12026-04-21 14:53:05 Running ['artisan'jiminny:monitor-social-accountS]916.02ms DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' jiminny:monitor-social-accounts > */proc/1/fd/1' 2>&1docker_lamp_112026-04-21 14:53:05 Running ['artisan'mailbox:skip-lists:refresh]1S DONEdocker_1amp_1t'/usr/local/bin/php' 'artisan' mailbox:skip-lists:refresh › */proc/1/fd/1'docker_lamp_12026-04-21 14:53:06 Running ['artisan' mailbox:batch:process --max-batches=15]956.78ms DONEdocker_1amp_11 '/usr/local/bin/php' 'artisan' mailbox:batch:process --max-batches=15 > '/proc/1/fd/1' 2>&1docker_lamp_12026-04-21 14:53:07 Running ['artisan' mailbox:batch:retry-failed --max-batches=15] in background 0.91ms DONEdocker_lamp_1 |• ('/usr/local/bin/php' 'artisan'mailbox:batch:retry-failedtches=15 › '/proc/1/fd/1' 2>&1 ; '/usr/local/bin/php''artisan'schedule: finish--max-ba" framework/schedule-390defd641effba0f73a895e426ded4cf2ba7f11" "$?") › '/dev/null' 2>&1 &docker_lamp_1docker_lamp_1run_artisan_schedule: Done waiting for schedule:rundocker_lamp_1docker_1amp_12026-04-21 14:54:02 Running ['artisan' meeting-bot: schedule-bot]1s DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan' meeting-bot:schedule-bot › */proc/1/fd/1' 2>&1View in Docker Desktopo View ConfigEnable Watch• ₴7|-zsh+PROD*** System restart required ***Last login: Mon Apr 20 15:14:15 2026 from 212.5.153.87lukas@jiminny-prod-bastion:~$ UX L3 EU (ssh)New release '24.04.4 LTS' available.Run'do-release-upgrade'to upgrade to it.*** System restart required ***Lastlogin: Mon Apr 20 15:14:23 2026 from 212.5.153.87lukas@jiminny-eu-bastion:~$T4STAGE (ssh)New release '24.04.4 LTS' available.Run 'do-release-upgrade' to upgrade to it.STAGELast login: Thu Apr 16 07:34:39 2026 from 212.39.71.189n:-$T5 QA (-zsh)Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parentsX T6 FE (-zsh)Poetry could not find a pyproject.toml file in /Users/lukas or its parentsFRONTENDPoetry could not find a pyproject.toml file in /Users/lukas or its parentslukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ IX Y7 EXT (-zsh)Last login: Mon Apr 20 19:48:04 on ttys005Poetry could not find a pyproject.toml file in /Users/lukas or its parentsEXTENSIONPoetry could not find a pyproject.toml file in /Users/lukas or its parentsukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $...
|
NULL
|
|
66655
|
1499
|
0
|
2026-04-21T14:54:07.344999+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776783247344_m1.jpg...
|
PhpStorm
|
faVsco.js – AutomatedReportsService.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
iTerm2ShellEdit•• 0ViewSessionScriptsProfilesWindo iTerm2ShellEdit•• 0ViewSessionScriptsProfilesWindowHelpSTAGE (ssh)screenpipe"• 85APP (-zsh)|• 87ec2-user@ip-..docker_lamp_12026-04-21 14:53:03 Running ['artisan'dialers:monitor-activities].docker_1amp_11 '/usr/local/bin/php' 'artisan' dialers:monitor-activities2026-04-21 14:53:05 Running ['artisan'/proc/jiminny:monitor-social-accountdocker_1amp_1proc/1/fd/1'docker_lamp_11 '/usr/local/bin/php' 'artisan' jiminny:monitor-social-accounts > */2026-04-21 14:53:05 Running ['artisan' mailbox:skip-lists:refresh].docker_lamp_11 '/usr/local/bin/php' 'artisan' mailbox:skip-lists:refresh › '/proc/docker_lamp_12026-04-21 14:53:06 Running ['artisan'mailbox:batch:process --max-ba956.78ms DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan'mailbox:batch:process --max-batches=*/proc/1/fd/1' 2>&1docker_lamp_12026-04-21 14:53:07 Running ['artisan' mailbox:batch:retry-failed --max-batches=15] in backgrounddocker_lamp_1I ('/usr/local/bin/php' 'artisan'mailbox:batch:retry-failedtches=15 ›'/proc/1/fd/1' 2>&1 ;'/usr/local/bin/php'schedule:finishrk/schedule-390defd641effba0f73a895e426ded4cf2ba7f11" "$?") > '/dev/null' 2>&1 &docker_1amp_1I run_artisan_schedule: Done waiting for schedule: rundocker_lamp_1docker_lamp_12026-04-21 14:54:02 Running ['artisan'meeting-bot: schedule-bot]docker_1amp_11 '/usr/local/bin/php' 'artisan'meeting-bot: schedule-bot > */proc/1/docker_lamp_12026-04-21 14:54:03 Running ['artisan' dialers:monitor-activities].docker_lamp_11 '/usr/local/bin/php' 'artisan' dialers:monitor-activities › '/proc/docker_lamp_12026-04-21 14:54:04 Running ['artisan'jiminny:monitor-social-accountdocker_lamp_11 '/usr/local/bin/php' 'artisan' jiminny:monitor-social-accounts > */docker_lamp_12026-04-21 14:54:05 Running ['artisan' mailbox:skip-lists:refresh] .docker_lamp_11/fd/1' 2>&1I l '/usr/local/bin/php' 'artisan' mailbox:skip-lists:refresh › */proc/View in Docker Desktop• View ConfigEnable Watch-zsh|PROD (ssh)Run'do-release-upgrade' to upgrade to it.*** System restart required ***Last login: Mon Apr 20 15:14:15 2026 from 212.5.153.87lukas@jiminny-prod-bastion:~$ UL3 EU (ssh)New release '24.04.4 LTS' available.Run'do-release-upgrade'to upgrade to it.***System restart required ***Lastlogin: Mon Apr 20 15:14:23 2026 from 212.5.153.87lukas@jiminny-eu-bastion:~$ ||T4STAGE (ssh)New release '24.04.4 LTS' available.Run 'do-release-upgrade' to upgrade to it.Last login: Thu Apr 16 07:34:39 2026 from 212.39.71.189n:-$T5 QA (-zsh)Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parentsX T6 FE (-zsh)Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parentslukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ IX T7 EXT (-zsh)Last login: Mon Apr 20 19:48:04 on ttys005Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parentsukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $100% <78Tue 21 Apr 17:54:07• *8-zsh181+PRODSTAGEFRONTENDEXTENSION...
|
NULL
|
-8676953487226550622
|
NULL
|
visual_change
|
ocr
|
NULL
|
iTerm2ShellEdit•• 0ViewSessionScriptsProfilesWindo iTerm2ShellEdit•• 0ViewSessionScriptsProfilesWindowHelpSTAGE (ssh)screenpipe"• 85APP (-zsh)|• 87ec2-user@ip-..docker_lamp_12026-04-21 14:53:03 Running ['artisan'dialers:monitor-activities].docker_1amp_11 '/usr/local/bin/php' 'artisan' dialers:monitor-activities2026-04-21 14:53:05 Running ['artisan'/proc/jiminny:monitor-social-accountdocker_1amp_1proc/1/fd/1'docker_lamp_11 '/usr/local/bin/php' 'artisan' jiminny:monitor-social-accounts > */2026-04-21 14:53:05 Running ['artisan' mailbox:skip-lists:refresh].docker_lamp_11 '/usr/local/bin/php' 'artisan' mailbox:skip-lists:refresh › '/proc/docker_lamp_12026-04-21 14:53:06 Running ['artisan'mailbox:batch:process --max-ba956.78ms DONEdocker_lamp_11 '/usr/local/bin/php' 'artisan'mailbox:batch:process --max-batches=*/proc/1/fd/1' 2>&1docker_lamp_12026-04-21 14:53:07 Running ['artisan' mailbox:batch:retry-failed --max-batches=15] in backgrounddocker_lamp_1I ('/usr/local/bin/php' 'artisan'mailbox:batch:retry-failedtches=15 ›'/proc/1/fd/1' 2>&1 ;'/usr/local/bin/php'schedule:finishrk/schedule-390defd641effba0f73a895e426ded4cf2ba7f11" "$?") > '/dev/null' 2>&1 &docker_1amp_1I run_artisan_schedule: Done waiting for schedule: rundocker_lamp_1docker_lamp_12026-04-21 14:54:02 Running ['artisan'meeting-bot: schedule-bot]docker_1amp_11 '/usr/local/bin/php' 'artisan'meeting-bot: schedule-bot > */proc/1/docker_lamp_12026-04-21 14:54:03 Running ['artisan' dialers:monitor-activities].docker_lamp_11 '/usr/local/bin/php' 'artisan' dialers:monitor-activities › '/proc/docker_lamp_12026-04-21 14:54:04 Running ['artisan'jiminny:monitor-social-accountdocker_lamp_11 '/usr/local/bin/php' 'artisan' jiminny:monitor-social-accounts > */docker_lamp_12026-04-21 14:54:05 Running ['artisan' mailbox:skip-lists:refresh] .docker_lamp_11/fd/1' 2>&1I l '/usr/local/bin/php' 'artisan' mailbox:skip-lists:refresh › */proc/View in Docker Desktop• View ConfigEnable Watch-zsh|PROD (ssh)Run'do-release-upgrade' to upgrade to it.*** System restart required ***Last login: Mon Apr 20 15:14:15 2026 from 212.5.153.87lukas@jiminny-prod-bastion:~$ UL3 EU (ssh)New release '24.04.4 LTS' available.Run'do-release-upgrade'to upgrade to it.***System restart required ***Lastlogin: Mon Apr 20 15:14:23 2026 from 212.5.153.87lukas@jiminny-eu-bastion:~$ ||T4STAGE (ssh)New release '24.04.4 LTS' available.Run 'do-release-upgrade' to upgrade to it.Last login: Thu Apr 16 07:34:39 2026 from 212.39.71.189n:-$T5 QA (-zsh)Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parentsX T6 FE (-zsh)Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parentslukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ IX T7 EXT (-zsh)Last login: Mon Apr 20 19:48:04 on ttys005Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parentsukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $100% <78Tue 21 Apr 17:54:07• *8-zsh181+PRODSTAGEFRONTENDEXTENSION...
|
66654
|
|
66656
|
1500
|
0
|
2026-04-21T14:54:07.610361+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776783247610_m2.jpg...
|
PhpStorm
|
faVsco.js – AutomatedReportsService.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsRepositoryTest
Run 'AutomatedReportsRepositoryTest'
Debug 'AutomatedReportsRepositoryTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
102
3
34
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Kiosk\AutomatedReports;
use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Carbon\Exceptions\InvalidFormatException;
use DateTime;
use DateTimeInterface;
use DateTimeZone;
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcher;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Jiminny\Component\ActivitySearch\FilterDefinition\InputTypeEnum;
use Jiminny\Component\AskAnything\AskAnythingPromptService;
use Jiminny\Component\AskAnything\Dtos\AskAnythingPromptDto;
use Jiminny\Component\UrlGenerator\Webhook;
use Jiminny\Contracts\Repositories\PlaybookCategoryRepository;
use Jiminny\Contracts\Repositories\TeamRepository;
use Jiminny\Contracts\Repositories\UserRepository;
use Jiminny\Exceptions\ApplicationException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Exceptions\ModelNotFoundException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateReportJob;
use Jiminny\Models\Activity\Search;
use Jiminny\Models\AskAnything\AskAnythingPrompt;
use Jiminny\Models\AskAnything\AskAnythingPromptTarget;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Contracts\UserContract;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AskAnythingRepository;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Repositories\GroupRepository;
use Jiminny\Repositories\SearchRepository;
use Jiminny\Repositories\StageRepository;
use Throwable;
class AutomatedReportsService
{
public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';
public const string TYPE_ASK_JIMINNY = 'ask_jiminny';
/**
* Standard report types (used by kiosk for existing automated reports).
*/
// @TODO this will add filter, however if we need to control feature by FF we need conditional logic
public const array TYPES = [
['id' => 'exec_summary', 'name' => 'Exec Summary'],
['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],
['id' => 'product_feedback', 'name' => 'Product Feedback'],
['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],
// ['id' => 'questions', 'name' => 'Questions'],
// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],
];
public const array ALL_TYPES = [
...self::TYPES,
['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],
];
public const string FREQUENCY_DAILY = 'daily';
public const string FREQUENCY_WEEKLY = 'weekly';
public const string FREQUENCY_MONTHLY = 'monthly';
public const string FREQUENCY_QUARTERLY = 'quarterly';
public const string FREQUENCY_ONE_OFF = 'one_off';
/**
* Frequencies for standard (non-Ask Jiminny) reports.
*/
public const array FREQUENCIES = [
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
/**
* Frequencies for Ask Jiminny reports.
*/
public const array ASK_JIMINNY_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
];
public const string MEDIA_TYPE_PDF = 'pdf';
public const string MEDIA_TYPE_PODCAST = 'podcast';
public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];
public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];
public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];
public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];
public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];
public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];
public const int SENT_REPORT_AT_HOURS = 5;
public const string PDF_KEY = 'pdf';
public const string AUDIO_KEY = 'audio';
private const array ALL_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
private const string S3_DIR = 'reports';
private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];
private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];
public function __construct(
private readonly TeamRepository $teamRepository,
private readonly GroupRepository $groupRepository,
private readonly UserRepository $userRepository,
private readonly StageRepository $stageRepository,
private readonly DealStagesService $dealStagesService,
private readonly RecipientsService $recipientsService,
private readonly AutomatedReportsRepository $automatedReportsRepository,
private readonly Webhook $webhookService,
private readonly BusDispatcher $dispatcher,
private readonly ActivityTypeService $activityTypeService,
private readonly PlaybookCategoryRepository $playbookCategoryRepository,
private readonly AskAnythingPromptService $askAnythingPromptService,
private readonly SearchRepository $activitySearchRepository,
private readonly AskAnythingRepository $askAnythingRepository,
) {
}
public static function getTypes(): array
{
$types = self::TYPES;
return array_map(static function ($type) {
return $type['id'];
}, $types);
}
public static function getCallTypes(): array
{
return array_map(static function ($callType) {
return $callType['id'];
}, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);
}
public static function getFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::FREQUENCIES);
}
// front-facing structure
public function getReportEnabledFieldData(bool $value = false): array
{
return [
'id' => 'report_enabled',
'label' => '',
'inputType' => InputTypeEnum::TOGGLE,
'value' => $value,
];
}
// Organizations = Teams
public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array
{
$options = $this->getTeams();
if ($shortVersion) {
return [
'id' => 'organization',
'label' => 'Organization',
'options' => $options,
];
}
return [
'id' => 'organization',
'label' => 'Organization',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $options,
'value' => $value,
'dependencies' => [
'teams',
'deal_stage_at_call',
'current_deal_stage',
'recipients',
ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,
],
'dependsOn' => [],
];
}
// Teams = Groups
public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array
{
if ($shortVersion) {
return [
'id' => 'teams',
'label' => 'Team',
'options' => $options,
];
}
return [
'id' => 'teams',
'label' => 'Team',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => false,
'placeholder' => 'Select',
'options' => $options,
'value' => $value, // value should be an array of objects {id, name}
'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],
'dependsOn' => [],
];
}
public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array
{
$types = [];
if ($team instanceof Team) {
if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
$types = self::TYPES;
}
if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {
$types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];
}
} else {
$types = self::TYPES;
}
if ($shortVersion) {
return [
'id' => 'report_type',
'label' => 'Report Type',
'options' => $types,
];
}
return [
'id' => 'report_type',
'label' => 'Report Type',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $types,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getFrequencyFieldData(?string $value = null): array
{
return [
'id' => 'frequency',
'label' => 'Frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => self::FREQUENCIES,
'value' => $value,
'dependencies' => ['period'],
'dependsOn' => [],
];
}
public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array
{
return [
'id' => 'period',
'label' => 'Select one-off period',
'inputType' => InputTypeEnum::DATE_RANGE,
'required' => true,
'placeholder' => 'Select',
'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],
'queryParams' => [
'startDate' => 'start_date_period',
'endDate' => 'end_date_period',
],
'dependencies' => [],
'dependsOn' => ['frequency'],
];
}
public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array
{
return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);
}
public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);
}
public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);
}
public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'deal_value',
'label' => 'Deal Value',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_deal_value',
'max' => 'max_deal_value',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array
{
$value = [];
$conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;
$dialerOn && $value[] = self::CALL_TYPE_DIALER;
return [
'id' => 'call_type',
'label' => 'Call Type',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => [
self::CALL_TYPE_CONFERENCE,
self::CALL_TYPE_DIALER,
],
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getMediaTypeFieldData(?AutomatedReport $report = null): array
{
$value = [];
if ($report) {
$value = $this->transformMediaTypes($report);
}
return [
'id' => 'media_types',
'label' => 'Export as',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => self::MEDIA_TYPE_OBJECTS,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'call_duration',
'label' => 'Call Duration',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_call_duration',
'max' => 'max_call_duration',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getRecipientsFieldData(?Team $team = null, array $value = []): array
{
return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);
}
public function getJiminnyRecipientsFieldData(array $value = []): array
{
return $this->recipientsService->getJiminnyRecipientsFieldData($value);
}
public function getAdditionalPromptInputFieldData(?string $value = null): array
{
return [
'id' => 'additional_prompt_input',
'label' => 'Special requirements',
'inputType' => InputTypeEnum::TEXTAREA,
'required' => false,
'placeholder' => 'What should be the focus of the report?',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCustomReportNameFieldData(?string $value = null): array
{
return [
'id' => 'custom_name',
'label' => 'Custom report name',
'inputType' => InputTypeEnum::TEXT,
'required' => false,
'placeholder' => 'Enter custom name',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
// data providers
public function getTeams(): array
{
$teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);
$teamData = [];
foreach ($teams as $team) {
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
continue;
}
$teamData[] = $this->transformTeam($team);
}
return $teamData;
}
public function getTeamGroups(string $teamUuid): array
{
$data = [];
$team = $this->getTeam($teamUuid);
if ($team !== null) {
$groups = $team->groups()->get();
foreach ($groups as $group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
];
}
}
return $data;
}
public function getTeamsGroupsOptions(array $filterTeamUuids = []): array
{
$data = [];
$teams = $this->getTeams();
foreach ($teams as $team) {
if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {
continue;
}
$data[] = [
'label' => $team['name'],
'groups' => $this->getTeamGroups($team['id']),
];
}
return $data;
}
public function getTeam(string $teamUuid): ?Team
{
return $this->teamRepository->idOrUuid($teamUuid);
}
public function getTeamById(int $teamId): ?Team
{
return $this->teamRepository->find($teamId);
}
public function getGroupsUuids(AutomatedReport $report): array
{
$uuids = [];
$reportGroups = $report->getGroups();
foreach ($reportGroups as $groupId) {
if ($group = $this->groupRepository->find($groupId)) {
$uuids[] = $group->getUuid();
}
}
return $uuids;
}
public function getPlaybookCategoriesUuids(AutomatedReport $report): array
{
$uuids = [];
$playbookCategories = $report->getPlaybookCategories();
foreach ($playbookCategories as $id) {
if ($category = $this->playbookCategoryRepository->find($id)) {
$uuids[] = $category->getUuid();
}
}
return $uuids;
}
public function getDealAtCallStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getDealAtCallStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getCurrentDealStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getCurrentDealStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getRecipients());
}
public function getJiminnyUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function extractUserUuids(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => $user->getUuid())
->values()
->all();
}
// get mail data
public function getRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getRecipients());
}
/**
* @return array<UserContract>
*/
public function getRecipientUserObjects(AutomatedReport $report): array
{
$userIds = $report->getRecipients()['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->values()
->all();
}
private function getJiminnyRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function buildRecipientUsers(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => [
'email' => $user->getEmailAddress(),
'name' => $user->getName(),
'timezone' => $user->getTimezone()->getName(),
])
->values()
->all();
}
public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array
{
if ($report->isAskJiminnyReport()) {
$recipients = $this->resolveAskJiminnyRecipients($report);
} else {
$recipients = $this->getRecipientUsers($report);
if ($includeJiminny) {
$recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));
}
}
$emails = [];
return array_values(array_filter(
$recipients,
static function ($recipient) use (&$emails) {
if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {
return false;
}
$emails[] = $recipient['email'];
return true;
}
));
}
private function resolveAskJiminnyRecipients(AutomatedReport $report): array
{
$recipients = [];
$creator = $report->getCreator();
if ($creator !== null) {
$recipients[] = [
'email' => $creator->getEmailAddress(),
'name' => $creator->getName(),
'timezone' => $creator->getTimezone()->getName(),
];
}
return array_merge(
$recipients,
$this->buildRecipientUsers($report->getRecipients()),
$this->getGroupRecipientUsers($report),
);
}
private function getGroupRecipientUsers(AutomatedReport $report): array
{
$users = [];
foreach ($report->getGroups() as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group === null) {
continue;
}
foreach ($group->getMembers() as $member) {
$users[] = [
'email' => $member->getEmailAddress(),
'name' => $member->getName(),
'timezone' => $member->getTimezone()->getName(),
];
}
}
return $users;
}
public function getReportTypeName(AutomatedReportResult $report): string
{
$type = $report->getReport()->getType();
$getType = $this->transformReportType($type);
return $getType['name'];
}
public function getReportPeriodName(AutomatedReportResult $report): string
{
$from = $report->getFromDate();
$to = $report->getToDate();
$frequency = $report->getReport()->getFrequency();
if ($from === null || $to === null) {
if (! $report->getReport()->isAskJiminnyReport()) {
$invalidPeriod = $from === null ? 'from' : 'to';
throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);
}
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
}
return $this->formatReportPeriodName($frequency, $from, $to);
}
private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string
{
$fromYear = $from->format('Y');
$toYear = $to->format('Y');
$differentYears = $fromYear !== $toYear;
switch ($frequency) {
case self::FREQUENCY_DAILY:
return $from->format('j M Y');
case self::FREQUENCY_QUARTERLY:
// 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ
$startMonth = $from->format('M');
$endMonth = $to->copy()->subMonth();
$endMonthName = $endMonth->format('M');
$endMonthYear = $endMonth->format('Y');
if ($differentYears) {
return "{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}";
}
return "{$startMonth} - {$endMonthName} {$toYear}";
case self::FREQUENCY_MONTHLY:
// 'May 2025' - monthly reports are always within the same year
return $from->format('M Y');
case self::FREQUENCY_WEEKLY:
// '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ
$startDay = $from->format('j');
$endDay = $to->format('j');
$startMonth = $from->format('M');
$endMonth = $to->format('M');
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
if ($startMonth !== $endMonth) {
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
}
return "{$startDay} - {$endDay} {$endMonth} {$toYear}";
case self::FREQUENCY_ONE_OFF:
// '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ
$startDay = $from->format('j');
$startMonth = $from->format('M');
$endDay = $to->format('j');
$endMonth = $to->format('M');
// If same month and year, use a format like '2-31 May 2025'
if ($startMonth === $endMonth && ! $differentYears) {
return "{$startDay} - {$endDay} {$startMonth} {$toYear}";
}
// If different years, include both years
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
// Same year but different months
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
default:
// Default format for unknown frequencies
return $from->format('j M Y') . ' - ' . $to->format('j M Y');
}
}
public function getReportTeamsName(AutomatedReportResult $report): string
{
$groups = $report->getGroups();
if (empty($groups)) {
return 'All';
}
// Get group names from repository
$groupNames = [];
foreach ($groups as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group) {
$groupNames[] = $group->getName();
}
}
if (count($groupNames) === 1) {
// Single team format
$teamsName = $groupNames[0];
} else {
// Multiple teams format
$teamsName = implode(', ', $groupNames);
}
return $teamsName;
}
public function getReportFileName(AutomatedReportResult $report): string
{
$customName = $report->getReport()->getCustomName();
$periodName = $this->getReportPeriodName($report);
$filenameSuffix = $this->getFilenameSuffix($report);
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$customName} - {$periodName}");
}
$baseName = $this->getReportTypeName($report);
if ($filenameSuffix) {
$baseName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}");
}
public function getReportFileNameWithExtension(AutomatedReportResult $result): string
{
$extension = $this->getMediaTypeMetadata($result)['extension'];
return $this->getReportFileName($result) . '.' . $extension;
}
public function sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool
{
$recipients = array_map('intval', $report->getRecipients()['users'] ?? []);
return in_array($user->getId(), $recipients);
}
public function transformReportResults(Collection $automatedReportResults): array
{
$data = [];
foreach ($automatedReportResults as $automatedReportResult) {
/** @var AutomatedReportResult $automatedReportResult */
$report = $automatedReportResult->getReport();
$createdBy = $report->getCreator();
$creator = [
'id' => $createdBy?->getUuid(),
'name' => $createdBy?->getName(),
'email' => $createdBy?->getEmailAddress(),
'photoUrl' => $createdBy?->getPhotoUrl(),
];
$data[] = [
'id' => $automatedReportResult->getUuid(),
'name' => $automatedReportResult->getName(),
'frequency' => $this->transformFrequency($report->getFrequency()),
'recipients' => $this->buildRecipients($report),
'report_type' => $this->transformReportType($report->getType()),
'media_type' => $automatedReportResult->getMediaType(),
'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),
'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),
'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),
'creator' => $creator,
];
}
return $data;
}
private function buildRecipients(AutomatedReport $report): array
{
$recipients = array_values($this->transformRecipients($report->getRecipients()));
if (! $report->isAskJiminnyReport()) {
return $recipients;
}
return [
...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),
...$recipients,
];
}
public function hasCallTypeConference(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);
}
public function hasCallTypeDialer(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);
}
// transformers
private function transformTeam(Team $team): array
{
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
return [];
}
return [
'id' => $team->getUuid(),
'name' => $team->getName(),
];
}
private function transformReportFullView(AutomatedReport $report): array
{
$base = $this->transformReportBase($report);
return $report->getType() === self::TYPE_ASK_JIMINNY
? $base + $this->transformAskJiminnyFields($report)
: $base + $this->transformStandardReportFields($report);
}
private function transformReportBase(AutomatedReport $report): array
{
return [
'id' => $report->getUuid(),
'organization' => $this->transformOrganization(team: $report->getTeam()),
'report_type' => $this->transformReportType($report->getType()),
'frequency' => $this->transformFrequency($report->getFrequency()),
];
}
private function transformStandardReportFields(AutomatedReport $report): array
{
$team = $report->getTeam();
return [
'report_enabled' => $report->getStatus(),
'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),
'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),
'deal_value_min' => $report->getDealValueMin(),
'deal_value_max' => $report->getDealValueMax(),
'call_types' => $this->transformCallType($report->getCallTypes()),
'media_types' => $this->transformMediaTypes($report),
'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),
'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),
'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),
'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),
'recipients' => $this->transformRecipients($report->getRecipients()),
'created_by' => $this->transformCreator($report->getCreator()),
'additional_prompt_input' => $report->getAdditionalPromptInput(),
'custom_name' => $report->getCustomName(),
'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),
'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),
'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),
];
}
private function transformAskJiminnyFields(AutomatedReport $report): array
{
$team = $report->getTeam();
$creatorId = $report->getAttribute('created_by');
$explicitUserIds = array_values(array_filter(
$report->getRecipients()['users'] ?? [],
static fn ($id) => $id !== $creatorId
));
return [
'report_name' => $report->getCustomName(),
'enabled' => $report->getStatus(),
'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),
'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),
'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),
'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),
];
}
private function transformOrganization(?Team $team): array
{
return [
'id' => $team?->getUuid(),
'name' => $team?->getName(),
];
}
private function transformReportType(string $type): array
{
foreach (self::ALL_TYPES as $typeItem) {
if ($typeItem['id'] === $type) {
return $typeItem;
}
}
return [];
}
private function transformCallType(array $types): array
{
$result = [];
$callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];
foreach ($types as $type) {
foreach ($callTypes as $callTypeItem) {
if ($callTypeItem['id'] === $type) {
$result[] = $callTypeItem;
break;
}
}
}
return $result;
}
private function transformMediaTypes(AutomatedReport $report): array
{
$values = [];
foreach ($report->getMediaTypes() as $mediaType) {
if (! in_array($mediaType, self::MEDIA_TYPES, true)) {
continue;
}
$values[] = match ($mediaType) {
self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,
self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,
};
}
return $values;
}
private function transformFrequency(string $frequency): array
{
foreach (self::ALL_FREQUENCIES as $frequencyItem) {
if ($frequencyItem['id'] === $frequency) {
return $frequencyItem;
}
}
return [];
}
public function transformDurationToMinutes(?int $duration): ?int
{
if (! $duration) {
return null;
}
return (int) ($duration / 60);
}
private function transformGroups(?Team $team, array $groupsIds): array
{
if (empty($groupsIds) || ! $team) {
return [];
}
$data = [];
foreach ($groupsIds as $groupId) {
$group = $team->groups()->where('id', $groupId)->first();
if ($group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
'photoUrl' => $group->getPhotoUrl(),
];
}
}
return $data;
}
private function transformStages(?Team $team, array $stagesIds): array
{
if (empty($stagesIds) || ! $team) {
return [];
}
$data = [];
foreach ($stagesIds as $stageId) {
$stage = $team->stages()->where('id', $stageId)->first();
if ($stage) {
$data[] = [
'id' => $stage->getUuid(),
'name' => $stage->getName(),
];
}
}
return $data;
}
private function transformRecipients(array $recipients): array
{
$users = [];
foreach ($recipients['users'] ?? [] as $userId) {
$users[] = $this->transformUser($userId);
}
return $users;
}
private function transformCreator(?User $user): ?array
{
if ($user === null) {
return null;
}
return $this->transformUser($user->getId());
}
private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array
{
if ($prompt === null) {
return null;
}
return [
'id' => $prompt->getUuid(),
'name' => $prompt->getTitle(),
];
}
private function transformSafeSearch(?Search $search): ?array
{
if ($search === null) {
return null;
}
return [
'id' => $search->getUuid(),
'name' => $search->getName(),
];
}
private function transformUser(int $userId): array
{
/* @var ?User $user */
$user = $this->userRepository->find($userId);
return [
'id' => $user?->getUuid(),
'name' => $user?->getName(),
'email' => $user?->getEmailAddress(),
'photoUrl' => $user?->getPhotoUrl(),
];
}
public function create(array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$validatedData['created_by'] = auth()->id();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
public function update(string $uuid, array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$report = $this->automatedReportsRepository->findByUuid($uuid);
if (! $report) {
throw new InvalidArgumentException('Report not found');
}
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
/**
* Create an Ask Jiminny report.
*/
public function createAskJiminnyReport(array $data, User $creator): array
{
$validatedData = $this->validateAskJiminnyReportData($data, $creator);
$validatedData['created_by'] = $creator->getId();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
return $this->transformReportFullView($automatedReport);
}
/**
* Update an Ask Jiminny report.
*/
public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array
{
if (! $report->isAskJiminnyReport()) {
throw new InvalidArgumentException('Report is not an Ask Jiminny report');
}
$validatedData = $this->validateAskJiminnyReportData($data, $user);
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
return $this->transformReportFullView($automatedReport);
}
public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array
{
$this->automatedReportsRepository->update($report, ['status' => $status]);
return $this->transformReportFullView($report->fresh());
}
/**
* Validate and transform data for Ask Jiminny reports.
*/
private function validateAskJiminnyReportData(array $data, User $user): array
{
// Validate name
$name = trim($data['report_name'] ?? '');
if (empty($name)) {
throw new InvalidArgumentException('Report name is required');
}
if (mb_strlen($name) > 50) {
throw new InvalidArgumentException('Report name must be 50 characters or less');
}
// Validate frequency (only daily, weekly, monthly for Ask Jiminny)
$frequency = $data['frequency'] ?? null;
$askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];
if (! in_array($frequency, $askJiminnyFrequencies, true)) {
throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');
}
// Validate expiration date
$expiresAt = $data['expires_on'] ?? null;
if (empty($expiresAt)) {
throw new InvalidArgumentException('Expiration date is required');
}
try {
$expiresAtDate = Carbon::parse($expiresAt);
} catch (InvalidFormatException $e) {
throw new InvalidArgumentException('Expiration date format is invalid');
}
$maxExpiration = Carbon::now()->addYear()->endOfDay();
if ($expiresAtDate->gt($maxExpiration)) {
throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');
}
if ($expiresAtDate->isPast()) {
throw new InvalidArgumentException('Expiration date cannot be in the past');
}
// Validate saved search
$activitySearchId = $data['saved_search'] ?? null;
if (empty($activitySearchId)) {
throw new InvalidArgumentException('Saved search is required');
}
$savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);
if (! $savedSearch) {
throw new InvalidArgumentException('Saved search not found or does not belong to you');
}
// Validate saved prompt
$askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;
if (empty($askAnythingPromptId)) {
throw new InvalidArgumentException('Ask Jiminny prompt is required');
}
$prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);
if (! $prompt) {
throw new InvalidArgumentException('Ask Jiminny prompt not found');
}
// Validate status
$status = $data['enabled'] ?? false;
$recipientUserIds = [$user->getId()];
if (! empty($data['share_users'])) {
$sharedUserIds = $this->validateAndGetUserIdsByTeam(
$user->team,
(array) $data['share_users']
);
$recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);
}
$sharedGroupIds = [];
if (! empty($data['share_teams'])) {
$sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);
}
$recipientUserIds = array_values(array_unique($recipientUserIds));
return [
'team_id' => $user->getTeamId(),
'type' => self::TYPE_ASK_JIMINNY,
'status' => (bool) $status,
'frequency' => $frequency,
'custom_name' => $name,
'activity_search_id' => $savedSearch->getId(),
'ask_anything_prompt_id' => $prompt->getId(),
'expires_at' => $expiresAtDate->toDateString(),
'media_types' => [self::MEDIA_TYPE_PDF],
'call_types' => [],
'recipients' => ['users' => $recipientUserIds],
'groups' => $sharedGroupIds,
];
}
public static function getAskJiminnyFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::ASK_JIMINNY_FREQUENCIES);
}
public function getAskJiminnyReportFilters(User $user): array
{
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
return [
[
'id' => 'prompt',
'label' => 'Prompt',
'options' => $prompts,
],
[
'id' => 'saved_search',
'label' => 'Saved Search',
'options' => $savedSearches,
],
];
}
public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array
{
$team = $user->getTeam();
$userTimezone = $user->getTimezone();
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
$teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [
'id' => $group->getUuid(),
'name' => $group->getName(),
])->values()->all();
$shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];
$sharedTeamsValue = [];
$sharedUsersValue = [];
if ($report) {
$sharedTeamsValue = $this->transformGroups($team, $report->getGroups());
$recipientUserIds = $report->getRecipients()['users'] ?? [];
$creatorId = $report->getAttribute('created_by');
$sharedUserIds = array_values(array_filter(
$recipientUserIds,
static fn ($id) => $id !== $creatorId
));
$sharedUsersValue = collect($sharedUserIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (User $u) => [
'id' => $u->getUuid(),
'name' => $u->getName(),
])
->values()
->all();
}
return [
'fields' => [
[
'id' => 'enabled',
'inputType' => InputTypeEnum::TOGGLE,
'label' => '',
'value' => $report?->getStatus() ?? false,
],
[
'id' => 'report_name',
'inputType' => InputTypeEnum::TEXT,
'label' => 'Name',
'placeholder' => 'Enter name',
'required' => true,
'validation' => ['maxLength' => 50],
'value' => $report?->getCustomName() ?? '',
],
[
'id' => 'frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'label' => 'Frequency',
'required' => true,
'placeholder' => 'Select',
'options' => self::ASK_JIMINNY_FREQUENCIES,
'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,
],
[
'id' => 'expires_on',
'inputType' => InputTypeEnum::DATE,
'label' => 'Expires on',
'required' => true,
'placeholder' => 'Select',
'validation' => [
'minDate' => now($userTimezone)->toDateString(),
'maxDate' => now($userTimezone)->addYear()->toDateString(),
],
'value' => $report?->getExpiresAt()?->toDateString(),
],
[
...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"#11894 on JY-18909-automated-reports-ask-jiminny, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.12134308,"height":0.025538707},"help_text":"Pull request #11894 exists for current branch JY-18909-automated-reports-ask-jiminny","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8161569,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AutomatedReportsRepositoryTest","depth":6,"bounds":{"left":0.83144945,"top":0.019952115,"width":0.084109046,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AutomatedReportsRepositoryTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AutomatedReportsRepositoryTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"102","depth":4,"bounds":{"left":0.4424867,"top":0.17478053,"width":0.011968086,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"3","depth":4,"bounds":{"left":0.45644948,"top":0.17478053,"width":0.007978723,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"34","depth":4,"bounds":{"left":0.4664229,"top":0.17478053,"width":0.010305851,"height":0.015163607},"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.47839096,"top":0.17318435,"width":0.00731383,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.48570478,"top":0.17318435,"width":0.006981383,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Kiosk\\AutomatedReports;\n\nuse Carbon\\CarbonImmutable;\nuse Carbon\\CarbonInterface;\nuse Carbon\\Exceptions\\InvalidFormatException;\nuse DateTime;\nuse DateTimeInterface;\nuse DateTimeZone;\nuse Illuminate\\Contracts\\Bus\\Dispatcher as BusDispatcher;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Support\\Facades\\Log;\nuse Illuminate\\Support\\Facades\\Storage;\nuse Jiminny\\Component\\ActivitySearch\\FilterDefinition\\InputTypeEnum;\nuse Jiminny\\Component\\AskAnything\\AskAnythingPromptService;\nuse Jiminny\\Component\\AskAnything\\Dtos\\AskAnythingPromptDto;\nuse Jiminny\\Component\\UrlGenerator\\Webhook;\nuse Jiminny\\Contracts\\Repositories\\PlaybookCategoryRepository;\nuse Jiminny\\Contracts\\Repositories\\TeamRepository;\nuse Jiminny\\Contracts\\Repositories\\UserRepository;\nuse Jiminny\\Exceptions\\ApplicationException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Exceptions\\ModelNotFoundException;\nuse Jiminny\\Jobs\\AutomatedReports\\RequestGenerateReportJob;\nuse Jiminny\\Models\\Activity\\Search;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPrompt;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPromptTarget;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Contracts\\UserContract;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Repositories\\AskAnythingRepository;\nuse Jiminny\\Repositories\\AutomatedReportsRepository;\nuse Jiminny\\Repositories\\GroupRepository;\nuse Jiminny\\Repositories\\SearchRepository;\nuse Jiminny\\Repositories\\StageRepository;\nuse Throwable;\n\nclass AutomatedReportsService\n{\n public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';\n public const string TYPE_ASK_JIMINNY = 'ask_jiminny';\n\n /**\n * Standard report types (used by kiosk for existing automated reports).\n */\n // @TODO this will add filter, however if we need to control feature by FF we need conditional logic\n public const array TYPES = [\n ['id' => 'exec_summary', 'name' => 'Exec Summary'],\n ['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],\n ['id' => 'product_feedback', 'name' => 'Product Feedback'],\n ['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],\n// ['id' => 'questions', 'name' => 'Questions'],\n// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],\n ];\n\n public const array ALL_TYPES = [\n ...self::TYPES,\n ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],\n ];\n\n public const string FREQUENCY_DAILY = 'daily';\n public const string FREQUENCY_WEEKLY = 'weekly';\n public const string FREQUENCY_MONTHLY = 'monthly';\n public const string FREQUENCY_QUARTERLY = 'quarterly';\n public const string FREQUENCY_ONE_OFF = 'one_off';\n\n /**\n * Frequencies for standard (non-Ask Jiminny) reports.\n */\n public const array FREQUENCIES = [\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n\n /**\n * Frequencies for Ask Jiminny reports.\n */\n public const array ASK_JIMINNY_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ];\n\n public const string MEDIA_TYPE_PDF = 'pdf';\n public const string MEDIA_TYPE_PODCAST = 'podcast';\n public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];\n public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];\n public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];\n public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];\n\n public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];\n public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];\n public const int SENT_REPORT_AT_HOURS = 5;\n public const string PDF_KEY = 'pdf';\n public const string AUDIO_KEY = 'audio';\n\n private const array ALL_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n private const string S3_DIR = 'reports';\n private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];\n private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];\n\n public function __construct(\n private readonly TeamRepository $teamRepository,\n private readonly GroupRepository $groupRepository,\n private readonly UserRepository $userRepository,\n private readonly StageRepository $stageRepository,\n private readonly DealStagesService $dealStagesService,\n private readonly RecipientsService $recipientsService,\n private readonly AutomatedReportsRepository $automatedReportsRepository,\n private readonly Webhook $webhookService,\n private readonly BusDispatcher $dispatcher,\n private readonly ActivityTypeService $activityTypeService,\n private readonly PlaybookCategoryRepository $playbookCategoryRepository,\n private readonly AskAnythingPromptService $askAnythingPromptService,\n private readonly SearchRepository $activitySearchRepository,\n private readonly AskAnythingRepository $askAnythingRepository,\n ) {\n }\n\n public static function getTypes(): array\n {\n $types = self::TYPES;\n\n return array_map(static function ($type) {\n return $type['id'];\n }, $types);\n }\n\n public static function getCallTypes(): array\n {\n return array_map(static function ($callType) {\n return $callType['id'];\n }, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);\n }\n\n public static function getFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::FREQUENCIES);\n }\n\n // front-facing structure\n public function getReportEnabledFieldData(bool $value = false): array\n {\n return [\n 'id' => 'report_enabled',\n 'label' => '',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'value' => $value,\n ];\n }\n\n // Organizations = Teams\n public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array\n {\n $options = $this->getTeams();\n\n if ($shortVersion) {\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value,\n 'dependencies' => [\n 'teams',\n 'deal_stage_at_call',\n 'current_deal_stage',\n 'recipients',\n ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,\n ],\n 'dependsOn' => [],\n ];\n }\n\n // Teams = Groups\n public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array\n {\n if ($shortVersion) {\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value, // value should be an array of objects {id, name}\n 'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],\n 'dependsOn' => [],\n ];\n }\n\n public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array\n {\n $types = [];\n if ($team instanceof Team) {\n if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n $types = self::TYPES;\n }\n if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {\n $types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];\n }\n } else {\n $types = self::TYPES;\n }\n\n if ($shortVersion) {\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'options' => $types,\n ];\n }\n\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $types,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getFrequencyFieldData(?string $value = null): array\n {\n return [\n 'id' => 'frequency',\n 'label' => 'Frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::FREQUENCIES,\n 'value' => $value,\n 'dependencies' => ['period'],\n 'dependsOn' => [],\n ];\n }\n\n public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array\n {\n return [\n 'id' => 'period',\n 'label' => 'Select one-off period',\n 'inputType' => InputTypeEnum::DATE_RANGE,\n 'required' => true,\n 'placeholder' => 'Select',\n 'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],\n 'queryParams' => [\n 'startDate' => 'start_date_period',\n 'endDate' => 'end_date_period',\n ],\n 'dependencies' => [],\n 'dependsOn' => ['frequency'],\n ];\n }\n\n public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array\n {\n return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);\n }\n\n public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);\n }\n\n public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);\n }\n\n public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'deal_value',\n 'label' => 'Deal Value',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_deal_value',\n 'max' => 'max_deal_value',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array\n {\n $value = [];\n $conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;\n $dialerOn && $value[] = self::CALL_TYPE_DIALER;\n\n return [\n 'id' => 'call_type',\n 'label' => 'Call Type',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => [\n self::CALL_TYPE_CONFERENCE,\n self::CALL_TYPE_DIALER,\n ],\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getMediaTypeFieldData(?AutomatedReport $report = null): array\n {\n $value = [];\n\n if ($report) {\n $value = $this->transformMediaTypes($report);\n }\n\n return [\n 'id' => 'media_types',\n 'label' => 'Export as',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => self::MEDIA_TYPE_OBJECTS,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'call_duration',\n 'label' => 'Call Duration',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_call_duration',\n 'max' => 'max_call_duration',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getRecipientsFieldData(?Team $team = null, array $value = []): array\n {\n return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);\n }\n\n public function getJiminnyRecipientsFieldData(array $value = []): array\n {\n return $this->recipientsService->getJiminnyRecipientsFieldData($value);\n }\n\n public function getAdditionalPromptInputFieldData(?string $value = null): array\n {\n return [\n 'id' => 'additional_prompt_input',\n 'label' => 'Special requirements',\n 'inputType' => InputTypeEnum::TEXTAREA,\n 'required' => false,\n 'placeholder' => 'What should be the focus of the report?',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCustomReportNameFieldData(?string $value = null): array\n {\n return [\n 'id' => 'custom_name',\n 'label' => 'Custom report name',\n 'inputType' => InputTypeEnum::TEXT,\n 'required' => false,\n 'placeholder' => 'Enter custom name',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n // data providers\n public function getTeams(): array\n {\n $teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);\n\n $teamData = [];\n foreach ($teams as $team) {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n continue;\n }\n\n $teamData[] = $this->transformTeam($team);\n }\n\n return $teamData;\n }\n\n public function getTeamGroups(string $teamUuid): array\n {\n $data = [];\n $team = $this->getTeam($teamUuid);\n\n if ($team !== null) {\n $groups = $team->groups()->get();\n\n foreach ($groups as $group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n public function getTeamsGroupsOptions(array $filterTeamUuids = []): array\n {\n $data = [];\n $teams = $this->getTeams();\n\n foreach ($teams as $team) {\n if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {\n continue;\n }\n\n $data[] = [\n 'label' => $team['name'],\n 'groups' => $this->getTeamGroups($team['id']),\n ];\n }\n\n return $data;\n }\n\n public function getTeam(string $teamUuid): ?Team\n {\n return $this->teamRepository->idOrUuid($teamUuid);\n }\n\n public function getTeamById(int $teamId): ?Team\n {\n return $this->teamRepository->find($teamId);\n }\n\n public function getGroupsUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportGroups = $report->getGroups();\n foreach ($reportGroups as $groupId) {\n if ($group = $this->groupRepository->find($groupId)) {\n $uuids[] = $group->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getPlaybookCategoriesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $playbookCategories = $report->getPlaybookCategories();\n foreach ($playbookCategories as $id) {\n if ($category = $this->playbookCategoryRepository->find($id)) {\n $uuids[] = $category->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getDealAtCallStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getDealAtCallStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getCurrentDealStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getCurrentDealStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getRecipients());\n }\n\n public function getJiminnyUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function extractUserUuids(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => $user->getUuid())\n ->values()\n ->all();\n }\n\n // get mail data\n public function getRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getRecipients());\n }\n\n /**\n * @return array<UserContract>\n */\n public function getRecipientUserObjects(AutomatedReport $report): array\n {\n $userIds = $report->getRecipients()['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->values()\n ->all();\n }\n\n private function getJiminnyRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function buildRecipientUsers(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => [\n 'email' => $user->getEmailAddress(),\n 'name' => $user->getName(),\n 'timezone' => $user->getTimezone()->getName(),\n ])\n ->values()\n ->all();\n }\n\n public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array\n {\n if ($report->isAskJiminnyReport()) {\n $recipients = $this->resolveAskJiminnyRecipients($report);\n } else {\n $recipients = $this->getRecipientUsers($report);\n if ($includeJiminny) {\n $recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));\n }\n }\n\n $emails = [];\n\n return array_values(array_filter(\n $recipients,\n static function ($recipient) use (&$emails) {\n if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {\n return false;\n }\n $emails[] = $recipient['email'];\n\n return true;\n }\n ));\n }\n\n private function resolveAskJiminnyRecipients(AutomatedReport $report): array\n {\n $recipients = [];\n\n $creator = $report->getCreator();\n if ($creator !== null) {\n $recipients[] = [\n 'email' => $creator->getEmailAddress(),\n 'name' => $creator->getName(),\n 'timezone' => $creator->getTimezone()->getName(),\n ];\n }\n\n return array_merge(\n $recipients,\n $this->buildRecipientUsers($report->getRecipients()),\n $this->getGroupRecipientUsers($report),\n );\n }\n\n private function getGroupRecipientUsers(AutomatedReport $report): array\n {\n $users = [];\n foreach ($report->getGroups() as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group === null) {\n continue;\n }\n foreach ($group->getMembers() as $member) {\n $users[] = [\n 'email' => $member->getEmailAddress(),\n 'name' => $member->getName(),\n 'timezone' => $member->getTimezone()->getName(),\n ];\n }\n }\n\n return $users;\n }\n\n public function getReportTypeName(AutomatedReportResult $report): string\n {\n $type = $report->getReport()->getType();\n\n $getType = $this->transformReportType($type);\n\n return $getType['name'];\n }\n\n public function getReportPeriodName(AutomatedReportResult $report): string\n {\n $from = $report->getFromDate();\n $to = $report->getToDate();\n $frequency = $report->getReport()->getFrequency();\n\n if ($from === null || $to === null) {\n if (! $report->getReport()->isAskJiminnyReport()) {\n $invalidPeriod = $from === null ? 'from' : 'to';\n\n throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);\n }\n\n $period = $this->calculateFromAndToDatePeriod($frequency);\n $from = $period['fromDate'];\n $to = $period['toDate'];\n }\n\n return $this->formatReportPeriodName($frequency, $from, $to);\n }\n\n private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string\n {\n $fromYear = $from->format('Y');\n $toYear = $to->format('Y');\n $differentYears = $fromYear !== $toYear;\n\n switch ($frequency) {\n case self::FREQUENCY_DAILY:\n return $from->format('j M Y');\n\n case self::FREQUENCY_QUARTERLY:\n // 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ\n $startMonth = $from->format('M');\n $endMonth = $to->copy()->subMonth();\n $endMonthName = $endMonth->format('M');\n $endMonthYear = $endMonth->format('Y');\n\n if ($differentYears) {\n return \"{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}\";\n }\n\n return \"{$startMonth} - {$endMonthName} {$toYear}\";\n\n case self::FREQUENCY_MONTHLY:\n // 'May 2025' - monthly reports are always within the same year\n return $from->format('M Y');\n\n case self::FREQUENCY_WEEKLY:\n // '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ\n $startDay = $from->format('j');\n $endDay = $to->format('j');\n $startMonth = $from->format('M');\n $endMonth = $to->format('M');\n\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n if ($startMonth !== $endMonth) {\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n return \"{$startDay} - {$endDay} {$endMonth} {$toYear}\";\n\n case self::FREQUENCY_ONE_OFF:\n // '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ\n $startDay = $from->format('j');\n $startMonth = $from->format('M');\n $endDay = $to->format('j');\n $endMonth = $to->format('M');\n\n // If same month and year, use a format like '2-31 May 2025'\n if ($startMonth === $endMonth && ! $differentYears) {\n return \"{$startDay} - {$endDay} {$startMonth} {$toYear}\";\n }\n\n // If different years, include both years\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n // Same year but different months\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n\n default:\n // Default format for unknown frequencies\n return $from->format('j M Y') . ' - ' . $to->format('j M Y');\n }\n }\n\n public function getReportTeamsName(AutomatedReportResult $report): string\n {\n $groups = $report->getGroups();\n\n if (empty($groups)) {\n return 'All';\n }\n\n // Get group names from repository\n $groupNames = [];\n foreach ($groups as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group) {\n $groupNames[] = $group->getName();\n }\n }\n\n if (count($groupNames) === 1) {\n // Single team format\n $teamsName = $groupNames[0];\n } else {\n // Multiple teams format\n $teamsName = implode(', ', $groupNames);\n }\n\n return $teamsName;\n }\n\n public function getReportFileName(AutomatedReportResult $report): string\n {\n $customName = $report->getReport()->getCustomName();\n $periodName = $this->getReportPeriodName($report);\n $filenameSuffix = $this->getFilenameSuffix($report);\n\n if ($customName) {\n if ($filenameSuffix) {\n $customName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$customName} - {$periodName}\");\n }\n\n $baseName = $this->getReportTypeName($report);\n\n if ($filenameSuffix) {\n $baseName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}\");\n }\n\n public function getReportFileNameWithExtension(AutomatedReportResult $result): string\n {\n $extension = $this->getMediaTypeMetadata($result)['extension'];\n\n return $this->getReportFileName($result) . '.' . $extension;\n }\n\n public function sanitizeFileName(string $fileName): string\n {\n return str_replace(['/', '\\\\'], '-', $fileName);\n }\n\n public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool\n {\n $recipients = array_map('intval', $report->getRecipients()['users'] ?? []);\n\n return in_array($user->getId(), $recipients);\n }\n\n public function transformReportResults(Collection $automatedReportResults): array\n {\n $data = [];\n foreach ($automatedReportResults as $automatedReportResult) {\n /** @var AutomatedReportResult $automatedReportResult */\n\n $report = $automatedReportResult->getReport();\n\n $createdBy = $report->getCreator();\n $creator = [\n 'id' => $createdBy?->getUuid(),\n 'name' => $createdBy?->getName(),\n 'email' => $createdBy?->getEmailAddress(),\n 'photoUrl' => $createdBy?->getPhotoUrl(),\n ];\n\n $data[] = [\n 'id' => $automatedReportResult->getUuid(),\n 'name' => $automatedReportResult->getName(),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n 'recipients' => $this->buildRecipients($report),\n 'report_type' => $this->transformReportType($report->getType()),\n 'media_type' => $automatedReportResult->getMediaType(),\n 'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),\n 'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),\n 'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),\n 'creator' => $creator,\n ];\n }\n\n return $data;\n }\n\n private function buildRecipients(AutomatedReport $report): array\n {\n $recipients = array_values($this->transformRecipients($report->getRecipients()));\n\n if (! $report->isAskJiminnyReport()) {\n return $recipients;\n }\n\n return [\n ...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),\n ...$recipients,\n ];\n }\n\n public function hasCallTypeConference(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);\n }\n\n public function hasCallTypeDialer(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);\n }\n\n // transformers\n private function transformTeam(Team $team): array\n {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n return [];\n }\n\n return [\n 'id' => $team->getUuid(),\n 'name' => $team->getName(),\n ];\n }\n\n private function transformReportFullView(AutomatedReport $report): array\n {\n $base = $this->transformReportBase($report);\n\n return $report->getType() === self::TYPE_ASK_JIMINNY\n ? $base + $this->transformAskJiminnyFields($report)\n : $base + $this->transformStandardReportFields($report);\n }\n\n private function transformReportBase(AutomatedReport $report): array\n {\n return [\n 'id' => $report->getUuid(),\n 'organization' => $this->transformOrganization(team: $report->getTeam()),\n 'report_type' => $this->transformReportType($report->getType()),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n ];\n }\n\n private function transformStandardReportFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n\n return [\n 'report_enabled' => $report->getStatus(),\n 'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),\n 'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),\n 'deal_value_min' => $report->getDealValueMin(),\n 'deal_value_max' => $report->getDealValueMax(),\n 'call_types' => $this->transformCallType($report->getCallTypes()),\n 'media_types' => $this->transformMediaTypes($report),\n 'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),\n 'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),\n 'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),\n 'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),\n 'recipients' => $this->transformRecipients($report->getRecipients()),\n 'created_by' => $this->transformCreator($report->getCreator()),\n 'additional_prompt_input' => $report->getAdditionalPromptInput(),\n 'custom_name' => $report->getCustomName(),\n 'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),\n 'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),\n 'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),\n ];\n }\n\n private function transformAskJiminnyFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n $creatorId = $report->getAttribute('created_by');\n $explicitUserIds = array_values(array_filter(\n $report->getRecipients()['users'] ?? [],\n static fn ($id) => $id !== $creatorId\n ));\n\n return [\n 'report_name' => $report->getCustomName(),\n 'enabled' => $report->getStatus(),\n 'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),\n 'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),\n 'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),\n 'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),\n ];\n }\n\n private function transformOrganization(?Team $team): array\n {\n return [\n 'id' => $team?->getUuid(),\n 'name' => $team?->getName(),\n ];\n }\n\n private function transformReportType(string $type): array\n {\n foreach (self::ALL_TYPES as $typeItem) {\n if ($typeItem['id'] === $type) {\n return $typeItem;\n }\n }\n\n return [];\n }\n\n private function transformCallType(array $types): array\n {\n $result = [];\n $callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];\n\n foreach ($types as $type) {\n foreach ($callTypes as $callTypeItem) {\n if ($callTypeItem['id'] === $type) {\n $result[] = $callTypeItem;\n\n break;\n }\n }\n }\n\n return $result;\n }\n\n private function transformMediaTypes(AutomatedReport $report): array\n {\n $values = [];\n\n foreach ($report->getMediaTypes() as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n continue;\n }\n\n $values[] = match ($mediaType) {\n self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,\n self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,\n };\n }\n\n return $values;\n }\n\n private function transformFrequency(string $frequency): array\n {\n foreach (self::ALL_FREQUENCIES as $frequencyItem) {\n if ($frequencyItem['id'] === $frequency) {\n return $frequencyItem;\n }\n }\n\n return [];\n }\n\n public function transformDurationToMinutes(?int $duration): ?int\n {\n if (! $duration) {\n return null;\n }\n\n return (int) ($duration / 60);\n }\n\n private function transformGroups(?Team $team, array $groupsIds): array\n {\n if (empty($groupsIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($groupsIds as $groupId) {\n $group = $team->groups()->where('id', $groupId)->first();\n\n if ($group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n 'photoUrl' => $group->getPhotoUrl(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformStages(?Team $team, array $stagesIds): array\n {\n if (empty($stagesIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($stagesIds as $stageId) {\n $stage = $team->stages()->where('id', $stageId)->first();\n\n if ($stage) {\n $data[] = [\n 'id' => $stage->getUuid(),\n 'name' => $stage->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformRecipients(array $recipients): array\n {\n $users = [];\n foreach ($recipients['users'] ?? [] as $userId) {\n $users[] = $this->transformUser($userId);\n }\n\n return $users;\n }\n\n private function transformCreator(?User $user): ?array\n {\n if ($user === null) {\n return null;\n }\n\n return $this->transformUser($user->getId());\n }\n\n private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array\n {\n if ($prompt === null) {\n return null;\n }\n\n return [\n 'id' => $prompt->getUuid(),\n 'name' => $prompt->getTitle(),\n ];\n }\n\n private function transformSafeSearch(?Search $search): ?array\n {\n if ($search === null) {\n return null;\n }\n\n return [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ];\n }\n\n private function transformUser(int $userId): array\n {\n /* @var ?User $user */\n $user = $this->userRepository->find($userId);\n\n return [\n 'id' => $user?->getUuid(),\n 'name' => $user?->getName(),\n 'email' => $user?->getEmailAddress(),\n 'photoUrl' => $user?->getPhotoUrl(),\n ];\n }\n\n public function create(array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $validatedData['created_by'] = auth()->id();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function update(string $uuid, array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $report = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $report) {\n throw new InvalidArgumentException('Report not found');\n }\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Create an Ask Jiminny report.\n */\n public function createAskJiminnyReport(array $data, User $creator): array\n {\n $validatedData = $this->validateAskJiminnyReportData($data, $creator);\n $validatedData['created_by'] = $creator->getId();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Update an Ask Jiminny report.\n */\n public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array\n {\n if (! $report->isAskJiminnyReport()) {\n throw new InvalidArgumentException('Report is not an Ask Jiminny report');\n }\n\n $validatedData = $this->validateAskJiminnyReportData($data, $user);\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array\n {\n $this->automatedReportsRepository->update($report, ['status' => $status]);\n\n return $this->transformReportFullView($report->fresh());\n }\n\n /**\n * Validate and transform data for Ask Jiminny reports.\n */\n private function validateAskJiminnyReportData(array $data, User $user): array\n {\n // Validate name\n $name = trim($data['report_name'] ?? '');\n if (empty($name)) {\n throw new InvalidArgumentException('Report name is required');\n }\n if (mb_strlen($name) > 50) {\n throw new InvalidArgumentException('Report name must be 50 characters or less');\n }\n\n // Validate frequency (only daily, weekly, monthly for Ask Jiminny)\n $frequency = $data['frequency'] ?? null;\n $askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];\n if (! in_array($frequency, $askJiminnyFrequencies, true)) {\n throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');\n }\n\n // Validate expiration date\n $expiresAt = $data['expires_on'] ?? null;\n if (empty($expiresAt)) {\n throw new InvalidArgumentException('Expiration date is required');\n }\n\n try {\n $expiresAtDate = Carbon::parse($expiresAt);\n } catch (InvalidFormatException $e) {\n throw new InvalidArgumentException('Expiration date format is invalid');\n }\n $maxExpiration = Carbon::now()->addYear()->endOfDay();\n if ($expiresAtDate->gt($maxExpiration)) {\n throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');\n }\n if ($expiresAtDate->isPast()) {\n throw new InvalidArgumentException('Expiration date cannot be in the past');\n }\n\n // Validate saved search\n $activitySearchId = $data['saved_search'] ?? null;\n if (empty($activitySearchId)) {\n throw new InvalidArgumentException('Saved search is required');\n }\n $savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);\n if (! $savedSearch) {\n throw new InvalidArgumentException('Saved search not found or does not belong to you');\n }\n\n // Validate saved prompt\n $askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;\n if (empty($askAnythingPromptId)) {\n throw new InvalidArgumentException('Ask Jiminny prompt is required');\n }\n $prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);\n if (! $prompt) {\n throw new InvalidArgumentException('Ask Jiminny prompt not found');\n }\n\n // Validate status\n $status = $data['enabled'] ?? false;\n\n $recipientUserIds = [$user->getId()];\n\n if (! empty($data['share_users'])) {\n $sharedUserIds = $this->validateAndGetUserIdsByTeam(\n $user->team,\n (array) $data['share_users']\n );\n $recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);\n }\n\n $sharedGroupIds = [];\n if (! empty($data['share_teams'])) {\n $sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);\n }\n\n $recipientUserIds = array_values(array_unique($recipientUserIds));\n\n return [\n 'team_id' => $user->getTeamId(),\n 'type' => self::TYPE_ASK_JIMINNY,\n 'status' => (bool) $status,\n 'frequency' => $frequency,\n 'custom_name' => $name,\n 'activity_search_id' => $savedSearch->getId(),\n 'ask_anything_prompt_id' => $prompt->getId(),\n 'expires_at' => $expiresAtDate->toDateString(),\n 'media_types' => [self::MEDIA_TYPE_PDF],\n 'call_types' => [],\n 'recipients' => ['users' => $recipientUserIds],\n 'groups' => $sharedGroupIds,\n ];\n }\n\n public static function getAskJiminnyFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::ASK_JIMINNY_FREQUENCIES);\n }\n\n public function getAskJiminnyReportFilters(User $user): array\n {\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n return [\n [\n 'id' => 'prompt',\n 'label' => 'Prompt',\n 'options' => $prompts,\n ],\n [\n 'id' => 'saved_search',\n 'label' => 'Saved Search',\n 'options' => $savedSearches,\n ],\n ];\n }\n\n public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array\n {\n $team = $user->getTeam();\n $userTimezone = $user->getTimezone();\n\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n $teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ])->values()->all();\n\n $shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];\n\n $sharedTeamsValue = [];\n $sharedUsersValue = [];\n if ($report) {\n $sharedTeamsValue = $this->transformGroups($team, $report->getGroups());\n\n $recipientUserIds = $report->getRecipients()['users'] ?? [];\n $creatorId = $report->getAttribute('created_by');\n $sharedUserIds = array_values(array_filter(\n $recipientUserIds,\n static fn ($id) => $id !== $creatorId\n ));\n $sharedUsersValue = collect($sharedUserIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (User $u) => [\n 'id' => $u->getUuid(),\n 'name' => $u->getName(),\n ])\n ->values()\n ->all();\n }\n\n return [\n 'fields' => [\n [\n 'id' => 'enabled',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'label' => '',\n 'value' => $report?->getStatus() ?? false,\n ],\n [\n 'id' => 'report_name',\n 'inputType' => InputTypeEnum::TEXT,\n 'label' => 'Name',\n 'placeholder' => 'Enter name',\n 'required' => true,\n 'validation' => ['maxLength' => 50],\n 'value' => $report?->getCustomName() ?? '',\n ],\n [\n 'id' => 'frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Frequency',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::ASK_JIMINNY_FREQUENCIES,\n 'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,\n ],\n [\n 'id' => 'expires_on',\n 'inputType' => InputTypeEnum::DATE,\n 'label' => 'Expires on',\n 'required' => true,\n 'placeholder' => 'Select',\n 'validation' => [\n 'minDate' => now($userTimezone)->toDateString(),\n 'maxDate' => now($userTimezone)->addYear()->toDateString(),\n ],\n 'value' => $report?->getExpiresAt()?->toDateString(),\n ],\n [\n 'id' => 'share_teams',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team',\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $teamGroups,\n 'value' => $sharedTeamsValue,\n ],\n [\n 'id' => 'share_users',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team member',\n 'required' => false,\n 'placeholder' => 'Select',\n 'groupLabelKey' => 'label',\n 'groupValuesKey' => 'users',\n 'optionLabelKey' => 'name',\n 'optionValueKey' => 'id',\n 'options' => $shareUsers,\n 'value' => $sharedUsersValue,\n ],\n [\n 'id' => 'saved_search',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Saved search',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $savedSearches,\n 'value' => $report && $report->getSavedSearch() ? [\n 'id' => $report->getSavedSearch()->getUuid(),\n 'name' => $report->getSavedSearch()->getName(),\n ] : null,\n ],\n [\n 'id' => 'ask_jiminny_prompt',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Ask Jiminny prompt',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $prompts,\n 'value' => $report && $report->getAskAnythingPrompt() ? [\n 'id' => $report->getAskAnythingPrompt()->getUuid(),\n 'name' => $report->getAskAnythingPrompt()->getTitle(),\n ] : null,\n ],\n ],\n ];\n }\n\n private function updateResultNames(AutomatedReport $automatedReport): void\n {\n $results = $this->automatedReportsRepository->getResultsByReport($automatedReport);\n\n foreach ($results as $result) {\n $result->update(['name' => $this->getReportFileName($result)]);\n }\n }\n\n public function updateStatus(string $uuid, array $data): array\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $automatedReport->update([\n 'status' => $status,\n ]);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n private function generateOneOffReport(AutomatedReport $automatedReport): void\n {\n // the scheduler handles all the other frequency types\n if ($automatedReport->getStatus() === false || $automatedReport->getFrequency() !== self::FREQUENCY_ONE_OFF) {\n return;\n }\n\n $this->dispatcher->dispatch(new RequestGenerateReportJob($automatedReport->getUuid()));\n }\n\n public function getReport(string $uuid): AutomatedReport\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n return $automatedReport;\n }\n\n public function get(string $uuid): array\n {\n $automatedReport = $this->getReport($uuid);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function list(string $sortColumn = 'created_at', string $sortDirection = 'desc'): array\n {\n $results = [];\n $collection = $this->automatedReportsRepository->getAllStandardReports($sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function listAskJiminnyReports(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): array {\n $results = [];\n $collection = $this->automatedReportsRepository->getAskJiminnyReportsByUser($user, $sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function delete(string $uuid): void\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $automatedReport->delete();\n }\n\n public function createReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n return $this->automatedReportsRepository->createResult(\n array_merge(\n [\n 'report_id' => $automatedReport->getId(),\n 'status' => AutomatedReportResult::STATUS_DEFAULT,\n ],\n $data\n )\n );\n }\n\n public function getOrCreateReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n $existing = $this->automatedReportsRepository->findLatestDefaultOrFailedResult($automatedReport);\n\n if ($existing !== null) {\n $existing->update(['status' => AutomatedReportResult::STATUS_DEFAULT]);\n\n return $existing;\n }\n\n return $this->createReportResult($automatedReport, $data);\n }\n\n public function getReportResult(string $resultUuid): AutomatedReportResult\n {\n $report = $this->automatedReportsRepository->findResultByUuid($resultUuid);\n\n if (! $report) {\n throw new ModelNotFoundException('Report Result not found');\n }\n\n return $report;\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return $this->automatedReportsRepository->findChildResult($result, $type);\n }\n\n // prophet API calls\n /**\n * @throws ApplicationException\n */\n public function getGenerateReportPayload(AutomatedReport $automatedReport, string $reportResultUuid): array\n {\n $period = $this->calculateFromAndToDate($automatedReport);\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n return [\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResultUuid,\n 'report_type' => $automatedReport->getType(),\n 'media_types' => $automatedReport->getMediaTypes(),\n 'from_date' => $fromDate->startOfDay()->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->endOfDay()->format(DateTimeInterface::RFC3339),\n 'group_ids' => $automatedReport->getGroups(),\n 'call_deal_stage' => $automatedReport->getDealAtCallStages(),\n 'current_deal_stage' => $automatedReport->getCurrentDealStages(),\n 'deal_min_value' => $automatedReport->getDealValueMin(),\n 'deal_max_value' => $automatedReport->getDealValueMax(),\n 'call_types' => $automatedReport->getCallTypes(),\n 'call_duration_min_seconds' => $automatedReport->getCallDurationMin(),\n 'call_duration_max_seconds' => $automatedReport->getCallDurationMax(),\n 'special_requirements' => $automatedReport->getAdditionalPromptInput(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->formatReportPeriodName(\n $automatedReport->getFrequency(),\n $fromDate,\n $toDate,\n ),\n 'playbook_categories' => $automatedReport->getPlaybookCategories(),\n 'custom_name' => $automatedReport->getCustomName(),\n ];\n }\n\n // $inputPayload - FE payload structure\n public function getActivitiesCountPayload(array $inputPayload): array\n {\n // Use validateAndTransformData to validate and normalize input\n $validatedData = $this->validateAndTransformData($inputPayload);\n $period = $this->calculateFromAndToDatePeriod(\n $validatedData['frequency'],\n Carbon::parse($validatedData['from']),\n Carbon::parse($validatedData['to']),\n );\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n // Create payload similar to getGenerateReportPayload\n return [\n 'team_id' => $validatedData['team_id'],\n 'group_ids' => $validatedData['groups'] ?? [],\n 'report_type' => $validatedData['type'],\n 'from_date' => $fromDate->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->format(DateTimeInterface::RFC3339),\n 'call_deal_stage' => $validatedData['deal_at_call_stages'] ?? [],\n 'current_deal_stage' => $validatedData['current_deal_stages'] ?? [],\n 'deal_min_value' => $validatedData['deal_value_min'] ?? null,\n 'deal_max_value' => $validatedData['deal_value_max'] ?? null,\n 'call_types' => $validatedData['call_types'],\n 'call_duration_min_seconds' => $validatedData['call_duration_min'] ?? null,\n 'call_duration_max_seconds' => $validatedData['call_duration_max'] ?? null,\n 'special_requirements' => $validatedData['additional_prompt_input'] ?? null,\n 'playbook_categories' => $validatedData['playbook_categories'] ?? [],\n 'request_id' => null,\n 'callback_url' => null,\n ];\n }\n\n public function shouldSendReport(array $users, ?CarbonInterface $generatedAt = null): bool\n {\n if (empty($users)) {\n return false;\n }\n\n $earliestTz = collect($users)\n ->mapWithKeys(function (array $user) {\n $tz = new DateTimeZone($user['timezone']);\n $nowUtc = new DateTime('now', new DateTimeZone('UTC'));\n $offset = $tz->getOffset($nowUtc);\n\n return [$user['timezone'] => $offset];\n })\n ->sortDesc()\n ->keys()\n ->first();\n\n $now = Carbon::now($earliestTz);\n $isScheduledTime = (int) $now->format('H') === self::SENT_REPORT_AT_HOURS;\n\n if ($isScheduledTime) {\n return true;\n }\n\n return $this->hasPassedScheduledTime($generatedAt, $earliestTz);\n }\n\n public function hasPassedScheduledTime(?CarbonInterface $generatedAt, string $timezone): bool\n {\n if ($generatedAt === null) {\n return false;\n }\n\n $now = Carbon::now($timezone);\n $scheduledTime = $now->copy()->setTime(self::SENT_REPORT_AT_HOURS, 0, 0);\n\n if ($now->hour < self::SENT_REPORT_AT_HOURS) {\n $scheduledTime = $scheduledTime->subDay();\n }\n\n $scheduledTimeUtc = $scheduledTime->copy()->utc();\n $generatedAtUtc = $generatedAt->copy()->utc();\n $nowUtc = $now->copy()->utc();\n\n return $generatedAtUtc->lt($scheduledTimeUtc) && $nowUtc->gt($scheduledTimeUtc);\n }\n\n public function calculateFromAndToDatePeriod(\n string $frequency,\n ?Carbon $fromDate = null,\n ?Carbon $toDate = null\n ): array {\n if ($frequency === self::FREQUENCY_ONE_OFF) {\n return [\n 'fromDate' => $fromDate,\n 'toDate' => $toDate,\n ];\n }\n\n $now = Carbon::now();\n\n return match ($frequency) {\n self::FREQUENCY_DAILY => [\n 'fromDate' => $now->copy()->subDay()->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_WEEKLY => [\n 'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_MONTHLY => [\n 'fromDate' => $now->copy()->subMonths(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_QUARTERLY => [\n 'fromDate' => $now->copy()->subMonths(3)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n default => throw new InvalidArgumentException(\"Unsupported frequency: {$frequency}\"),\n };\n }\n\n private function calculateFromAndToDate(AutomatedReport $automatedReport): array\n {\n return $this->calculateFromAndToDatePeriod(\n $automatedReport->getFrequency(),\n $automatedReport->getFrom(),\n $automatedReport->getTo()\n );\n }\n\n public function getAskJiminnyGenerateReportPayload(\n AutomatedReport $automatedReport,\n AutomatedReportResult $reportResult,\n array $activityIds,\n ): array {\n return [\n 'user_question' => $automatedReport->getAskAnythingPrompt()?->getContent(),\n 'call_ids' => array_map('strval', $activityIds),\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResult->getUuid(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->getReportPeriodName($reportResult),\n 'report_name' => $automatedReport->getCustomName(),\n ];\n }\n\n private function getCallbackUrl(): string\n {\n return $this->webhookService->route('jiminny.webhook.reports.ready');\n }\n\n /**\n * Validate and transform payload data for automated reports\n *\n * @param array $data\n *\n * @throws InvalidArgumentException\n *\n * @return array\n */\n private function validateAndTransformData(array $data): array\n {\n // Validate organization (team) and check feature\n $team = $this->validateOrganization($data['organization'] ?? null);\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $type = $this->validateReportType($data['report_type'] ?? null);\n $frequency = $this->validateFrequency($data['frequency'] ?? null);\n $additionalPromptInput = $this->validateAdditionalPromptInput(\n $data['additional_prompt_input'] ?? null\n );\n $customReportName = $this->validateCustomReportName($data['custom_name'] ?? null);\n\n // Prepare data for the database\n $reportData = [\n 'team_id' => $team->getId(),\n 'type' => $type,\n 'status' => $status,\n 'frequency' => $frequency,\n 'additional_prompt_input' => $additionalPromptInput,\n 'custom_name' => $customReportName,\n ];\n\n // Validate deal values\n $reportData = $this->validateDealValues($data, $reportData);\n\n // Validate date range\n $reportData = $this->validateDateRange($data, $reportData, $frequency);\n\n // Validate call durations\n $reportData = $this->validateCallDurations($data, $reportData);\n\n // Validate call types\n $reportData = $this->validateCallTypes($data, $reportData);\n\n // Validate media types\n $reportData = $this->validateMediaTypes($data, $reportData);\n\n // Validate groups\n if (isset($data['teams'])) {\n $reportData['groups'] = $this->validateAndGetGroupIds($team, $data['teams']);\n }\n\n // Validate deal stages\n $reportData = $this->validateDealStages($data, $reportData, $team, $type);\n\n // Validate playbook categories\n $reportData = $this->validatePlaybookCategories($data, $reportData, $team);\n\n // Validate recipients\n $reportData['recipients'] = [\n 'users' => $this->validateAndGetUserIdsByTeam($team, $data['recipients'] ?? []),\n ];\n\n if (isset($data['jiminny_recipients'])) {\n // Validate Jiminny recipients\n $reportData['jiminny_recipients'] = [\n 'users' => $this->validateAndGetJiminnyUserIds((array) $data['jiminny_recipients']),\n ];\n }\n\n return $reportData;\n }\n\n private function validateDealValues(array $data, array $reportData): array\n {\n if (isset($data['min_deal_value'])) {\n $reportData['deal_value_min'] = (int) $data['min_deal_value'];\n\n if ($reportData['deal_value_min'] > 4294967295 || $reportData['deal_value_min'] < 0) {\n throw new InvalidArgumentException('Min deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_deal_value'])) {\n $reportData['deal_value_max'] = (int) $data['max_deal_value'];\n\n if ($reportData['deal_value_max'] > 4294967295 || $reportData['deal_value_max'] < 0) {\n throw new InvalidArgumentException('Max deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['min_deal_value'], $data['max_deal_value'])\n && $data['min_deal_value'] > $data['max_deal_value']\n ) {\n throw new InvalidArgumentException('Min deal value cannot be greater than max deal value');\n }\n\n return $reportData;\n }\n\n private function validateDateRange(array $data, array $reportData, string $frequency): array\n {\n // Set date range only for one_off frequency\n if ($frequency === 'one_off') {\n if (isset($data['start_date_period'])) {\n $reportData['from'] = $this->parseDate($data['start_date_period']);\n }\n\n if (isset($data['end_date_period'])) {\n $reportData['to'] = $this->parseDate($data['end_date_period']);\n }\n\n if (empty($reportData['from']) || empty($reportData['to'])) {\n throw new InvalidArgumentException(\n 'Start date and end date are required for one_off frequency'\n );\n }\n } else {\n $reportData['from'] = null;\n $reportData['to'] = null;\n }\n\n return $reportData;\n }\n\n private function validateCallDurations(array $data, array $reportData): array\n {\n // Convert call durations from minutes to seconds\n if (isset($data['min_call_duration'])) {\n $reportData['call_duration_min'] = (int) $data['min_call_duration'] * 60;\n\n if ($reportData['call_duration_min'] > 4294967295 || $reportData['call_duration_min'] < 0) {\n throw new InvalidArgumentException('Min call duration should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_call_duration'])) {\n $reportData['call_duration_max'] = (int) $data['max_call_duration'] * 60;\n\n if ($reportData['call_duration_max'] > 4294967295 || $reportData['call_duration_max'] < 0) {\n throw new InvalidArgumentException('Max call duration should be between 0 and 4294967295');\n }\n }\n\n return $reportData;\n }\n\n private function validateCallTypes(array $data, array $reportData): array\n {\n // Set call types\n $reportData['call_types'] = $data['call_type'] ?? [];\n if (empty($reportData['call_types'])) {\n $reportData['call_types'] = self::getCallTypes();\n }\n\n foreach ($reportData['call_types'] as $callType) {\n if (! in_array($callType, self::getCallTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Call type %s is invalid', $callType));\n }\n }\n\n return $reportData;\n }\n\n private function validateMediaTypes(array $data, array $reportData): array\n {\n // Set media types from input data\n $reportData['media_types'] = $data['media_types'] ?? [];\n\n if (empty($reportData['media_types'])) {\n throw new InvalidArgumentException('Media types are required');\n }\n\n foreach ($reportData['media_types'] as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n throw new InvalidArgumentException(sprintf('Media type %s is invalid', $mediaType));\n }\n }\n\n return $reportData;\n }\n\n private function validateDealStages(array $data, array $reportData, Team $team, string $reportType): array\n {\n // Validate and set deal stages\n if (isset($data['deal_stage_at_call'])) {\n $reportData['deal_at_call_stages'] =\n $this->validateAndGetDealStageIds($team, $data['deal_stage_at_call'], 'Deal stage at call');\n }\n\n if (isset($data['current_deal_stage'])) {\n $reportData['current_deal_stages'] =\n $this->validateAndGetDealStageIds($team, $data['current_deal_stage'], 'Current deal stage');\n }\n\n // Ensure current_deal_stage is not provided for loss_analysis report type\n if ($reportType === self::TYPE_LOSS_ANALYSIS && ! empty($data['current_deal_stage'])) {\n throw new InvalidArgumentException('Current deal stage is not applicable for Loss Analysis reports');\n }\n\n return $reportData;\n }\n\n // transform uuid to id\n private function validatePlaybookCategories(array $data, array $reportData, Team $team): array\n {\n $key = 'playbook_categories';\n\n if (isset($data[$key])) {\n $payloadIds = $data[$key];\n $ids = [];\n\n foreach ($payloadIds as $uuid) {\n $uuid = (string) $uuid;\n\n try {\n $playbookCategory = $this->playbookCategoryRepository->findByUuid($uuid);\n } catch (Throwable $throwable) {\n Log::error(__METHOD__ . ' ' . $throwable->getMessage());\n\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory) {\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory->hasPlaybook()) {\n throw new InvalidArgumentException(sprintf('Playbook category %s has no playbook', $uuid));\n }\n\n if ($playbookCategory->getPlaybook()->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Playbook category %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $ids[] = $playbookCategory->getId();\n }\n\n $reportData[$key] = $ids;\n }\n\n return $reportData;\n }\n\n private function validateReportStatus($status): bool\n {\n if (! in_array($status, [true, false], true)) {\n throw new InvalidArgumentException('Report status is invalid');\n }\n\n return $status;\n }\n\n private function validateReportType($type): string\n {\n if (! in_array($type, self::getTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Report type is invalid: %s', $type));\n }\n\n return $type;\n }\n\n private function validateFrequency($frequency): string\n {\n if (! in_array($frequency, self::getFrequencies(), true)) {\n throw new InvalidArgumentException('Frequency is invalid');\n }\n\n return $frequency;\n }\n\n private function validateAdditionalPromptInput(?string $additionalPromptInput): ?string\n {\n if ($additionalPromptInput && strlen($additionalPromptInput) > 5000) {\n throw new InvalidArgumentException('Additional Prompt Input should be less than 5000 characters');\n }\n\n return $additionalPromptInput;\n }\n\n private function validateCustomReportName(?string $customReportName): ?string\n {\n if ($customReportName === null || $customReportName === '') {\n return null;\n }\n\n if (strlen($customReportName) > 70) {\n throw new InvalidArgumentException('Custom report name should be less than 70 characters');\n }\n\n return $customReportName;\n }\n\n private function validateOrganization(?string $organizationUuid): Team\n {\n if (! $organizationUuid) {\n throw new InvalidArgumentException('Organization is required');\n }\n\n $team = $this->teamRepository->idOrUuid($organizationUuid);\n\n if (! $team) {\n throw new InvalidArgumentException('Organization not found');\n }\n\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n throw new InvalidArgumentException('Organization does not have the Automated Reports feature');\n }\n\n return $team;\n }\n\n private function validateAndGetGroupIds(Team $team, array $teamUuids): array\n {\n $groupIds = [];\n\n foreach ($teamUuids as $uuid) {\n $group = $this->groupRepository->findByUuid($uuid);\n\n if ($group === null || $group->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Group %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $groupIds[] = $group->getId();\n\n }\n\n return $groupIds;\n }\n\n private function validateAndGetDealStageIds(Team $team, array $stageUuids, string $propertyLabel): array\n {\n $stageIds = [];\n\n foreach ($stageUuids as $uuid) {\n $stage = $this->stageRepository->findByUuid($uuid);\n\n if ($stage === null || $stage->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Stage %s not found for team %s for %s', $uuid, $team->getUuid(), $propertyLabel)\n );\n }\n\n $stageIds[] = $stage->getId();\n }\n\n return $stageIds;\n }\n\n private function validateAndGetUserIds(array $userUuids, callable $teamCheck): array\n {\n if (empty($userUuids)) {\n return [];\n }\n\n $userIds = [];\n\n foreach ($userUuids as $uuid) {\n $user = $this->userRepository->findByUuid($uuid);\n\n if (! $user || ! $user->isStatusActive()) {\n throw new InvalidArgumentException(\n sprintf('User %s not found or is not active', $uuid)\n );\n }\n\n if (! $teamCheck($user)) {\n throw new InvalidArgumentException(\n sprintf('User %s does not belong to the allowed team(s)', $uuid)\n );\n }\n\n $userIds[] = $user->getId();\n }\n\n return $userIds;\n }\n\n private function validateAndGetUserIdsByTeam(Team $team, array $userUuids): array\n {\n return $this->validateAndGetUserIds($userUuids, fn ($user) => $user->getTeamId() === $team->getId());\n }\n\n private function validateAndGetJiminnyUserIds(array $userUuids): array\n {\n $allowedTeamIds = config('kiosk.teamIds', []);\n\n return $this->validateAndGetUserIds($userUuids, fn ($user) => in_array($user->getTeamId(), $allowedTeamIds, true));\n }\n\n private function parseDate(string $dateString): string\n {\n return date('Y-m-d H:i:s', strtotime($dateString));\n }\n\n private function generateReportResultViewUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.view', ['uuid' => $result->getUuid()]);\n }\n\n private function generateReportResultDownloadUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.download', ['uuid' => $result->getUuid()]);\n }\n\n private function getReportMediaRouteResource(AutomatedReportResult $result): string\n {\n if ($result->getMediaType() === self::MEDIA_TYPE_PDF) {\n return self::PDF_KEY;\n } elseif ($result->getMediaType() === self::MEDIA_TYPE_PODCAST) {\n return self::AUDIO_KEY;\n }\n\n throw new \\InvalidArgumentException('Unknown media type.');\n }\n\n public function getMediaPath(AutomatedReportResult $result): ?string\n {\n $url = match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => $result->getPdfUrl(),\n self::MEDIA_TYPE_PODCAST => $result->getPodcastAudioUrl(),\n default => null,\n };\n\n if ($url === null) {\n return null;\n }\n\n $path = parse_url(trim($url, '\"\\''), PHP_URL_PATH);\n\n return $path ?: null;\n }\n\n public function getFilenameSuffix(AutomatedReportResult $result): ?string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => 'Podcast',\n default => null,\n };\n }\n\n public function getMailSubjectSuffix(AutomatedReportResult $result): string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => 'report',\n self::MEDIA_TYPE_PODCAST => 'podcast',\n default => '',\n };\n }\n\n public function getMediaTypeMetadata(AutomatedReportResult $result): array\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => ['extension' => 'mp3', 'mime' => 'audio/mpeg'],\n self::MEDIA_TYPE_PDF => ['extension' => 'pdf', 'mime' => 'application/pdf'],\n default => ['extension' => null, 'mime' => null],\n };\n }\n\n public function deleteS3Files(AutomatedReportResult $result): void\n {\n $teamUuid = $result->getReport()->getTeam()->getUuid();\n $reportUuid = $result->getUuid();\n\n // delete all files for a report uuid no mather of pdf, podcast, or both\n // in case of both - the podcast files are linked to the pdf (parent) uuid\n // pdf and podcast date times should be close\n $path = sprintf('%s/%s/%s', $teamUuid, self::S3_DIR, $reportUuid);\n\n foreach (self::FILE_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted S3 file', [\n 'path' => $file,\n ]);\n }\n }\n\n foreach (self::FILE_PODCAST_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '_podcast.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted Podcast S3 file', [\n 'path' => $file,\n ]);\n }\n }\n }\n\n /**\n *\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): Collection\n {\n return $this->automatedReportsRepository->getTeamIdsWithReportsResults($teamId);\n }\n\n /**\n * Core delete logic for report results using a query\n *\n * @param Builder $query\n * @param array $logContext\n *\n * @return int\n */\n private function deleteReportResultsByQuery(Builder $query, array $logContext = []): int\n {\n $deletedCount = 0;\n\n if ($query->exists()) {\n Log::info(\n 'Run delete report results',\n array_merge(\n $logContext,\n [\n 'service' => 'AutomatedReportsService',\n ]\n )\n );\n\n $query->chunkById(50, function ($results) use (&$deletedCount, $logContext) {\n foreach ($results as $result) {\n $this->deleteReportResult($result);\n $deletedCount++;\n\n Log::info(\n 'Deleted a report result',\n array_merge(\n $logContext,\n [\n 'result_id' => $result->getId(),\n 'report_id' => $result->getReportId(),\n ]\n )\n );\n }\n });\n }\n\n return $deletedCount;\n }\n\n /**\n * Delete report results for a team by retention period\n *\n * @param Team $team\n * @param CarbonImmutable $retentionDate\n *\n * @return int Number of deleted report results\n */\n public function deleteReportsResultsInRetentionPeriod(Team $team, CarbonImmutable $retentionDate): int\n {\n $reportIds = $this->automatedReportsRepository->getReportIdsByTeam($team);\n\n if ($reportIds->isEmpty()) {\n return 0;\n }\n\n $query = $this->automatedReportsRepository\n ->getReportResultsQueryForRetention($team, $retentionDate);\n\n return $this->deleteReportResultsByQuery($query, [\n 'team_id' => $team->getId(),\n 'retention_date' => $retentionDate->toDateTimeString(),\n ]);\n }\n\n /**\n * Delete ALL report results for a specific automated report\n *\n * @param string $uuid\n *\n * @return int\n */\n public function deleteReportResults(string $uuid): int\n {\n $report = $this->getReport($uuid);\n\n $query = $this->automatedReportsRepository->getResultsByReportQuery($report);\n\n return $this->deleteReportResultsByQuery($query, [\n 'report_uuid' => $uuid,\n 'report_id' => $report->getId(),\n ]);\n }\n\n public function deleteReportResult(AutomatedReportResult $result): void\n {\n $this->deleteS3Files($result);\n\n $result->delete();\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getTeamReports(Team $team): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getReportsByTeam($team);\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getReportResults(AutomatedReport $report): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getResultsByReport($report);\n }\n\n public function deleteAllReportResults(AutomatedReport $report): void\n {\n $results = $this->getReportResults($report);\n\n /** @var AutomatedReportResult $result */\n foreach ($results as $result) {\n Log::info('Deleting result', [\n 'report' => $report->getId(),\n 'result' => $result->getId(),\n ]);\n\n $this->deleteReportResult($result);\n }\n }\n\n public function deleteAllData(Team $team): void\n {\n Log::info('Deleting automated report and results for team', [\n 'team' => $team->getId(),\n ]);\n\n $reports = $this->getTeamReports($team);\n\n /** @var AutomatedReport $report */\n foreach ($reports as $report) {\n Log::info('Deleting report', [\n 'team' => $team->getId(),\n 'report' => $report->getId(),\n ]);\n\n $this->deleteAllReportResults($report);\n\n $report->delete();\n }\n }\n}","depth":4,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Kiosk\\AutomatedReports;\n\nuse Carbon\\CarbonImmutable;\nuse Carbon\\CarbonInterface;\nuse Carbon\\Exceptions\\InvalidFormatException;\nuse DateTime;\nuse DateTimeInterface;\nuse DateTimeZone;\nuse Illuminate\\Contracts\\Bus\\Dispatcher as BusDispatcher;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Support\\Facades\\Log;\nuse Illuminate\\Support\\Facades\\Storage;\nuse Jiminny\\Component\\ActivitySearch\\FilterDefinition\\InputTypeEnum;\nuse Jiminny\\Component\\AskAnything\\AskAnythingPromptService;\nuse Jiminny\\Component\\AskAnything\\Dtos\\AskAnythingPromptDto;\nuse Jiminny\\Component\\UrlGenerator\\Webhook;\nuse Jiminny\\Contracts\\Repositories\\PlaybookCategoryRepository;\nuse Jiminny\\Contracts\\Repositories\\TeamRepository;\nuse Jiminny\\Contracts\\Repositories\\UserRepository;\nuse Jiminny\\Exceptions\\ApplicationException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Exceptions\\ModelNotFoundException;\nuse Jiminny\\Jobs\\AutomatedReports\\RequestGenerateReportJob;\nuse Jiminny\\Models\\Activity\\Search;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPrompt;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPromptTarget;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Contracts\\UserContract;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Repositories\\AskAnythingRepository;\nuse Jiminny\\Repositories\\AutomatedReportsRepository;\nuse Jiminny\\Repositories\\GroupRepository;\nuse Jiminny\\Repositories\\SearchRepository;\nuse Jiminny\\Repositories\\StageRepository;\nuse Throwable;\n\nclass AutomatedReportsService\n{\n public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';\n public const string TYPE_ASK_JIMINNY = 'ask_jiminny';\n\n /**\n * Standard report types (used by kiosk for existing automated reports).\n */\n // @TODO this will add filter, however if we need to control feature by FF we need conditional logic\n public const array TYPES = [\n ['id' => 'exec_summary', 'name' => 'Exec Summary'],\n ['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],\n ['id' => 'product_feedback', 'name' => 'Product Feedback'],\n ['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],\n// ['id' => 'questions', 'name' => 'Questions'],\n// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],\n ];\n\n public const array ALL_TYPES = [\n ...self::TYPES,\n ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],\n ];\n\n public const string FREQUENCY_DAILY = 'daily';\n public const string FREQUENCY_WEEKLY = 'weekly';\n public const string FREQUENCY_MONTHLY = 'monthly';\n public const string FREQUENCY_QUARTERLY = 'quarterly';\n public const string FREQUENCY_ONE_OFF = 'one_off';\n\n /**\n * Frequencies for standard (non-Ask Jiminny) reports.\n */\n public const array FREQUENCIES = [\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n\n /**\n * Frequencies for Ask Jiminny reports.\n */\n public const array ASK_JIMINNY_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ];\n\n public const string MEDIA_TYPE_PDF = 'pdf';\n public const string MEDIA_TYPE_PODCAST = 'podcast';\n public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];\n public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];\n public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];\n public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];\n\n public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];\n public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];\n public const int SENT_REPORT_AT_HOURS = 5;\n public const string PDF_KEY = 'pdf';\n public const string AUDIO_KEY = 'audio';\n\n private const array ALL_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n private const string S3_DIR = 'reports';\n private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];\n private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];\n\n public function __construct(\n private readonly TeamRepository $teamRepository,\n private readonly GroupRepository $groupRepository,\n private readonly UserRepository $userRepository,\n private readonly StageRepository $stageRepository,\n private readonly DealStagesService $dealStagesService,\n private readonly RecipientsService $recipientsService,\n private readonly AutomatedReportsRepository $automatedReportsRepository,\n private readonly Webhook $webhookService,\n private readonly BusDispatcher $dispatcher,\n private readonly ActivityTypeService $activityTypeService,\n private readonly PlaybookCategoryRepository $playbookCategoryRepository,\n private readonly AskAnythingPromptService $askAnythingPromptService,\n private readonly SearchRepository $activitySearchRepository,\n private readonly AskAnythingRepository $askAnythingRepository,\n ) {\n }\n\n public static function getTypes(): array\n {\n $types = self::TYPES;\n\n return array_map(static function ($type) {\n return $type['id'];\n }, $types);\n }\n\n public static function getCallTypes(): array\n {\n return array_map(static function ($callType) {\n return $callType['id'];\n }, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);\n }\n\n public static function getFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::FREQUENCIES);\n }\n\n // front-facing structure\n public function getReportEnabledFieldData(bool $value = false): array\n {\n return [\n 'id' => 'report_enabled',\n 'label' => '',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'value' => $value,\n ];\n }\n\n // Organizations = Teams\n public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array\n {\n $options = $this->getTeams();\n\n if ($shortVersion) {\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value,\n 'dependencies' => [\n 'teams',\n 'deal_stage_at_call',\n 'current_deal_stage',\n 'recipients',\n ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,\n ],\n 'dependsOn' => [],\n ];\n }\n\n // Teams = Groups\n public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array\n {\n if ($shortVersion) {\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value, // value should be an array of objects {id, name}\n 'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],\n 'dependsOn' => [],\n ];\n }\n\n public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array\n {\n $types = [];\n if ($team instanceof Team) {\n if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n $types = self::TYPES;\n }\n if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {\n $types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];\n }\n } else {\n $types = self::TYPES;\n }\n\n if ($shortVersion) {\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'options' => $types,\n ];\n }\n\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $types,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getFrequencyFieldData(?string $value = null): array\n {\n return [\n 'id' => 'frequency',\n 'label' => 'Frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::FREQUENCIES,\n 'value' => $value,\n 'dependencies' => ['period'],\n 'dependsOn' => [],\n ];\n }\n\n public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array\n {\n return [\n 'id' => 'period',\n 'label' => 'Select one-off period',\n 'inputType' => InputTypeEnum::DATE_RANGE,\n 'required' => true,\n 'placeholder' => 'Select',\n 'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],\n 'queryParams' => [\n 'startDate' => 'start_date_period',\n 'endDate' => 'end_date_period',\n ],\n 'dependencies' => [],\n 'dependsOn' => ['frequency'],\n ];\n }\n\n public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array\n {\n return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);\n }\n\n public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);\n }\n\n public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);\n }\n\n public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'deal_value',\n 'label' => 'Deal Value',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_deal_value',\n 'max' => 'max_deal_value',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array\n {\n $value = [];\n $conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;\n $dialerOn && $value[] = self::CALL_TYPE_DIALER;\n\n return [\n 'id' => 'call_type',\n 'label' => 'Call Type',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => [\n self::CALL_TYPE_CONFERENCE,\n self::CALL_TYPE_DIALER,\n ],\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getMediaTypeFieldData(?AutomatedReport $report = null): array\n {\n $value = [];\n\n if ($report) {\n $value = $this->transformMediaTypes($report);\n }\n\n return [\n 'id' => 'media_types',\n 'label' => 'Export as',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => self::MEDIA_TYPE_OBJECTS,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'call_duration',\n 'label' => 'Call Duration',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_call_duration',\n 'max' => 'max_call_duration',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getRecipientsFieldData(?Team $team = null, array $value = []): array\n {\n return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);\n }\n\n public function getJiminnyRecipientsFieldData(array $value = []): array\n {\n return $this->recipientsService->getJiminnyRecipientsFieldData($value);\n }\n\n public function getAdditionalPromptInputFieldData(?string $value = null): array\n {\n return [\n 'id' => 'additional_prompt_input',\n 'label' => 'Special requirements',\n 'inputType' => InputTypeEnum::TEXTAREA,\n 'required' => false,\n 'placeholder' => 'What should be the focus of the report?',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCustomReportNameFieldData(?string $value = null): array\n {\n return [\n 'id' => 'custom_name',\n 'label' => 'Custom report name',\n 'inputType' => InputTypeEnum::TEXT,\n 'required' => false,\n 'placeholder' => 'Enter custom name',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n // data providers\n public function getTeams(): array\n {\n $teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);\n\n $teamData = [];\n foreach ($teams as $team) {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n continue;\n }\n\n $teamData[] = $this->transformTeam($team);\n }\n\n return $teamData;\n }\n\n public function getTeamGroups(string $teamUuid): array\n {\n $data = [];\n $team = $this->getTeam($teamUuid);\n\n if ($team !== null) {\n $groups = $team->groups()->get();\n\n foreach ($groups as $group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n public function getTeamsGroupsOptions(array $filterTeamUuids = []): array\n {\n $data = [];\n $teams = $this->getTeams();\n\n foreach ($teams as $team) {\n if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {\n continue;\n }\n\n $data[] = [\n 'label' => $team['name'],\n 'groups' => $this->getTeamGroups($team['id']),\n ];\n }\n\n return $data;\n }\n\n public function getTeam(string $teamUuid): ?Team\n {\n return $this->teamRepository->idOrUuid($teamUuid);\n }\n\n public function getTeamById(int $teamId): ?Team\n {\n return $this->teamRepository->find($teamId);\n }\n\n public function getGroupsUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportGroups = $report->getGroups();\n foreach ($reportGroups as $groupId) {\n if ($group = $this->groupRepository->find($groupId)) {\n $uuids[] = $group->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getPlaybookCategoriesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $playbookCategories = $report->getPlaybookCategories();\n foreach ($playbookCategories as $id) {\n if ($category = $this->playbookCategoryRepository->find($id)) {\n $uuids[] = $category->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getDealAtCallStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getDealAtCallStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getCurrentDealStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getCurrentDealStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getRecipients());\n }\n\n public function getJiminnyUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function extractUserUuids(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => $user->getUuid())\n ->values()\n ->all();\n }\n\n // get mail data\n public function getRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getRecipients());\n }\n\n /**\n * @return array<UserContract>\n */\n public function getRecipientUserObjects(AutomatedReport $report): array\n {\n $userIds = $report->getRecipients()['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->values()\n ->all();\n }\n\n private function getJiminnyRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function buildRecipientUsers(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => [\n 'email' => $user->getEmailAddress(),\n 'name' => $user->getName(),\n 'timezone' => $user->getTimezone()->getName(),\n ])\n ->values()\n ->all();\n }\n\n public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array\n {\n if ($report->isAskJiminnyReport()) {\n $recipients = $this->resolveAskJiminnyRecipients($report);\n } else {\n $recipients = $this->getRecipientUsers($report);\n if ($includeJiminny) {\n $recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));\n }\n }\n\n $emails = [];\n\n return array_values(array_filter(\n $recipients,\n static function ($recipient) use (&$emails) {\n if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {\n return false;\n }\n $emails[] = $recipient['email'];\n\n return true;\n }\n ));\n }\n\n private function resolveAskJiminnyRecipients(AutomatedReport $report): array\n {\n $recipients = [];\n\n $creator = $report->getCreator();\n if ($creator !== null) {\n $recipients[] = [\n 'email' => $creator->getEmailAddress(),\n 'name' => $creator->getName(),\n 'timezone' => $creator->getTimezone()->getName(),\n ];\n }\n\n return array_merge(\n $recipients,\n $this->buildRecipientUsers($report->getRecipients()),\n $this->getGroupRecipientUsers($report),\n );\n }\n\n private function getGroupRecipientUsers(AutomatedReport $report): array\n {\n $users = [];\n foreach ($report->getGroups() as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group === null) {\n continue;\n }\n foreach ($group->getMembers() as $member) {\n $users[] = [\n 'email' => $member->getEmailAddress(),\n 'name' => $member->getName(),\n 'timezone' => $member->getTimezone()->getName(),\n ];\n }\n }\n\n return $users;\n }\n\n public function getReportTypeName(AutomatedReportResult $report): string\n {\n $type = $report->getReport()->getType();\n\n $getType = $this->transformReportType($type);\n\n return $getType['name'];\n }\n\n public function getReportPeriodName(AutomatedReportResult $report): string\n {\n $from = $report->getFromDate();\n $to = $report->getToDate();\n $frequency = $report->getReport()->getFrequency();\n\n if ($from === null || $to === null) {\n if (! $report->getReport()->isAskJiminnyReport()) {\n $invalidPeriod = $from === null ? 'from' : 'to';\n\n throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);\n }\n\n $period = $this->calculateFromAndToDatePeriod($frequency);\n $from = $period['fromDate'];\n $to = $period['toDate'];\n }\n\n return $this->formatReportPeriodName($frequency, $from, $to);\n }\n\n private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string\n {\n $fromYear = $from->format('Y');\n $toYear = $to->format('Y');\n $differentYears = $fromYear !== $toYear;\n\n switch ($frequency) {\n case self::FREQUENCY_DAILY:\n return $from->format('j M Y');\n\n case self::FREQUENCY_QUARTERLY:\n // 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ\n $startMonth = $from->format('M');\n $endMonth = $to->copy()->subMonth();\n $endMonthName = $endMonth->format('M');\n $endMonthYear = $endMonth->format('Y');\n\n if ($differentYears) {\n return \"{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}\";\n }\n\n return \"{$startMonth} - {$endMonthName} {$toYear}\";\n\n case self::FREQUENCY_MONTHLY:\n // 'May 2025' - monthly reports are always within the same year\n return $from->format('M Y');\n\n case self::FREQUENCY_WEEKLY:\n // '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ\n $startDay = $from->format('j');\n $endDay = $to->format('j');\n $startMonth = $from->format('M');\n $endMonth = $to->format('M');\n\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n if ($startMonth !== $endMonth) {\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n return \"{$startDay} - {$endDay} {$endMonth} {$toYear}\";\n\n case self::FREQUENCY_ONE_OFF:\n // '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ\n $startDay = $from->format('j');\n $startMonth = $from->format('M');\n $endDay = $to->format('j');\n $endMonth = $to->format('M');\n\n // If same month and year, use a format like '2-31 May 2025'\n if ($startMonth === $endMonth && ! $differentYears) {\n return \"{$startDay} - {$endDay} {$startMonth} {$toYear}\";\n }\n\n // If different years, include both years\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n // Same year but different months\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n\n default:\n // Default format for unknown frequencies\n return $from->format('j M Y') . ' - ' . $to->format('j M Y');\n }\n }\n\n public function getReportTeamsName(AutomatedReportResult $report): string\n {\n $groups = $report->getGroups();\n\n if (empty($groups)) {\n return 'All';\n }\n\n // Get group names from repository\n $groupNames = [];\n foreach ($groups as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group) {\n $groupNames[] = $group->getName();\n }\n }\n\n if (count($groupNames) === 1) {\n // Single team format\n $teamsName = $groupNames[0];\n } else {\n // Multiple teams format\n $teamsName = implode(', ', $groupNames);\n }\n\n return $teamsName;\n }\n\n public function getReportFileName(AutomatedReportResult $report): string\n {\n $customName = $report->getReport()->getCustomName();\n $periodName = $this->getReportPeriodName($report);\n $filenameSuffix = $this->getFilenameSuffix($report);\n\n if ($customName) {\n if ($filenameSuffix) {\n $customName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$customName} - {$periodName}\");\n }\n\n $baseName = $this->getReportTypeName($report);\n\n if ($filenameSuffix) {\n $baseName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}\");\n }\n\n public function getReportFileNameWithExtension(AutomatedReportResult $result): string\n {\n $extension = $this->getMediaTypeMetadata($result)['extension'];\n\n return $this->getReportFileName($result) . '.' . $extension;\n }\n\n public function sanitizeFileName(string $fileName): string\n {\n return str_replace(['/', '\\\\'], '-', $fileName);\n }\n\n public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool\n {\n $recipients = array_map('intval', $report->getRecipients()['users'] ?? []);\n\n return in_array($user->getId(), $recipients);\n }\n\n public function transformReportResults(Collection $automatedReportResults): array\n {\n $data = [];\n foreach ($automatedReportResults as $automatedReportResult) {\n /** @var AutomatedReportResult $automatedReportResult */\n\n $report = $automatedReportResult->getReport();\n\n $createdBy = $report->getCreator();\n $creator = [\n 'id' => $createdBy?->getUuid(),\n 'name' => $createdBy?->getName(),\n 'email' => $createdBy?->getEmailAddress(),\n 'photoUrl' => $createdBy?->getPhotoUrl(),\n ];\n\n $data[] = [\n 'id' => $automatedReportResult->getUuid(),\n 'name' => $automatedReportResult->getName(),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n 'recipients' => $this->buildRecipients($report),\n 'report_type' => $this->transformReportType($report->getType()),\n 'media_type' => $automatedReportResult->getMediaType(),\n 'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),\n 'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),\n 'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),\n 'creator' => $creator,\n ];\n }\n\n return $data;\n }\n\n private function buildRecipients(AutomatedReport $report): array\n {\n $recipients = array_values($this->transformRecipients($report->getRecipients()));\n\n if (! $report->isAskJiminnyReport()) {\n return $recipients;\n }\n\n return [\n ...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),\n ...$recipients,\n ];\n }\n\n public function hasCallTypeConference(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);\n }\n\n public function hasCallTypeDialer(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);\n }\n\n // transformers\n private function transformTeam(Team $team): array\n {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n return [];\n }\n\n return [\n 'id' => $team->getUuid(),\n 'name' => $team->getName(),\n ];\n }\n\n private function transformReportFullView(AutomatedReport $report): array\n {\n $base = $this->transformReportBase($report);\n\n return $report->getType() === self::TYPE_ASK_JIMINNY\n ? $base + $this->transformAskJiminnyFields($report)\n : $base + $this->transformStandardReportFields($report);\n }\n\n private function transformReportBase(AutomatedReport $report): array\n {\n return [\n 'id' => $report->getUuid(),\n 'organization' => $this->transformOrganization(team: $report->getTeam()),\n 'report_type' => $this->transformReportType($report->getType()),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n ];\n }\n\n private function transformStandardReportFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n\n return [\n 'report_enabled' => $report->getStatus(),\n 'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),\n 'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),\n 'deal_value_min' => $report->getDealValueMin(),\n 'deal_value_max' => $report->getDealValueMax(),\n 'call_types' => $this->transformCallType($report->getCallTypes()),\n 'media_types' => $this->transformMediaTypes($report),\n 'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),\n 'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),\n 'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),\n 'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),\n 'recipients' => $this->transformRecipients($report->getRecipients()),\n 'created_by' => $this->transformCreator($report->getCreator()),\n 'additional_prompt_input' => $report->getAdditionalPromptInput(),\n 'custom_name' => $report->getCustomName(),\n 'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),\n 'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),\n 'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),\n ];\n }\n\n private function transformAskJiminnyFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n $creatorId = $report->getAttribute('created_by');\n $explicitUserIds = array_values(array_filter(\n $report->getRecipients()['users'] ?? [],\n static fn ($id) => $id !== $creatorId\n ));\n\n return [\n 'report_name' => $report->getCustomName(),\n 'enabled' => $report->getStatus(),\n 'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),\n 'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),\n 'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),\n 'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),\n ];\n }\n\n private function transformOrganization(?Team $team): array\n {\n return [\n 'id' => $team?->getUuid(),\n 'name' => $team?->getName(),\n ];\n }\n\n private function transformReportType(string $type): array\n {\n foreach (self::ALL_TYPES as $typeItem) {\n if ($typeItem['id'] === $type) {\n return $typeItem;\n }\n }\n\n return [];\n }\n\n private function transformCallType(array $types): array\n {\n $result = [];\n $callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];\n\n foreach ($types as $type) {\n foreach ($callTypes as $callTypeItem) {\n if ($callTypeItem['id'] === $type) {\n $result[] = $callTypeItem;\n\n break;\n }\n }\n }\n\n return $result;\n }\n\n private function transformMediaTypes(AutomatedReport $report): array\n {\n $values = [];\n\n foreach ($report->getMediaTypes() as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n continue;\n }\n\n $values[] = match ($mediaType) {\n self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,\n self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,\n };\n }\n\n return $values;\n }\n\n private function transformFrequency(string $frequency): array\n {\n foreach (self::ALL_FREQUENCIES as $frequencyItem) {\n if ($frequencyItem['id'] === $frequency) {\n return $frequencyItem;\n }\n }\n\n return [];\n }\n\n public function transformDurationToMinutes(?int $duration): ?int\n {\n if (! $duration) {\n return null;\n }\n\n return (int) ($duration / 60);\n }\n\n private function transformGroups(?Team $team, array $groupsIds): array\n {\n if (empty($groupsIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($groupsIds as $groupId) {\n $group = $team->groups()->where('id', $groupId)->first();\n\n if ($group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n 'photoUrl' => $group->getPhotoUrl(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformStages(?Team $team, array $stagesIds): array\n {\n if (empty($stagesIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($stagesIds as $stageId) {\n $stage = $team->stages()->where('id', $stageId)->first();\n\n if ($stage) {\n $data[] = [\n 'id' => $stage->getUuid(),\n 'name' => $stage->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformRecipients(array $recipients): array\n {\n $users = [];\n foreach ($recipients['users'] ?? [] as $userId) {\n $users[] = $this->transformUser($userId);\n }\n\n return $users;\n }\n\n private function transformCreator(?User $user): ?array\n {\n if ($user === null) {\n return null;\n }\n\n return $this->transformUser($user->getId());\n }\n\n private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array\n {\n if ($prompt === null) {\n return null;\n }\n\n return [\n 'id' => $prompt->getUuid(),\n 'name' => $prompt->getTitle(),\n ];\n }\n\n private function transformSafeSearch(?Search $search): ?array\n {\n if ($search === null) {\n return null;\n }\n\n return [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ];\n }\n\n private function transformUser(int $userId): array\n {\n /* @var ?User $user */\n $user = $this->userRepository->find($userId);\n\n return [\n 'id' => $user?->getUuid(),\n 'name' => $user?->getName(),\n 'email' => $user?->getEmailAddress(),\n 'photoUrl' => $user?->getPhotoUrl(),\n ];\n }\n\n public function create(array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $validatedData['created_by'] = auth()->id();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function update(string $uuid, array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $report = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $report) {\n throw new InvalidArgumentException('Report not found');\n }\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Create an Ask Jiminny report.\n */\n public function createAskJiminnyReport(array $data, User $creator): array\n {\n $validatedData = $this->validateAskJiminnyReportData($data, $creator);\n $validatedData['created_by'] = $creator->getId();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Update an Ask Jiminny report.\n */\n public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array\n {\n if (! $report->isAskJiminnyReport()) {\n throw new InvalidArgumentException('Report is not an Ask Jiminny report');\n }\n\n $validatedData = $this->validateAskJiminnyReportData($data, $user);\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array\n {\n $this->automatedReportsRepository->update($report, ['status' => $status]);\n\n return $this->transformReportFullView($report->fresh());\n }\n\n /**\n * Validate and transform data for Ask Jiminny reports.\n */\n private function validateAskJiminnyReportData(array $data, User $user): array\n {\n // Validate name\n $name = trim($data['report_name'] ?? '');\n if (empty($name)) {\n throw new InvalidArgumentException('Report name is required');\n }\n if (mb_strlen($name) > 50) {\n throw new InvalidArgumentException('Report name must be 50 characters or less');\n }\n\n // Validate frequency (only daily, weekly, monthly for Ask Jiminny)\n $frequency = $data['frequency'] ?? null;\n $askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];\n if (! in_array($frequency, $askJiminnyFrequencies, true)) {\n throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');\n }\n\n // Validate expiration date\n $expiresAt = $data['expires_on'] ?? null;\n if (empty($expiresAt)) {\n throw new InvalidArgumentException('Expiration date is required');\n }\n\n try {\n $expiresAtDate = Carbon::parse($expiresAt);\n } catch (InvalidFormatException $e) {\n throw new InvalidArgumentException('Expiration date format is invalid');\n }\n $maxExpiration = Carbon::now()->addYear()->endOfDay();\n if ($expiresAtDate->gt($maxExpiration)) {\n throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');\n }\n if ($expiresAtDate->isPast()) {\n throw new InvalidArgumentException('Expiration date cannot be in the past');\n }\n\n // Validate saved search\n $activitySearchId = $data['saved_search'] ?? null;\n if (empty($activitySearchId)) {\n throw new InvalidArgumentException('Saved search is required');\n }\n $savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);\n if (! $savedSearch) {\n throw new InvalidArgumentException('Saved search not found or does not belong to you');\n }\n\n // Validate saved prompt\n $askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;\n if (empty($askAnythingPromptId)) {\n throw new InvalidArgumentException('Ask Jiminny prompt is required');\n }\n $prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);\n if (! $prompt) {\n throw new InvalidArgumentException('Ask Jiminny prompt not found');\n }\n\n // Validate status\n $status = $data['enabled'] ?? false;\n\n $recipientUserIds = [$user->getId()];\n\n if (! empty($data['share_users'])) {\n $sharedUserIds = $this->validateAndGetUserIdsByTeam(\n $user->team,\n (array) $data['share_users']\n );\n $recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);\n }\n\n $sharedGroupIds = [];\n if (! empty($data['share_teams'])) {\n $sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);\n }\n\n $recipientUserIds = array_values(array_unique($recipientUserIds));\n\n return [\n 'team_id' => $user->getTeamId(),\n 'type' => self::TYPE_ASK_JIMINNY,\n 'status' => (bool) $status,\n 'frequency' => $frequency,\n 'custom_name' => $name,\n 'activity_search_id' => $savedSearch->getId(),\n 'ask_anything_prompt_id' => $prompt->getId(),\n 'expires_at' => $expiresAtDate->toDateString(),\n 'media_types' => [self::MEDIA_TYPE_PDF],\n 'call_types' => [],\n 'recipients' => ['users' => $recipientUserIds],\n 'groups' => $sharedGroupIds,\n ];\n }\n\n public static function getAskJiminnyFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::ASK_JIMINNY_FREQUENCIES);\n }\n\n public function getAskJiminnyReportFilters(User $user): array\n {\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n return [\n [\n 'id' => 'prompt',\n 'label' => 'Prompt',\n 'options' => $prompts,\n ],\n [\n 'id' => 'saved_search',\n 'label' => 'Saved Search',\n 'options' => $savedSearches,\n ],\n ];\n }\n\n public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array\n {\n $team = $user->getTeam();\n $userTimezone = $user->getTimezone();\n\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n $teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ])->values()->all();\n\n $shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];\n\n $sharedTeamsValue = [];\n $sharedUsersValue = [];\n if ($report) {\n $sharedTeamsValue = $this->transformGroups($team, $report->getGroups());\n\n $recipientUserIds = $report->getRecipients()['users'] ?? [];\n $creatorId = $report->getAttribute('created_by');\n $sharedUserIds = array_values(array_filter(\n $recipientUserIds,\n static fn ($id) => $id !== $creatorId\n ));\n $sharedUsersValue = collect($sharedUserIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (User $u) => [\n 'id' => $u->getUuid(),\n 'name' => $u->getName(),\n ])\n ->values()\n ->all();\n }\n\n return [\n 'fields' => [\n [\n 'id' => 'enabled',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'label' => '',\n 'value' => $report?->getStatus() ?? false,\n ],\n [\n 'id' => 'report_name',\n 'inputType' => InputTypeEnum::TEXT,\n 'label' => 'Name',\n 'placeholder' => 'Enter name',\n 'required' => true,\n 'validation' => ['maxLength' => 50],\n 'value' => $report?->getCustomName() ?? '',\n ],\n [\n 'id' => 'frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Frequency',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::ASK_JIMINNY_FREQUENCIES,\n 'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,\n ],\n [\n 'id' => 'expires_on',\n 'inputType' => InputTypeEnum::DATE,\n 'label' => 'Expires on',\n 'required' => true,\n 'placeholder' => 'Select',\n 'validation' => [\n 'minDate' => now($userTimezone)->toDateString(),\n 'maxDate' => now($userTimezone)->addYear()->toDateString(),\n ],\n 'value' => $report?->getExpiresAt()?->toDateString(),\n ],\n [\n 'id' => 'share_teams',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team',\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $teamGroups,\n 'value' => $sharedTeamsValue,\n ],\n [\n 'id' => 'share_users',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team member',\n 'required' => false,\n 'placeholder' => 'Select',\n 'groupLabelKey' => 'label',\n 'groupValuesKey' => 'users',\n 'optionLabelKey' => 'name',\n 'optionValueKey' => 'id',\n 'options' => $shareUsers,\n 'value' => $sharedUsersValue,\n ],\n [\n 'id' => 'saved_search',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Saved search',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $savedSearches,\n 'value' => $report && $report->getSavedSearch() ? [\n 'id' => $report->getSavedSearch()->getUuid(),\n 'name' => $report->getSavedSearch()->getName(),\n ] : null,\n ],\n [\n 'id' => 'ask_jiminny_prompt',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Ask Jiminny prompt',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $prompts,\n 'value' => $report && $report->getAskAnythingPrompt() ? [\n 'id' => $report->getAskAnythingPrompt()->getUuid(),\n 'name' => $report->getAskAnythingPrompt()->getTitle(),\n ] : null,\n ],\n ],\n ];\n }\n\n private function updateResultNames(AutomatedReport $automatedReport): void\n {\n $results = $this->automatedReportsRepository->getResultsByReport($automatedReport);\n\n foreach ($results as $result) {\n $result->update(['name' => $this->getReportFileName($result)]);\n }\n }\n\n public function updateStatus(string $uuid, array $data): array\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $automatedReport->update([\n 'status' => $status,\n ]);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n private function generateOneOffReport(AutomatedReport $automatedReport): void\n {\n // the scheduler handles all the other frequency types\n if ($automatedReport->getStatus() === false || $automatedReport->getFrequency() !== self::FREQUENCY_ONE_OFF) {\n return;\n }\n\n $this->dispatcher->dispatch(new RequestGenerateReportJob($automatedReport->getUuid()));\n }\n\n public function getReport(string $uuid): AutomatedReport\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n return $automatedReport;\n }\n\n public function get(string $uuid): array\n {\n $automatedReport = $this->getReport($uuid);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function list(string $sortColumn = 'created_at', string $sortDirection = 'desc'): array\n {\n $results = [];\n $collection = $this->automatedReportsRepository->getAllStandardReports($sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function listAskJiminnyReports(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): array {\n $results = [];\n $collection = $this->automatedReportsRepository->getAskJiminnyReportsByUser($user, $sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function delete(string $uuid): void\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $automatedReport->delete();\n }\n\n public function createReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n return $this->automatedReportsRepository->createResult(\n array_merge(\n [\n 'report_id' => $automatedReport->getId(),\n 'status' => AutomatedReportResult::STATUS_DEFAULT,\n ],\n $data\n )\n );\n }\n\n public function getOrCreateReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n $existing = $this->automatedReportsRepository->findLatestDefaultOrFailedResult($automatedReport);\n\n if ($existing !== null) {\n $existing->update(['status' => AutomatedReportResult::STATUS_DEFAULT]);\n\n return $existing;\n }\n\n return $this->createReportResult($automatedReport, $data);\n }\n\n public function getReportResult(string $resultUuid): AutomatedReportResult\n {\n $report = $this->automatedReportsRepository->findResultByUuid($resultUuid);\n\n if (! $report) {\n throw new ModelNotFoundException('Report Result not found');\n }\n\n return $report;\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return $this->automatedReportsRepository->findChildResult($result, $type);\n }\n\n // prophet API calls\n /**\n * @throws ApplicationException\n */\n public function getGenerateReportPayload(AutomatedReport $automatedReport, string $reportResultUuid): array\n {\n $period = $this->calculateFromAndToDate($automatedReport);\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n return [\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResultUuid,\n 'report_type' => $automatedReport->getType(),\n 'media_types' => $automatedReport->getMediaTypes(),\n 'from_date' => $fromDate->startOfDay()->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->endOfDay()->format(DateTimeInterface::RFC3339),\n 'group_ids' => $automatedReport->getGroups(),\n 'call_deal_stage' => $automatedReport->getDealAtCallStages(),\n 'current_deal_stage' => $automatedReport->getCurrentDealStages(),\n 'deal_min_value' => $automatedReport->getDealValueMin(),\n 'deal_max_value' => $automatedReport->getDealValueMax(),\n 'call_types' => $automatedReport->getCallTypes(),\n 'call_duration_min_seconds' => $automatedReport->getCallDurationMin(),\n 'call_duration_max_seconds' => $automatedReport->getCallDurationMax(),\n 'special_requirements' => $automatedReport->getAdditionalPromptInput(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->formatReportPeriodName(\n $automatedReport->getFrequency(),\n $fromDate,\n $toDate,\n ),\n 'playbook_categories' => $automatedReport->getPlaybookCategories(),\n 'custom_name' => $automatedReport->getCustomName(),\n ];\n }\n\n // $inputPayload - FE payload structure\n public function getActivitiesCountPayload(array $inputPayload): array\n {\n // Use validateAndTransformData to validate and normalize input\n $validatedData = $this->validateAndTransformData($inputPayload);\n $period = $this->calculateFromAndToDatePeriod(\n $validatedData['frequency'],\n Carbon::parse($validatedData['from']),\n Carbon::parse($validatedData['to']),\n );\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n // Create payload similar to getGenerateReportPayload\n return [\n 'team_id' => $validatedData['team_id'],\n 'group_ids' => $validatedData['groups'] ?? [],\n 'report_type' => $validatedData['type'],\n 'from_date' => $fromDate->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->format(DateTimeInterface::RFC3339),\n 'call_deal_stage' => $validatedData['deal_at_call_stages'] ?? [],\n 'current_deal_stage' => $validatedData['current_deal_stages'] ?? [],\n 'deal_min_value' => $validatedData['deal_value_min'] ?? null,\n 'deal_max_value' => $validatedData['deal_value_max'] ?? null,\n 'call_types' => $validatedData['call_types'],\n 'call_duration_min_seconds' => $validatedData['call_duration_min'] ?? null,\n 'call_duration_max_seconds' => $validatedData['call_duration_max'] ?? null,\n 'special_requirements' => $validatedData['additional_prompt_input'] ?? null,\n 'playbook_categories' => $validatedData['playbook_categories'] ?? [],\n 'request_id' => null,\n 'callback_url' => null,\n ];\n }\n\n public function shouldSendReport(array $users, ?CarbonInterface $generatedAt = null): bool\n {\n if (empty($users)) {\n return false;\n }\n\n $earliestTz = collect($users)\n ->mapWithKeys(function (array $user) {\n $tz = new DateTimeZone($user['timezone']);\n $nowUtc = new DateTime('now', new DateTimeZone('UTC'));\n $offset = $tz->getOffset($nowUtc);\n\n return [$user['timezone'] => $offset];\n })\n ->sortDesc()\n ->keys()\n ->first();\n\n $now = Carbon::now($earliestTz);\n $isScheduledTime = (int) $now->format('H') === self::SENT_REPORT_AT_HOURS;\n\n if ($isScheduledTime) {\n return true;\n }\n\n return $this->hasPassedScheduledTime($generatedAt, $earliestTz);\n }\n\n public function hasPassedScheduledTime(?CarbonInterface $generatedAt, string $timezone): bool\n {\n if ($generatedAt === null) {\n return false;\n }\n\n $now = Carbon::now($timezone);\n $scheduledTime = $now->copy()->setTime(self::SENT_REPORT_AT_HOURS, 0, 0);\n\n if ($now->hour < self::SENT_REPORT_AT_HOURS) {\n $scheduledTime = $scheduledTime->subDay();\n }\n\n $scheduledTimeUtc = $scheduledTime->copy()->utc();\n $generatedAtUtc = $generatedAt->copy()->utc();\n $nowUtc = $now->copy()->utc();\n\n return $generatedAtUtc->lt($scheduledTimeUtc) && $nowUtc->gt($scheduledTimeUtc);\n }\n\n public function calculateFromAndToDatePeriod(\n string $frequency,\n ?Carbon $fromDate = null,\n ?Carbon $toDate = null\n ): array {\n if ($frequency === self::FREQUENCY_ONE_OFF) {\n return [\n 'fromDate' => $fromDate,\n 'toDate' => $toDate,\n ];\n }\n\n $now = Carbon::now();\n\n return match ($frequency) {\n self::FREQUENCY_DAILY => [\n 'fromDate' => $now->copy()->subDay()->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_WEEKLY => [\n 'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_MONTHLY => [\n 'fromDate' => $now->copy()->subMonths(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_QUARTERLY => [\n 'fromDate' => $now->copy()->subMonths(3)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n default => throw new InvalidArgumentException(\"Unsupported frequency: {$frequency}\"),\n };\n }\n\n private function calculateFromAndToDate(AutomatedReport $automatedReport): array\n {\n return $this->calculateFromAndToDatePeriod(\n $automatedReport->getFrequency(),\n $automatedReport->getFrom(),\n $automatedReport->getTo()\n );\n }\n\n public function getAskJiminnyGenerateReportPayload(\n AutomatedReport $automatedReport,\n AutomatedReportResult $reportResult,\n array $activityIds,\n ): array {\n return [\n 'user_question' => $automatedReport->getAskAnythingPrompt()?->getContent(),\n 'call_ids' => array_map('strval', $activityIds),\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResult->getUuid(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->getReportPeriodName($reportResult),\n 'report_name' => $automatedReport->getCustomName(),\n ];\n }\n\n private function getCallbackUrl(): string\n {\n return $this->webhookService->route('jiminny.webhook.reports.ready');\n }\n\n /**\n * Validate and transform payload data for automated reports\n *\n * @param array $data\n *\n * @throws InvalidArgumentException\n *\n * @return array\n */\n private function validateAndTransformData(array $data): array\n {\n // Validate organization (team) and check feature\n $team = $this->validateOrganization($data['organization'] ?? null);\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $type = $this->validateReportType($data['report_type'] ?? null);\n $frequency = $this->validateFrequency($data['frequency'] ?? null);\n $additionalPromptInput = $this->validateAdditionalPromptInput(\n $data['additional_prompt_input'] ?? null\n );\n $customReportName = $this->validateCustomReportName($data['custom_name'] ?? null);\n\n // Prepare data for the database\n $reportData = [\n 'team_id' => $team->getId(),\n 'type' => $type,\n 'status' => $status,\n 'frequency' => $frequency,\n 'additional_prompt_input' => $additionalPromptInput,\n 'custom_name' => $customReportName,\n ];\n\n // Validate deal values\n $reportData = $this->validateDealValues($data, $reportData);\n\n // Validate date range\n $reportData = $this->validateDateRange($data, $reportData, $frequency);\n\n // Validate call durations\n $reportData = $this->validateCallDurations($data, $reportData);\n\n // Validate call types\n $reportData = $this->validateCallTypes($data, $reportData);\n\n // Validate media types\n $reportData = $this->validateMediaTypes($data, $reportData);\n\n // Validate groups\n if (isset($data['teams'])) {\n $reportData['groups'] = $this->validateAndGetGroupIds($team, $data['teams']);\n }\n\n // Validate deal stages\n $reportData = $this->validateDealStages($data, $reportData, $team, $type);\n\n // Validate playbook categories\n $reportData = $this->validatePlaybookCategories($data, $reportData, $team);\n\n // Validate recipients\n $reportData['recipients'] = [\n 'users' => $this->validateAndGetUserIdsByTeam($team, $data['recipients'] ?? []),\n ];\n\n if (isset($data['jiminny_recipients'])) {\n // Validate Jiminny recipients\n $reportData['jiminny_recipients'] = [\n 'users' => $this->validateAndGetJiminnyUserIds((array) $data['jiminny_recipients']),\n ];\n }\n\n return $reportData;\n }\n\n private function validateDealValues(array $data, array $reportData): array\n {\n if (isset($data['min_deal_value'])) {\n $reportData['deal_value_min'] = (int) $data['min_deal_value'];\n\n if ($reportData['deal_value_min'] > 4294967295 || $reportData['deal_value_min'] < 0) {\n throw new InvalidArgumentException('Min deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_deal_value'])) {\n $reportData['deal_value_max'] = (int) $data['max_deal_value'];\n\n if ($reportData['deal_value_max'] > 4294967295 || $reportData['deal_value_max'] < 0) {\n throw new InvalidArgumentException('Max deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['min_deal_value'], $data['max_deal_value'])\n && $data['min_deal_value'] > $data['max_deal_value']\n ) {\n throw new InvalidArgumentException('Min deal value cannot be greater than max deal value');\n }\n\n return $reportData;\n }\n\n private function validateDateRange(array $data, array $reportData, string $frequency): array\n {\n // Set date range only for one_off frequency\n if ($frequency === 'one_off') {\n if (isset($data['start_date_period'])) {\n $reportData['from'] = $this->parseDate($data['start_date_period']);\n }\n\n if (isset($data['end_date_period'])) {\n $reportData['to'] = $this->parseDate($data['end_date_period']);\n }\n\n if (empty($reportData['from']) || empty($reportData['to'])) {\n throw new InvalidArgumentException(\n 'Start date and end date are required for one_off frequency'\n );\n }\n } else {\n $reportData['from'] = null;\n $reportData['to'] = null;\n }\n\n return $reportData;\n }\n\n private function validateCallDurations(array $data, array $reportData): array\n {\n // Convert call durations from minutes to seconds\n if (isset($data['min_call_duration'])) {\n $reportData['call_duration_min'] = (int) $data['min_call_duration'] * 60;\n\n if ($reportData['call_duration_min'] > 4294967295 || $reportData['call_duration_min'] < 0) {\n throw new InvalidArgumentException('Min call duration should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_call_duration'])) {\n $reportData['call_duration_max'] = (int) $data['max_call_duration'] * 60;\n\n if ($reportData['call_duration_max'] > 4294967295 || $reportData['call_duration_max'] < 0) {\n throw new InvalidArgumentException('Max call duration should be between 0 and 4294967295');\n }\n }\n\n return $reportData;\n }\n\n private function validateCallTypes(array $data, array $reportData): array\n {\n // Set call types\n $reportData['call_types'] = $data['call_type'] ?? [];\n if (empty($reportData['call_types'])) {\n $reportData['call_types'] = self::getCallTypes();\n }\n\n foreach ($reportData['call_types'] as $callType) {\n if (! in_array($callType, self::getCallTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Call type %s is invalid', $callType));\n }\n }\n\n return $reportData;\n }\n\n private function validateMediaTypes(array $data, array $reportData): array\n {\n // Set media types from input data\n $reportData['media_types'] = $data['media_types'] ?? [];\n\n if (empty($reportData['media_types'])) {\n throw new InvalidArgumentException('Media types are required');\n }\n\n foreach ($reportData['media_types'] as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n throw new InvalidArgumentException(sprintf('Media type %s is invalid', $mediaType));\n }\n }\n\n return $reportData;\n }\n\n private function validateDealStages(array $data, array $reportData, Team $team, string $reportType): array\n {\n // Validate and set deal stages\n if (isset($data['deal_stage_at_call'])) {\n $reportData['deal_at_call_stages'] =\n $this->validateAndGetDealStageIds($team, $data['deal_stage_at_call'], 'Deal stage at call');\n }\n\n if (isset($data['current_deal_stage'])) {\n $reportData['current_deal_stages'] =\n $this->validateAndGetDealStageIds($team, $data['current_deal_stage'], 'Current deal stage');\n }\n\n // Ensure current_deal_stage is not provided for loss_analysis report type\n if ($reportType === self::TYPE_LOSS_ANALYSIS && ! empty($data['current_deal_stage'])) {\n throw new InvalidArgumentException('Current deal stage is not applicable for Loss Analysis reports');\n }\n\n return $reportData;\n }\n\n // transform uuid to id\n private function validatePlaybookCategories(array $data, array $reportData, Team $team): array\n {\n $key = 'playbook_categories';\n\n if (isset($data[$key])) {\n $payloadIds = $data[$key];\n $ids = [];\n\n foreach ($payloadIds as $uuid) {\n $uuid = (string) $uuid;\n\n try {\n $playbookCategory = $this->playbookCategoryRepository->findByUuid($uuid);\n } catch (Throwable $throwable) {\n Log::error(__METHOD__ . ' ' . $throwable->getMessage());\n\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory) {\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory->hasPlaybook()) {\n throw new InvalidArgumentException(sprintf('Playbook category %s has no playbook', $uuid));\n }\n\n if ($playbookCategory->getPlaybook()->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Playbook category %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $ids[] = $playbookCategory->getId();\n }\n\n $reportData[$key] = $ids;\n }\n\n return $reportData;\n }\n\n private function validateReportStatus($status): bool\n {\n if (! in_array($status, [true, false], true)) {\n throw new InvalidArgumentException('Report status is invalid');\n }\n\n return $status;\n }\n\n private function validateReportType($type): string\n {\n if (! in_array($type, self::getTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Report type is invalid: %s', $type));\n }\n\n return $type;\n }\n\n private function validateFrequency($frequency): string\n {\n if (! in_array($frequency, self::getFrequencies(), true)) {\n throw new InvalidArgumentException('Frequency is invalid');\n }\n\n return $frequency;\n }\n\n private function validateAdditionalPromptInput(?string $additionalPromptInput): ?string\n {\n if ($additionalPromptInput && strlen($additionalPromptInput) > 5000) {\n throw new InvalidArgumentException('Additional Prompt Input should be less than 5000 characters');\n }\n\n return $additionalPromptInput;\n }\n\n private function validateCustomReportName(?string $customReportName): ?string\n {\n if ($customReportName === null || $customReportName === '') {\n return null;\n }\n\n if (strlen($customReportName) > 70) {\n throw new InvalidArgumentException('Custom report name should be less than 70 characters');\n }\n\n return $customReportName;\n }\n\n private function validateOrganization(?string $organizationUuid): Team\n {\n if (! $organizationUuid) {\n throw new InvalidArgumentException('Organization is required');\n }\n\n $team = $this->teamRepository->idOrUuid($organizationUuid);\n\n if (! $team) {\n throw new InvalidArgumentException('Organization not found');\n }\n\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n throw new InvalidArgumentException('Organization does not have the Automated Reports feature');\n }\n\n return $team;\n }\n\n private function validateAndGetGroupIds(Team $team, array $teamUuids): array\n {\n $groupIds = [];\n\n foreach ($teamUuids as $uuid) {\n $group = $this->groupRepository->findByUuid($uuid);\n\n if ($group === null || $group->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Group %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $groupIds[] = $group->getId();\n\n }\n\n return $groupIds;\n }\n\n private function validateAndGetDealStageIds(Team $team, array $stageUuids, string $propertyLabel): array\n {\n $stageIds = [];\n\n foreach ($stageUuids as $uuid) {\n $stage = $this->stageRepository->findByUuid($uuid);\n\n if ($stage === null || $stage->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Stage %s not found for team %s for %s', $uuid, $team->getUuid(), $propertyLabel)\n );\n }\n\n $stageIds[] = $stage->getId();\n }\n\n return $stageIds;\n }\n\n private function validateAndGetUserIds(array $userUuids, callable $teamCheck): array\n {\n if (empty($userUuids)) {\n return [];\n }\n\n $userIds = [];\n\n foreach ($userUuids as $uuid) {\n $user = $this->userRepository->findByUuid($uuid);\n\n if (! $user || ! $user->isStatusActive()) {\n throw new InvalidArgumentException(\n sprintf('User %s not found or is not active', $uuid)\n );\n }\n\n if (! $teamCheck($user)) {\n throw new InvalidArgumentException(\n sprintf('User %s does not belong to the allowed team(s)', $uuid)\n );\n }\n\n $userIds[] = $user->getId();\n }\n\n return $userIds;\n }\n\n private function validateAndGetUserIdsByTeam(Team $team, array $userUuids): array\n {\n return $this->validateAndGetUserIds($userUuids, fn ($user) => $user->getTeamId() === $team->getId());\n }\n\n private function validateAndGetJiminnyUserIds(array $userUuids): array\n {\n $allowedTeamIds = config('kiosk.teamIds', []);\n\n return $this->validateAndGetUserIds($userUuids, fn ($user) => in_array($user->getTeamId(), $allowedTeamIds, true));\n }\n\n private function parseDate(string $dateString): string\n {\n return date('Y-m-d H:i:s', strtotime($dateString));\n }\n\n private function generateReportResultViewUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.view', ['uuid' => $result->getUuid()]);\n }\n\n private function generateReportResultDownloadUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.download', ['uuid' => $result->getUuid()]);\n }\n\n private function getReportMediaRouteResource(AutomatedReportResult $result): string\n {\n if ($result->getMediaType() === self::MEDIA_TYPE_PDF) {\n return self::PDF_KEY;\n } elseif ($result->getMediaType() === self::MEDIA_TYPE_PODCAST) {\n return self::AUDIO_KEY;\n }\n\n throw new \\InvalidArgumentException('Unknown media type.');\n }\n\n public function getMediaPath(AutomatedReportResult $result): ?string\n {\n $url = match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => $result->getPdfUrl(),\n self::MEDIA_TYPE_PODCAST => $result->getPodcastAudioUrl(),\n default => null,\n };\n\n if ($url === null) {\n return null;\n }\n\n $path = parse_url(trim($url, '\"\\''), PHP_URL_PATH);\n\n return $path ?: null;\n }\n\n public function getFilenameSuffix(AutomatedReportResult $result): ?string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => 'Podcast',\n default => null,\n };\n }\n\n public function getMailSubjectSuffix(AutomatedReportResult $result): string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => 'report',\n self::MEDIA_TYPE_PODCAST => 'podcast',\n default => '',\n };\n }\n\n public function getMediaTypeMetadata(AutomatedReportResult $result): array\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => ['extension' => 'mp3', 'mime' => 'audio/mpeg'],\n self::MEDIA_TYPE_PDF => ['extension' => 'pdf', 'mime' => 'application/pdf'],\n default => ['extension' => null, 'mime' => null],\n };\n }\n\n public function deleteS3Files(AutomatedReportResult $result): void\n {\n $teamUuid = $result->getReport()->getTeam()->getUuid();\n $reportUuid = $result->getUuid();\n\n // delete all files for a report uuid no mather of pdf, podcast, or both\n // in case of both - the podcast files are linked to the pdf (parent) uuid\n // pdf and podcast date times should be close\n $path = sprintf('%s/%s/%s', $teamUuid, self::S3_DIR, $reportUuid);\n\n foreach (self::FILE_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted S3 file', [\n 'path' => $file,\n ]);\n }\n }\n\n foreach (self::FILE_PODCAST_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '_podcast.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted Podcast S3 file', [\n 'path' => $file,\n ]);\n }\n }\n }\n\n /**\n *\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): Collection\n {\n return $this->automatedReportsRepository->getTeamIdsWithReportsResults($teamId);\n }\n\n /**\n * Core delete logic for report results using a query\n *\n * @param Builder $query\n * @param array $logContext\n *\n * @return int\n */\n private function deleteReportResultsByQuery(Builder $query, array $logContext = []): int\n {\n $deletedCount = 0;\n\n if ($query->exists()) {\n Log::info(\n 'Run delete report results',\n array_merge(\n $logContext,\n [\n 'service' => 'AutomatedReportsService',\n ]\n )\n );\n\n $query->chunkById(50, function ($results) use (&$deletedCount, $logContext) {\n foreach ($results as $result) {\n $this->deleteReportResult($result);\n $deletedCount++;\n\n Log::info(\n 'Deleted a report result',\n array_merge(\n $logContext,\n [\n 'result_id' => $result->getId(),\n 'report_id' => $result->getReportId(),\n ]\n )\n );\n }\n });\n }\n\n return $deletedCount;\n }\n\n /**\n * Delete report results for a team by retention period\n *\n * @param Team $team\n * @param CarbonImmutable $retentionDate\n *\n * @return int Number of deleted report results\n */\n public function deleteReportsResultsInRetentionPeriod(Team $team, CarbonImmutable $retentionDate): int\n {\n $reportIds = $this->automatedReportsRepository->getReportIdsByTeam($team);\n\n if ($reportIds->isEmpty()) {\n return 0;\n }\n\n $query = $this->automatedReportsRepository\n ->getReportResultsQueryForRetention($team, $retentionDate);\n\n return $this->deleteReportResultsByQuery($query, [\n 'team_id' => $team->getId(),\n 'retention_date' => $retentionDate->toDateTimeString(),\n ]);\n }\n\n /**\n * Delete ALL report results for a specific automated report\n *\n * @param string $uuid\n *\n * @return int\n */\n public function deleteReportResults(string $uuid): int\n {\n $report = $this->getReport($uuid);\n\n $query = $this->automatedReportsRepository->getResultsByReportQuery($report);\n\n return $this->deleteReportResultsByQuery($query, [\n 'report_uuid' => $uuid,\n 'report_id' => $report->getId(),\n ]);\n }\n\n public function deleteReportResult(AutomatedReportResult $result): void\n {\n $this->deleteS3Files($result);\n\n $result->delete();\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getTeamReports(Team $team): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getReportsByTeam($team);\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getReportResults(AutomatedReport $report): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getResultsByReport($report);\n }\n\n public function deleteAllReportResults(AutomatedReport $report): void\n {\n $results = $this->getReportResults($report);\n\n /** @var AutomatedReportResult $result */\n foreach ($results as $result) {\n Log::info('Deleting result', [\n 'report' => $report->getId(),\n 'result' => $result->getId(),\n ]);\n\n $this->deleteReportResult($result);\n }\n }\n\n public function deleteAllData(Team $team): void\n {\n Log::info('Deleting automated report and results for team', [\n 'team' => $team->getId(),\n ]);\n\n $reports = $this->getTeamReports($team);\n\n /** @var AutomatedReport $report */\n foreach ($reports as $report) {\n Log::info('Deleting report', [\n 'team' => $team->getId(),\n 'report' => $report->getId(),\n ]);\n\n $this->deleteAllReportResults($report);\n\n $report->delete();\n }\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"bounds":{"left":0.50166225,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"bounds":{"left":0.5103058,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"bounds":{"left":0.5212766,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"bounds":{"left":0.5299202,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"bounds":{"left":0.53856385,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"bounds":{"left":0.54953456,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"bounds":{"left":0.56050533,"top":0.14844373,"width":0.024268618,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"bounds":{"left":0.58710104,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"bounds":{"left":0.5980718,"top":0.14844373,"width":0.029587766,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"bounds":{"left":0.6599069,"top":0.14844373,"width":0.02825798,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"18","depth":4,"bounds":{"left":0.63231385,"top":0.17318435,"width":0.009640957,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"14","depth":4,"bounds":{"left":0.64394945,"top":0.17318435,"width":0.009640957,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"2","depth":4,"bounds":{"left":0.6555851,"top":0.17318435,"width":0.007978723,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"4","depth":4,"bounds":{"left":0.6655585,"top":0.17318435,"width":0.007978723,"height":0.015163607},"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.67519945,"top":0.17158818,"width":0.00731383,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.6825133,"top":0.17158818,"width":0.006981383,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o\nJOIN activities a ON o.id = a.opportunity_id\nWHERE a.crm_configuration_id = 39\nAND a.actual_start_time > '2025-10-13'\nAND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM activities\nWHERE crm_configuration_id = 39 and user_id = 143\nand actual_start_time >= '2025-10-13'\nAND type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM opportunities WHERE account_id IN (178);\nselect * from activities where id IN (620137, 620187, 620188, 620189, 620230);\n\n# HS\nSELECT * FROM opportunities WHERE id IN (238);\nselect * from activities where id IN (477,2076);\n\nselect * from users;\n\nSELECT COUNT(*) FROM users;\nSELECT COUNT(*) FROM activities;\nSELECT COUNT(*) FROM opportunities;\n\nUPDATE activities\nSET\n actual_start_time = '2025-12-19 09:00:00',\n actual_end_time = '2025-12-19 10:30:00',\n scheduled_start_time = '2025-12-19 09:00:00',\n scheduled_end_time = '2025-12-19 10:30:00'\nWHERE id IN (407509,407375);\n\nselect * from partners;\n\nSELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id\nFROM activities\nWHERE user_id = 143\nAND actual_start_time >= '2025-10-13 00:00:00'\nAND actual_start_time <= '2026-01-13 23:59:59'\nORDER BY actual_start_time DESC;\n\nSELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;\nSELECT * FROM crm_layouts where crm_configuration_id = 39;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;\n# lead_id\n# account_id 177\n# contact_id 3969\n# opportunity_id\n# stage_id 203\n\nSELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;\n\nSELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'\nAND user_id = 143 and actual_start_time >= '2025-10-13';\n\nSELECT * FROM activities a\n# JOIN opportunities o ON a.opportunity_id = o.id\nWHERE a.crm_configuration_id = 39 AND a.type = 'conference'\nand status = 'completed' and recording_state = 'recorded'\nand a.actual_start_time >= '2025-10-13'\nAND a.user_id = 143\n;\n\nselect * from leads\nwhere crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707\n\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310);\nSELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198\nSELECT * FROM activities WHERE id IN (356001, 356008); # contacts:\n\nSELECT * FROM opportunities WHERE id IN (1707);\nSELECT * FROM stages where id IN (204, 198);\nSELECT * FROM opportunities WHERE account_id IN (178);\nSELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';\nSELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal\n\nSELECT * FROM activities where crm_configuration_id = 39\nAND opportunity_id IS NULL\nAND is_internal = false\nand status = 'completed' and recording_state = 'recorded'\nAND actual_start_time >= '2025-10-13'\nAND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)\n# AND lead_id IN (112, 109)\n;\n\nSELECT * FROM crm_profiles WHERE user_id = 143;\n\nselect * from inboxes; # 212\nselect * from users where id = 143; # 143\nselect * from inbox_email_batches where inbox_id = 212\nand updated_at >= '2026-01-28 00:00:00' order by id desc;\nselect * from inbox_emails where inbox_id = 212\nand batch_id = 95885 order by id desc;\nselect * from email_messages where origin_user_id = 143;\nselect * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';\nselect * from participants where activity_id = 620247;\n\nselect * from crm_profiles where user_id = 143;\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001\nselect * from transcription where activity_id = 356001; # 6943\nselect * from ai_prompts where transcription_id = 6943;\nSELECT * FROM activity_summary_logs where activity_id = 356001;\n\nSELECT * FROM social_accounts WHERE sociable_id = 143;\n\n# ************************************************************************************\nSELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;\n# 422515 softphone tr. 8100\n\nSELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;\n# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS\n\nselect * from ai_prompts where transcription_id IN (8100, 7670);\nselect * from activity_summary_logs where activity_id = 407509;\n\nselect * from sidekick_settings;\nselect * from default_activity_types;\n\nSELECT * FROM contacts WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\nSELECT * FROM leads WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\n\nSELECT * FROM activity_searches where user_id = 143;\nSELECT * FROM groups where team_id = 1;\n\nselect * from teams where id = 1;\nselect * from groups where team_id = 1; # 1150 - 7e75f8025c22\nselect id, name, group_id, status, deleted_at, email\nfrom users where team_id = 1 order by group_id desc ;\n\nselect * from activity_searches where id in (1977, 1978, 1979);\nselect * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);\nselect * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277\nselect * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879\n\nINSERT INTO `activity_search_filters`\n(`activity_search_id`, `filter`, `value`) VALUES\n(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')\n;\n\nselect * from crm_configurations where id = 39;\n\n\nselect sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id\nwhere u.team_id = 1;\nSELECT * FROM social_accounts WHERE sociable_id = 1635;\nSELECT * FROM users WHERE id = 1635;\n\nselect * from teams where id = 1;\nselect * from users where team_id = 1;\nselect * from team_features where team_id = 1;\nselect * from features;\n\nSELECT * FROM activity_searches where id = 1982; # 1981\nSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;\n\nSELECT * FROM automated_reports where id = 68;\nUPDATE automated_reports set playbook_categories = NULL where id = 68;\nSELECT * FROM automated_report_results where id = 275;\n\nSELECT * FROM automated_reports order by id desc;\nSELECT * FROM automated_report_results order by id desc;\nselect * from activity_searches where user_id = 143;\nselect * from ask_anything_prompts;\n\nSELECT * FROM groups WHERE id = 1439;\nSELECT * FROM users WHERE group_id = 1439;\n\nselect * from permissions; # 158\nselect * from roles;\nselect * from permission_role\n\nselect * from teams where id = 1;\nselect * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;\nselect * from groups where id = 28;\nselect * from playbooks where team_id = 1;\nselect * from playbooks where id = 179;\nselect * from playbook_categories where id = 1391;\nselect * from users where id = 143;\nselect * from crm_profiles where user_id = 143;\nselect * from activities where crm_configuration_id = 39 and type = 'conference'\nand crm_provider_id IS NOT NULL ORDER by id desc;\nselect * from activities where id = 422003; # 00UO400000pB6fpMAC\n\nSELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type\nFROM automated_report_results ar\nJOIN automated_reports a ON a.id = ar.report_id\nWHERE a.type = 'ask_jiminny'\nLIMIT 10;\n\nSELECT `automated_report_results`.* FROM `automated_report_results`\nINNER JOIN `automated_reports`\n ON `automated_report_results`.`report_id` = `automated_reports`.`id`\nWHERE `automated_report_results`.`generated_at` IS NOT NULL\n AND `automated_reports`.`team_id` = 1\n AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$.\"users\"')\n;\n\n\nselect * from teams where id = 3143;\nselect * from crm_configurations where id = 500;\nselect * from users where name = 'Integration Account'; # 1695\nSELECT * FROM social_accounts WHERE sociable_id = 1695;\n\nselect * from activities where crm_configuration_id = 39\nand recording_state = 'recorded' and duration > 60\nand status = 'completed' and actual_start_time >= '2025-12-01';\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;\n\nselect * from leads;","depth":4,"value":"SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o\nJOIN activities a ON o.id = a.opportunity_id\nWHERE a.crm_configuration_id = 39\nAND a.actual_start_time > '2025-10-13'\nAND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM activities\nWHERE crm_configuration_id = 39 and user_id = 143\nand actual_start_time >= '2025-10-13'\nAND type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM opportunities WHERE account_id IN (178);\nselect * from activities where id IN (620137, 620187, 620188, 620189, 620230);\n\n# HS\nSELECT * FROM opportunities WHERE id IN (238);\nselect * from activities where id IN (477,2076);\n\nselect * from users;\n\nSELECT COUNT(*) FROM users;\nSELECT COUNT(*) FROM activities;\nSELECT COUNT(*) FROM opportunities;\n\nUPDATE activities\nSET\n actual_start_time = '2025-12-19 09:00:00',\n actual_end_time = '2025-12-19 10:30:00',\n scheduled_start_time = '2025-12-19 09:00:00',\n scheduled_end_time = '2025-12-19 10:30:00'\nWHERE id IN (407509,407375);\n\nselect * from partners;\n\nSELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id\nFROM activities\nWHERE user_id = 143\nAND actual_start_time >= '2025-10-13 00:00:00'\nAND actual_start_time <= '2026-01-13 23:59:59'\nORDER BY actual_start_time DESC;\n\nSELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;\nSELECT * FROM crm_layouts where crm_configuration_id = 39;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;\n# lead_id\n# account_id 177\n# contact_id 3969\n# opportunity_id\n# stage_id 203\n\nSELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;\n\nSELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'\nAND user_id = 143 and actual_start_time >= '2025-10-13';\n\nSELECT * FROM activities a\n# JOIN opportunities o ON a.opportunity_id = o.id\nWHERE a.crm_configuration_id = 39 AND a.type = 'conference'\nand status = 'completed' and recording_state = 'recorded'\nand a.actual_start_time >= '2025-10-13'\nAND a.user_id = 143\n;\n\nselect * from leads\nwhere crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707\n\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310);\nSELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198\nSELECT * FROM activities WHERE id IN (356001, 356008); # contacts:\n\nSELECT * FROM opportunities WHERE id IN (1707);\nSELECT * FROM stages where id IN (204, 198);\nSELECT * FROM opportunities WHERE account_id IN (178);\nSELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';\nSELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal\n\nSELECT * FROM activities where crm_configuration_id = 39\nAND opportunity_id IS NULL\nAND is_internal = false\nand status = 'completed' and recording_state = 'recorded'\nAND actual_start_time >= '2025-10-13'\nAND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)\n# AND lead_id IN (112, 109)\n;\n\nSELECT * FROM crm_profiles WHERE user_id = 143;\n\nselect * from inboxes; # 212\nselect * from users where id = 143; # 143\nselect * from inbox_email_batches where inbox_id = 212\nand updated_at >= '2026-01-28 00:00:00' order by id desc;\nselect * from inbox_emails where inbox_id = 212\nand batch_id = 95885 order by id desc;\nselect * from email_messages where origin_user_id = 143;\nselect * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';\nselect * from participants where activity_id = 620247;\n\nselect * from crm_profiles where user_id = 143;\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001\nselect * from transcription where activity_id = 356001; # 6943\nselect * from ai_prompts where transcription_id = 6943;\nSELECT * FROM activity_summary_logs where activity_id = 356001;\n\nSELECT * FROM social_accounts WHERE sociable_id = 143;\n\n# ************************************************************************************\nSELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;\n# 422515 softphone tr. 8100\n\nSELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;\n# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS\n\nselect * from ai_prompts where transcription_id IN (8100, 7670);\nselect * from activity_summary_logs where activity_id = 407509;\n\nselect * from sidekick_settings;\nselect * from default_activity_types;\n\nSELECT * FROM contacts WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\nSELECT * FROM leads WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\n\nSELECT * FROM activity_searches where user_id = 143;\nSELECT * FROM groups where team_id = 1;\n\nselect * from teams where id = 1;\nselect * from groups where team_id = 1; # 1150 - 7e75f8025c22\nselect id, name, group_id, status, deleted_at, email\nfrom users where team_id = 1 order by group_id desc ;\n\nselect * from activity_searches where id in (1977, 1978, 1979);\nselect * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);\nselect * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277\nselect * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879\n\nINSERT INTO `activity_search_filters`\n(`activity_search_id`, `filter`, `value`) VALUES\n(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')\n;\n\nselect * from crm_configurations where id = 39;\n\n\nselect sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id\nwhere u.team_id = 1;\nSELECT * FROM social_accounts WHERE sociable_id = 1635;\nSELECT * FROM users WHERE id = 1635;\n\nselect * from teams where id = 1;\nselect * from users where team_id = 1;\nselect * from team_features where team_id = 1;\nselect * from features;\n\nSELECT * FROM activity_searches where id = 1982; # 1981\nSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;\n\nSELECT * FROM automated_reports where id = 68;\nUPDATE automated_reports set playbook_categories = NULL where id = 68;\nSELECT * FROM automated_report_results where id = 275;\n\nSELECT * FROM automated_reports order by id desc;\nSELECT * FROM automated_report_results order by id desc;\nselect * from activity_searches where user_id = 143;\nselect * from ask_anything_prompts;\n\nSELECT * FROM groups WHERE id = 1439;\nSELECT * FROM users WHERE group_id = 1439;\n\nselect * from permissions; # 158\nselect * from roles;\nselect * from permission_role\n\nselect * from teams where id = 1;\nselect * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;\nselect * from groups where id = 28;\nselect * from playbooks where team_id = 1;\nselect * from playbooks where id = 179;\nselect * from playbook_categories where id = 1391;\nselect * from users where id = 143;\nselect * from crm_profiles where user_id = 143;\nselect * from activities where crm_configuration_id = 39 and type = 'conference'\nand crm_provider_id IS NOT NULL ORDER by id desc;\nselect * from activities where id = 422003; # 00UO400000pB6fpMAC\n\nSELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type\nFROM automated_report_results ar\nJOIN automated_reports a ON a.id = ar.report_id\nWHERE a.type = 'ask_jiminny'\nLIMIT 10;\n\nSELECT `automated_report_results`.* FROM `automated_report_results`\nINNER JOIN `automated_reports`\n ON `automated_report_results`.`report_id` = `automated_reports`.`id`\nWHERE `automated_report_results`.`generated_at` IS NOT NULL\n AND `automated_reports`.`team_id` = 1\n AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$.\"users\"')\n;\n\n\nselect * from teams where id = 3143;\nselect * from crm_configurations where id = 500;\nselect * from users where name = 'Integration Account'; # 1695\nSELECT * FROM social_accounts WHERE sociable_id = 1695;\n\nselect * from activities where crm_configuration_id = 39\nand recording_state = 'recorded' and duration > 60\nand status = 'completed' and actual_start_time >= '2025-12-01';\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;\n\nselect * from leads;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"bounds":{"left":0.011968086,"top":0.047885075,"width":0.024268618,"height":0.024740623},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-5682276111922228423
|
1126710648141684156
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsRepositoryTest
Run 'AutomatedReportsRepositoryTest'
Debug 'AutomatedReportsRepositoryTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
102
3
34
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Kiosk\AutomatedReports;
use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Carbon\Exceptions\InvalidFormatException;
use DateTime;
use DateTimeInterface;
use DateTimeZone;
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcher;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Jiminny\Component\ActivitySearch\FilterDefinition\InputTypeEnum;
use Jiminny\Component\AskAnything\AskAnythingPromptService;
use Jiminny\Component\AskAnything\Dtos\AskAnythingPromptDto;
use Jiminny\Component\UrlGenerator\Webhook;
use Jiminny\Contracts\Repositories\PlaybookCategoryRepository;
use Jiminny\Contracts\Repositories\TeamRepository;
use Jiminny\Contracts\Repositories\UserRepository;
use Jiminny\Exceptions\ApplicationException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Exceptions\ModelNotFoundException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateReportJob;
use Jiminny\Models\Activity\Search;
use Jiminny\Models\AskAnything\AskAnythingPrompt;
use Jiminny\Models\AskAnything\AskAnythingPromptTarget;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Contracts\UserContract;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AskAnythingRepository;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Repositories\GroupRepository;
use Jiminny\Repositories\SearchRepository;
use Jiminny\Repositories\StageRepository;
use Throwable;
class AutomatedReportsService
{
public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';
public const string TYPE_ASK_JIMINNY = 'ask_jiminny';
/**
* Standard report types (used by kiosk for existing automated reports).
*/
// @TODO this will add filter, however if we need to control feature by FF we need conditional logic
public const array TYPES = [
['id' => 'exec_summary', 'name' => 'Exec Summary'],
['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],
['id' => 'product_feedback', 'name' => 'Product Feedback'],
['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],
// ['id' => 'questions', 'name' => 'Questions'],
// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],
];
public const array ALL_TYPES = [
...self::TYPES,
['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],
];
public const string FREQUENCY_DAILY = 'daily';
public const string FREQUENCY_WEEKLY = 'weekly';
public const string FREQUENCY_MONTHLY = 'monthly';
public const string FREQUENCY_QUARTERLY = 'quarterly';
public const string FREQUENCY_ONE_OFF = 'one_off';
/**
* Frequencies for standard (non-Ask Jiminny) reports.
*/
public const array FREQUENCIES = [
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
/**
* Frequencies for Ask Jiminny reports.
*/
public const array ASK_JIMINNY_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
];
public const string MEDIA_TYPE_PDF = 'pdf';
public const string MEDIA_TYPE_PODCAST = 'podcast';
public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];
public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];
public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];
public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];
public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];
public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];
public const int SENT_REPORT_AT_HOURS = 5;
public const string PDF_KEY = 'pdf';
public const string AUDIO_KEY = 'audio';
private const array ALL_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
private const string S3_DIR = 'reports';
private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];
private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];
public function __construct(
private readonly TeamRepository $teamRepository,
private readonly GroupRepository $groupRepository,
private readonly UserRepository $userRepository,
private readonly StageRepository $stageRepository,
private readonly DealStagesService $dealStagesService,
private readonly RecipientsService $recipientsService,
private readonly AutomatedReportsRepository $automatedReportsRepository,
private readonly Webhook $webhookService,
private readonly BusDispatcher $dispatcher,
private readonly ActivityTypeService $activityTypeService,
private readonly PlaybookCategoryRepository $playbookCategoryRepository,
private readonly AskAnythingPromptService $askAnythingPromptService,
private readonly SearchRepository $activitySearchRepository,
private readonly AskAnythingRepository $askAnythingRepository,
) {
}
public static function getTypes(): array
{
$types = self::TYPES;
return array_map(static function ($type) {
return $type['id'];
}, $types);
}
public static function getCallTypes(): array
{
return array_map(static function ($callType) {
return $callType['id'];
}, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);
}
public static function getFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::FREQUENCIES);
}
// front-facing structure
public function getReportEnabledFieldData(bool $value = false): array
{
return [
'id' => 'report_enabled',
'label' => '',
'inputType' => InputTypeEnum::TOGGLE,
'value' => $value,
];
}
// Organizations = Teams
public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array
{
$options = $this->getTeams();
if ($shortVersion) {
return [
'id' => 'organization',
'label' => 'Organization',
'options' => $options,
];
}
return [
'id' => 'organization',
'label' => 'Organization',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $options,
'value' => $value,
'dependencies' => [
'teams',
'deal_stage_at_call',
'current_deal_stage',
'recipients',
ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,
],
'dependsOn' => [],
];
}
// Teams = Groups
public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array
{
if ($shortVersion) {
return [
'id' => 'teams',
'label' => 'Team',
'options' => $options,
];
}
return [
'id' => 'teams',
'label' => 'Team',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => false,
'placeholder' => 'Select',
'options' => $options,
'value' => $value, // value should be an array of objects {id, name}
'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],
'dependsOn' => [],
];
}
public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array
{
$types = [];
if ($team instanceof Team) {
if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
$types = self::TYPES;
}
if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {
$types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];
}
} else {
$types = self::TYPES;
}
if ($shortVersion) {
return [
'id' => 'report_type',
'label' => 'Report Type',
'options' => $types,
];
}
return [
'id' => 'report_type',
'label' => 'Report Type',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $types,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getFrequencyFieldData(?string $value = null): array
{
return [
'id' => 'frequency',
'label' => 'Frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => self::FREQUENCIES,
'value' => $value,
'dependencies' => ['period'],
'dependsOn' => [],
];
}
public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array
{
return [
'id' => 'period',
'label' => 'Select one-off period',
'inputType' => InputTypeEnum::DATE_RANGE,
'required' => true,
'placeholder' => 'Select',
'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],
'queryParams' => [
'startDate' => 'start_date_period',
'endDate' => 'end_date_period',
],
'dependencies' => [],
'dependsOn' => ['frequency'],
];
}
public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array
{
return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);
}
public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);
}
public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);
}
public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'deal_value',
'label' => 'Deal Value',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_deal_value',
'max' => 'max_deal_value',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array
{
$value = [];
$conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;
$dialerOn && $value[] = self::CALL_TYPE_DIALER;
return [
'id' => 'call_type',
'label' => 'Call Type',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => [
self::CALL_TYPE_CONFERENCE,
self::CALL_TYPE_DIALER,
],
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getMediaTypeFieldData(?AutomatedReport $report = null): array
{
$value = [];
if ($report) {
$value = $this->transformMediaTypes($report);
}
return [
'id' => 'media_types',
'label' => 'Export as',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => self::MEDIA_TYPE_OBJECTS,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'call_duration',
'label' => 'Call Duration',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_call_duration',
'max' => 'max_call_duration',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getRecipientsFieldData(?Team $team = null, array $value = []): array
{
return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);
}
public function getJiminnyRecipientsFieldData(array $value = []): array
{
return $this->recipientsService->getJiminnyRecipientsFieldData($value);
}
public function getAdditionalPromptInputFieldData(?string $value = null): array
{
return [
'id' => 'additional_prompt_input',
'label' => 'Special requirements',
'inputType' => InputTypeEnum::TEXTAREA,
'required' => false,
'placeholder' => 'What should be the focus of the report?',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCustomReportNameFieldData(?string $value = null): array
{
return [
'id' => 'custom_name',
'label' => 'Custom report name',
'inputType' => InputTypeEnum::TEXT,
'required' => false,
'placeholder' => 'Enter custom name',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
// data providers
public function getTeams(): array
{
$teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);
$teamData = [];
foreach ($teams as $team) {
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
continue;
}
$teamData[] = $this->transformTeam($team);
}
return $teamData;
}
public function getTeamGroups(string $teamUuid): array
{
$data = [];
$team = $this->getTeam($teamUuid);
if ($team !== null) {
$groups = $team->groups()->get();
foreach ($groups as $group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
];
}
}
return $data;
}
public function getTeamsGroupsOptions(array $filterTeamUuids = []): array
{
$data = [];
$teams = $this->getTeams();
foreach ($teams as $team) {
if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {
continue;
}
$data[] = [
'label' => $team['name'],
'groups' => $this->getTeamGroups($team['id']),
];
}
return $data;
}
public function getTeam(string $teamUuid): ?Team
{
return $this->teamRepository->idOrUuid($teamUuid);
}
public function getTeamById(int $teamId): ?Team
{
return $this->teamRepository->find($teamId);
}
public function getGroupsUuids(AutomatedReport $report): array
{
$uuids = [];
$reportGroups = $report->getGroups();
foreach ($reportGroups as $groupId) {
if ($group = $this->groupRepository->find($groupId)) {
$uuids[] = $group->getUuid();
}
}
return $uuids;
}
public function getPlaybookCategoriesUuids(AutomatedReport $report): array
{
$uuids = [];
$playbookCategories = $report->getPlaybookCategories();
foreach ($playbookCategories as $id) {
if ($category = $this->playbookCategoryRepository->find($id)) {
$uuids[] = $category->getUuid();
}
}
return $uuids;
}
public function getDealAtCallStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getDealAtCallStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getCurrentDealStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getCurrentDealStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getRecipients());
}
public function getJiminnyUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function extractUserUuids(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => $user->getUuid())
->values()
->all();
}
// get mail data
public function getRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getRecipients());
}
/**
* @return array<UserContract>
*/
public function getRecipientUserObjects(AutomatedReport $report): array
{
$userIds = $report->getRecipients()['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->values()
->all();
}
private function getJiminnyRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function buildRecipientUsers(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => [
'email' => $user->getEmailAddress(),
'name' => $user->getName(),
'timezone' => $user->getTimezone()->getName(),
])
->values()
->all();
}
public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array
{
if ($report->isAskJiminnyReport()) {
$recipients = $this->resolveAskJiminnyRecipients($report);
} else {
$recipients = $this->getRecipientUsers($report);
if ($includeJiminny) {
$recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));
}
}
$emails = [];
return array_values(array_filter(
$recipients,
static function ($recipient) use (&$emails) {
if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {
return false;
}
$emails[] = $recipient['email'];
return true;
}
));
}
private function resolveAskJiminnyRecipients(AutomatedReport $report): array
{
$recipients = [];
$creator = $report->getCreator();
if ($creator !== null) {
$recipients[] = [
'email' => $creator->getEmailAddress(),
'name' => $creator->getName(),
'timezone' => $creator->getTimezone()->getName(),
];
}
return array_merge(
$recipients,
$this->buildRecipientUsers($report->getRecipients()),
$this->getGroupRecipientUsers($report),
);
}
private function getGroupRecipientUsers(AutomatedReport $report): array
{
$users = [];
foreach ($report->getGroups() as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group === null) {
continue;
}
foreach ($group->getMembers() as $member) {
$users[] = [
'email' => $member->getEmailAddress(),
'name' => $member->getName(),
'timezone' => $member->getTimezone()->getName(),
];
}
}
return $users;
}
public function getReportTypeName(AutomatedReportResult $report): string
{
$type = $report->getReport()->getType();
$getType = $this->transformReportType($type);
return $getType['name'];
}
public function getReportPeriodName(AutomatedReportResult $report): string
{
$from = $report->getFromDate();
$to = $report->getToDate();
$frequency = $report->getReport()->getFrequency();
if ($from === null || $to === null) {
if (! $report->getReport()->isAskJiminnyReport()) {
$invalidPeriod = $from === null ? 'from' : 'to';
throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);
}
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
}
return $this->formatReportPeriodName($frequency, $from, $to);
}
private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string
{
$fromYear = $from->format('Y');
$toYear = $to->format('Y');
$differentYears = $fromYear !== $toYear;
switch ($frequency) {
case self::FREQUENCY_DAILY:
return $from->format('j M Y');
case self::FREQUENCY_QUARTERLY:
// 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ
$startMonth = $from->format('M');
$endMonth = $to->copy()->subMonth();
$endMonthName = $endMonth->format('M');
$endMonthYear = $endMonth->format('Y');
if ($differentYears) {
return "{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}";
}
return "{$startMonth} - {$endMonthName} {$toYear}";
case self::FREQUENCY_MONTHLY:
// 'May 2025' - monthly reports are always within the same year
return $from->format('M Y');
case self::FREQUENCY_WEEKLY:
// '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ
$startDay = $from->format('j');
$endDay = $to->format('j');
$startMonth = $from->format('M');
$endMonth = $to->format('M');
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
if ($startMonth !== $endMonth) {
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
}
return "{$startDay} - {$endDay} {$endMonth} {$toYear}";
case self::FREQUENCY_ONE_OFF:
// '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ
$startDay = $from->format('j');
$startMonth = $from->format('M');
$endDay = $to->format('j');
$endMonth = $to->format('M');
// If same month and year, use a format like '2-31 May 2025'
if ($startMonth === $endMonth && ! $differentYears) {
return "{$startDay} - {$endDay} {$startMonth} {$toYear}";
}
// If different years, include both years
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
// Same year but different months
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
default:
// Default format for unknown frequencies
return $from->format('j M Y') . ' - ' . $to->format('j M Y');
}
}
public function getReportTeamsName(AutomatedReportResult $report): string
{
$groups = $report->getGroups();
if (empty($groups)) {
return 'All';
}
// Get group names from repository
$groupNames = [];
foreach ($groups as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group) {
$groupNames[] = $group->getName();
}
}
if (count($groupNames) === 1) {
// Single team format
$teamsName = $groupNames[0];
} else {
// Multiple teams format
$teamsName = implode(', ', $groupNames);
}
return $teamsName;
}
public function getReportFileName(AutomatedReportResult $report): string
{
$customName = $report->getReport()->getCustomName();
$periodName = $this->getReportPeriodName($report);
$filenameSuffix = $this->getFilenameSuffix($report);
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$customName} - {$periodName}");
}
$baseName = $this->getReportTypeName($report);
if ($filenameSuffix) {
$baseName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}");
}
public function getReportFileNameWithExtension(AutomatedReportResult $result): string
{
$extension = $this->getMediaTypeMetadata($result)['extension'];
return $this->getReportFileName($result) . '.' . $extension;
}
public function sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool
{
$recipients = array_map('intval', $report->getRecipients()['users'] ?? []);
return in_array($user->getId(), $recipients);
}
public function transformReportResults(Collection $automatedReportResults): array
{
$data = [];
foreach ($automatedReportResults as $automatedReportResult) {
/** @var AutomatedReportResult $automatedReportResult */
$report = $automatedReportResult->getReport();
$createdBy = $report->getCreator();
$creator = [
'id' => $createdBy?->getUuid(),
'name' => $createdBy?->getName(),
'email' => $createdBy?->getEmailAddress(),
'photoUrl' => $createdBy?->getPhotoUrl(),
];
$data[] = [
'id' => $automatedReportResult->getUuid(),
'name' => $automatedReportResult->getName(),
'frequency' => $this->transformFrequency($report->getFrequency()),
'recipients' => $this->buildRecipients($report),
'report_type' => $this->transformReportType($report->getType()),
'media_type' => $automatedReportResult->getMediaType(),
'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),
'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),
'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),
'creator' => $creator,
];
}
return $data;
}
private function buildRecipients(AutomatedReport $report): array
{
$recipients = array_values($this->transformRecipients($report->getRecipients()));
if (! $report->isAskJiminnyReport()) {
return $recipients;
}
return [
...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),
...$recipients,
];
}
public function hasCallTypeConference(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);
}
public function hasCallTypeDialer(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);
}
// transformers
private function transformTeam(Team $team): array
{
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
return [];
}
return [
'id' => $team->getUuid(),
'name' => $team->getName(),
];
}
private function transformReportFullView(AutomatedReport $report): array
{
$base = $this->transformReportBase($report);
return $report->getType() === self::TYPE_ASK_JIMINNY
? $base + $this->transformAskJiminnyFields($report)
: $base + $this->transformStandardReportFields($report);
}
private function transformReportBase(AutomatedReport $report): array
{
return [
'id' => $report->getUuid(),
'organization' => $this->transformOrganization(team: $report->getTeam()),
'report_type' => $this->transformReportType($report->getType()),
'frequency' => $this->transformFrequency($report->getFrequency()),
];
}
private function transformStandardReportFields(AutomatedReport $report): array
{
$team = $report->getTeam();
return [
'report_enabled' => $report->getStatus(),
'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),
'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),
'deal_value_min' => $report->getDealValueMin(),
'deal_value_max' => $report->getDealValueMax(),
'call_types' => $this->transformCallType($report->getCallTypes()),
'media_types' => $this->transformMediaTypes($report),
'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),
'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),
'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),
'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),
'recipients' => $this->transformRecipients($report->getRecipients()),
'created_by' => $this->transformCreator($report->getCreator()),
'additional_prompt_input' => $report->getAdditionalPromptInput(),
'custom_name' => $report->getCustomName(),
'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),
'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),
'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),
];
}
private function transformAskJiminnyFields(AutomatedReport $report): array
{
$team = $report->getTeam();
$creatorId = $report->getAttribute('created_by');
$explicitUserIds = array_values(array_filter(
$report->getRecipients()['users'] ?? [],
static fn ($id) => $id !== $creatorId
));
return [
'report_name' => $report->getCustomName(),
'enabled' => $report->getStatus(),
'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),
'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),
'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),
'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),
];
}
private function transformOrganization(?Team $team): array
{
return [
'id' => $team?->getUuid(),
'name' => $team?->getName(),
];
}
private function transformReportType(string $type): array
{
foreach (self::ALL_TYPES as $typeItem) {
if ($typeItem['id'] === $type) {
return $typeItem;
}
}
return [];
}
private function transformCallType(array $types): array
{
$result = [];
$callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];
foreach ($types as $type) {
foreach ($callTypes as $callTypeItem) {
if ($callTypeItem['id'] === $type) {
$result[] = $callTypeItem;
break;
}
}
}
return $result;
}
private function transformMediaTypes(AutomatedReport $report): array
{
$values = [];
foreach ($report->getMediaTypes() as $mediaType) {
if (! in_array($mediaType, self::MEDIA_TYPES, true)) {
continue;
}
$values[] = match ($mediaType) {
self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,
self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,
};
}
return $values;
}
private function transformFrequency(string $frequency): array
{
foreach (self::ALL_FREQUENCIES as $frequencyItem) {
if ($frequencyItem['id'] === $frequency) {
return $frequencyItem;
}
}
return [];
}
public function transformDurationToMinutes(?int $duration): ?int
{
if (! $duration) {
return null;
}
return (int) ($duration / 60);
}
private function transformGroups(?Team $team, array $groupsIds): array
{
if (empty($groupsIds) || ! $team) {
return [];
}
$data = [];
foreach ($groupsIds as $groupId) {
$group = $team->groups()->where('id', $groupId)->first();
if ($group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
'photoUrl' => $group->getPhotoUrl(),
];
}
}
return $data;
}
private function transformStages(?Team $team, array $stagesIds): array
{
if (empty($stagesIds) || ! $team) {
return [];
}
$data = [];
foreach ($stagesIds as $stageId) {
$stage = $team->stages()->where('id', $stageId)->first();
if ($stage) {
$data[] = [
'id' => $stage->getUuid(),
'name' => $stage->getName(),
];
}
}
return $data;
}
private function transformRecipients(array $recipients): array
{
$users = [];
foreach ($recipients['users'] ?? [] as $userId) {
$users[] = $this->transformUser($userId);
}
return $users;
}
private function transformCreator(?User $user): ?array
{
if ($user === null) {
return null;
}
return $this->transformUser($user->getId());
}
private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array
{
if ($prompt === null) {
return null;
}
return [
'id' => $prompt->getUuid(),
'name' => $prompt->getTitle(),
];
}
private function transformSafeSearch(?Search $search): ?array
{
if ($search === null) {
return null;
}
return [
'id' => $search->getUuid(),
'name' => $search->getName(),
];
}
private function transformUser(int $userId): array
{
/* @var ?User $user */
$user = $this->userRepository->find($userId);
return [
'id' => $user?->getUuid(),
'name' => $user?->getName(),
'email' => $user?->getEmailAddress(),
'photoUrl' => $user?->getPhotoUrl(),
];
}
public function create(array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$validatedData['created_by'] = auth()->id();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
public function update(string $uuid, array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$report = $this->automatedReportsRepository->findByUuid($uuid);
if (! $report) {
throw new InvalidArgumentException('Report not found');
}
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
/**
* Create an Ask Jiminny report.
*/
public function createAskJiminnyReport(array $data, User $creator): array
{
$validatedData = $this->validateAskJiminnyReportData($data, $creator);
$validatedData['created_by'] = $creator->getId();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
return $this->transformReportFullView($automatedReport);
}
/**
* Update an Ask Jiminny report.
*/
public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array
{
if (! $report->isAskJiminnyReport()) {
throw new InvalidArgumentException('Report is not an Ask Jiminny report');
}
$validatedData = $this->validateAskJiminnyReportData($data, $user);
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
return $this->transformReportFullView($automatedReport);
}
public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array
{
$this->automatedReportsRepository->update($report, ['status' => $status]);
return $this->transformReportFullView($report->fresh());
}
/**
* Validate and transform data for Ask Jiminny reports.
*/
private function validateAskJiminnyReportData(array $data, User $user): array
{
// Validate name
$name = trim($data['report_name'] ?? '');
if (empty($name)) {
throw new InvalidArgumentException('Report name is required');
}
if (mb_strlen($name) > 50) {
throw new InvalidArgumentException('Report name must be 50 characters or less');
}
// Validate frequency (only daily, weekly, monthly for Ask Jiminny)
$frequency = $data['frequency'] ?? null;
$askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];
if (! in_array($frequency, $askJiminnyFrequencies, true)) {
throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');
}
// Validate expiration date
$expiresAt = $data['expires_on'] ?? null;
if (empty($expiresAt)) {
throw new InvalidArgumentException('Expiration date is required');
}
try {
$expiresAtDate = Carbon::parse($expiresAt);
} catch (InvalidFormatException $e) {
throw new InvalidArgumentException('Expiration date format is invalid');
}
$maxExpiration = Carbon::now()->addYear()->endOfDay();
if ($expiresAtDate->gt($maxExpiration)) {
throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');
}
if ($expiresAtDate->isPast()) {
throw new InvalidArgumentException('Expiration date cannot be in the past');
}
// Validate saved search
$activitySearchId = $data['saved_search'] ?? null;
if (empty($activitySearchId)) {
throw new InvalidArgumentException('Saved search is required');
}
$savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);
if (! $savedSearch) {
throw new InvalidArgumentException('Saved search not found or does not belong to you');
}
// Validate saved prompt
$askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;
if (empty($askAnythingPromptId)) {
throw new InvalidArgumentException('Ask Jiminny prompt is required');
}
$prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);
if (! $prompt) {
throw new InvalidArgumentException('Ask Jiminny prompt not found');
}
// Validate status
$status = $data['enabled'] ?? false;
$recipientUserIds = [$user->getId()];
if (! empty($data['share_users'])) {
$sharedUserIds = $this->validateAndGetUserIdsByTeam(
$user->team,
(array) $data['share_users']
);
$recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);
}
$sharedGroupIds = [];
if (! empty($data['share_teams'])) {
$sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);
}
$recipientUserIds = array_values(array_unique($recipientUserIds));
return [
'team_id' => $user->getTeamId(),
'type' => self::TYPE_ASK_JIMINNY,
'status' => (bool) $status,
'frequency' => $frequency,
'custom_name' => $name,
'activity_search_id' => $savedSearch->getId(),
'ask_anything_prompt_id' => $prompt->getId(),
'expires_at' => $expiresAtDate->toDateString(),
'media_types' => [self::MEDIA_TYPE_PDF],
'call_types' => [],
'recipients' => ['users' => $recipientUserIds],
'groups' => $sharedGroupIds,
];
}
public static function getAskJiminnyFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::ASK_JIMINNY_FREQUENCIES);
}
public function getAskJiminnyReportFilters(User $user): array
{
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
return [
[
'id' => 'prompt',
'label' => 'Prompt',
'options' => $prompts,
],
[
'id' => 'saved_search',
'label' => 'Saved Search',
'options' => $savedSearches,
],
];
}
public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array
{
$team = $user->getTeam();
$userTimezone = $user->getTimezone();
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
$teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [
'id' => $group->getUuid(),
'name' => $group->getName(),
])->values()->all();
$shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];
$sharedTeamsValue = [];
$sharedUsersValue = [];
if ($report) {
$sharedTeamsValue = $this->transformGroups($team, $report->getGroups());
$recipientUserIds = $report->getRecipients()['users'] ?? [];
$creatorId = $report->getAttribute('created_by');
$sharedUserIds = array_values(array_filter(
$recipientUserIds,
static fn ($id) => $id !== $creatorId
));
$sharedUsersValue = collect($sharedUserIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (User $u) => [
'id' => $u->getUuid(),
'name' => $u->getName(),
])
->values()
->all();
}
return [
'fields' => [
[
'id' => 'enabled',
'inputType' => InputTypeEnum::TOGGLE,
'label' => '',
'value' => $report?->getStatus() ?? false,
],
[
'id' => 'report_name',
'inputType' => InputTypeEnum::TEXT,
'label' => 'Name',
'placeholder' => 'Enter name',
'required' => true,
'validation' => ['maxLength' => 50],
'value' => $report?->getCustomName() ?? '',
],
[
'id' => 'frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'label' => 'Frequency',
'required' => true,
'placeholder' => 'Select',
'options' => self::ASK_JIMINNY_FREQUENCIES,
'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,
],
[
'id' => 'expires_on',
'inputType' => InputTypeEnum::DATE,
'label' => 'Expires on',
'required' => true,
'placeholder' => 'Select',
'validation' => [
'minDate' => now($userTimezone)->toDateString(),
'maxDate' => now($userTimezone)->addYear()->toDateString(),
],
'value' => $report?->getExpiresAt()?->toDateString(),
],
[
...
|
NULL
|
|
66724
|
NULL
|
0
|
2026-04-21T14:58:52.762638+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776783532762_m2.jpg...
|
Slack
|
Aneliya Angelova (DM) - Jiminny Inc - Slack
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Today at 5:36:07 PM
5:36
eto go reporta w kiosk
image.png
Toggle file
image.png
Download image.png
Share file: image.png
View canvas details
More actions
Today at 5:36:33 PM
5:36
той трябва да се шерне само с Web Service Account 2
Today at 5:40:40 PM
5:40
вие нали използвате тази колона
groups
в момента при новите репорти за да сложите тимовете с които се шерва, а при репортите в киоска няма шерване с екипи и в тази колона за екипите от чиито активитита се филтрират активитита за репортите
Lukas Kovalik
Today at 5:41:02 PM
5:41 PM
да
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:41:09 PM
5:41
може ли да се чуем само да вид на прод
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:41:47 PM
5:41
или пак то може и без
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:41:51 PM
5:41
сега ще видя
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 5:43:08 PM
5:43 PM
може да се чуем да
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:43:09 PM
5:43
само кажи
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 5:58:04 PM
5:58 PM
ок мисля че го оправих вече, само да го изтествам
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:58:17 PM
5:58
за другите неща нещо се обръках
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:58:20 PM
5:58
Галя иска в колоната SHARED
значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като “Shared With”
Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
ако съм creator на template
ако съм creator на template
Shift + Return to add a new line
Shift + Return
to add a new line
Todor Stamatov, Direct Message, 1 of 15 suggestions
Channel...
|
[{"role":"AXPopUpButton","text [{"role":"AXPopUpButton","text":"Switch workspaces… (Jiminny Inc) Has new messages","depth":14,"bounds":{"left":0.0056515955,"top":0.058260176,"width":0.011968086,"height":0.028731046},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"Home","depth":14,"bounds":{"left":0.0029920214,"top":0.10055866,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Home","depth":16,"bounds":{"left":0.0066489363,"top":0.13806863,"width":0.009973404,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"DMs","depth":14,"bounds":{"left":0.0029920214,"top":0.15482841,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"DMs","depth":16,"bounds":{"left":0.0076462766,"top":0.19233839,"width":0.007978723,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Activity","depth":14,"bounds":{"left":0.0029920214,"top":0.20909816,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Activity","depth":16,"bounds":{"left":0.004986702,"top":0.24660814,"width":0.012965426,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":14,"bounds":{"left":0.0029920214,"top":0.26336792,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":16,"bounds":{"left":0.0076462766,"top":0.3008779,"width":0.0076462766,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Later","depth":14,"bounds":{"left":0.0029920214,"top":0.31763768,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Later","depth":16,"bounds":{"left":0.00731383,"top":0.35514766,"width":0.008643617,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"More…","depth":14,"bounds":{"left":0.0029920214,"top":0.3719074,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More","depth":16,"bounds":{"left":0.006981383,"top":0.4094174,"width":0.008976064,"height":0.0103751},"role_description":"text"},{"role":"AXStaticText","text":"Unreads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Threads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Huddles","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Drafts & sent","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Directories","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-x-integration-app","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-inner-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"ai-chapter","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"alerts","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"backend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"c-learning-people","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"confusion-clinic","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"curiosity_lab","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"engineering","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"frontend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"general","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"infra-changes","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-bg","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-copilot-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-zoom-phone-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-tickets","depth":23,"bounds":{"left":0.042220745,"top":0.096568234,"width":0.034906916,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"product_launches","depth":23,"bounds":{"left":0.042220745,"top":0.118914604,"width":0.03856383,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"random","depth":23,"bounds":{"left":0.042220745,"top":0.14126097,"width":0.01662234,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"releases","depth":23,"bounds":{"left":0.042220745,"top":0.16360734,"width":0.018284574,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"support","depth":23,"bounds":{"left":0.042220745,"top":0.1859537,"width":0.016954787,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"thank-yous","depth":23,"bounds":{"left":0.042220745,"top":0.20830008,"width":0.024268618,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"the_people_of_jiminny","depth":23,"bounds":{"left":0.042220745,"top":0.23064645,"width":0.04488032,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"bounds":{"left":0.042220745,"top":0.28332004,"width":0.03756649,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"bounds":{"left":0.042220745,"top":0.3056664,"width":0.03756649,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"bounds":{"left":0.07945479,"top":0.3056664,"width":0.0063164895,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"bounds":{"left":0.08211436,"top":0.3056664,"width":0.014295213,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"bounds":{"left":0.09607713,"top":0.32322428,"width":0.0003324468,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Steliyan Georgiev","depth":23,"bounds":{"left":0.09607713,"top":0.32322428,"width":0.0003324468,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Mario Georgiev","depth":23,"bounds":{"left":0.042220745,"top":0.32801276,"width":0.033909574,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"bounds":{"left":0.042220745,"top":0.35035914,"width":0.032912236,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Todor Stamatov","depth":23,"bounds":{"left":0.042220745,"top":0.37270552,"width":0.034242023,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Gabriela Dureva","depth":23,"bounds":{"left":0.042220745,"top":0.39505187,"width":0.03523936,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Petko Kashinski","depth":23,"bounds":{"left":0.042220745,"top":0.41739824,"width":0.034242023,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Vasil Vasilev","depth":23,"bounds":{"left":0.042220745,"top":0.43974462,"width":0.026263298,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Nikolov","depth":23,"bounds":{"left":0.042220745,"top":0.46209097,"width":0.034242023,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Galya Dimitrova","depth":23,"bounds":{"left":0.042220745,"top":0.48443735,"width":0.034906916,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Stefka Stoyanova","depth":23,"bounds":{"left":0.042220745,"top":0.5067837,"width":0.03756649,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tomov","depth":23,"bounds":{"left":0.042220745,"top":0.5291301,"width":0.030585106,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tanev","depth":23,"bounds":{"left":0.042220745,"top":0.5514765,"width":0.028922873,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Ivanov","depth":23,"bounds":{"left":0.042220745,"top":0.5738228,"width":0.031914894,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Ves","depth":23,"bounds":{"left":0.042220745,"top":0.5961692,"width":0.0076462766,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Jira Cloud","depth":23,"bounds":{"left":0.042220745,"top":0.64884275,"width":0.021609042,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Toast","depth":23,"bounds":{"left":0.042220745,"top":0.6711891,"width":0.011635638,"height":0.014365523},"role_description":"text"},{"role":"AXRadioButton","text":"Messages","depth":17,"bounds":{"left":0.10206117,"top":0.09177973,"width":0.030585106,"height":0.030327214},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Messages","depth":19,"bounds":{"left":0.111369684,"top":0.10055866,"width":0.01861702,"height":0.012769354},"role_description":"text"},{"role":"AXRadioButton","text":"Add canvas","depth":18,"bounds":{"left":0.13397606,"top":0.09177973,"width":0.033909574,"height":0.030327214},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Add canvas","depth":20,"bounds":{"left":0.14328457,"top":0.10055866,"width":0.021941489,"height":0.012769354},"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":17,"bounds":{"left":0.16921543,"top":0.09177973,"width":0.020944148,"height":0.030327214},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":19,"bounds":{"left":0.17852394,"top":0.10055866,"width":0.008976064,"height":0.012769354},"role_description":"text"},{"role":"AXPopUpButton","text":"Add and Edit Channel Tabs","depth":17,"bounds":{"left":0.19115691,"top":0.09177973,"width":0.010970744,"height":0.030327214},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Canvas","depth":17,"bounds":{"left":0.096409574,"top":0.0518755,"width":0.015625,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"List","depth":17,"bounds":{"left":0.096409574,"top":0.0518755,"width":0.0076462766,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Folder","depth":17,"bounds":{"left":0.096409574,"top":0.0518755,"width":0.013962766,"height":0.0007980846},"role_description":"text"},{"role":"AXPopUpButton","text":"Jump to date","depth":23,"bounds":{"left":0.15026596,"top":0.12689546,"width":0.025265958,"height":0.022346368},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:36:07 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:36","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"eto go reporta w kiosk","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"image.png","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"","depth":25,"role_description":"text"},{"role":"AXButton","text":"Toggle file","depth":25,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXLink","text":"image.png","depth":27,"role_description":"Unlabelled image","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Download image.png","depth":28,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Share file: image.png","depth":28,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View canvas details","depth":28,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":28,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:36:33 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:36","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"той трябва да се шерне само с Web Service Account 2","depth":25,"role_description":"text"},{"role":"AXLink","text":"Today at 5:40:40 PM","depth":25,"bounds":{"left":0.107380316,"top":0.11811652,"width":0.007978723,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:40","depth":26,"bounds":{"left":0.107380316,"top":0.11811652,"width":0.007978723,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"вие нали използвате тази колона","depth":25,"bounds":{"left":0.11801862,"top":0.11572227,"width":0.0774601,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"groups","depth":26,"bounds":{"left":0.19680852,"top":0.11811652,"width":0.014295213,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"в момента при новите репорти за да сложите тимовете с които се шерва, а при репортите в киоска няма шерване с екипи и в тази колона за екипите от чиито активитита се филтрират активитита за репортите","depth":25,"bounds":{"left":0.11801862,"top":0.11572227,"width":0.10239362,"height":0.10215483},"role_description":"text"},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"bounds":{"left":0.11801862,"top":0.22585794,"width":0.030917553,"height":0.017557861},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.14860372,"top":0.22745411,"width":0.0029920214,"height":0.014365523},"role_description":"text"},{"role":"AXLink","text":"Today at 5:41:02 PM","depth":24,"bounds":{"left":0.1512633,"top":0.22984837,"width":0.015292553,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:41 PM","depth":25,"bounds":{"left":0.1512633,"top":0.22984837,"width":0.015292553,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"да","depth":25,"bounds":{"left":0.11801862,"top":0.24501197,"width":0.0056515955,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.2122905,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.2122905,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.2122905,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.2122905,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.2122905,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.2122905,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.2122905,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.2122905,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:41:09 PM","depth":25,"bounds":{"left":0.107380316,"top":0.27134877,"width":0.007978723,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:41","depth":26,"bounds":{"left":0.107380316,"top":0.27134877,"width":0.007978723,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"може ли да се чуем само да вид на прод","depth":25,"bounds":{"left":0.11801862,"top":0.26895452,"width":0.09375,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.2442139,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.2442139,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.2442139,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.2442139,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.2442139,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.2442139,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.2442139,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.2442139,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:41:47 PM","depth":25,"bounds":{"left":0.107380316,"top":0.2952913,"width":0.007978723,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:41","depth":26,"bounds":{"left":0.107380316,"top":0.2952913,"width":0.007978723,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"или пак то може и без","depth":25,"bounds":{"left":0.11801862,"top":0.29289705,"width":0.051529255,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.26815644,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.26815644,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.26815644,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.26815644,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.26815644,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.26815644,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.26815644,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.26815644,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:41:51 PM","depth":25,"bounds":{"left":0.107380316,"top":0.31923383,"width":0.007978723,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:41","depth":26,"bounds":{"left":0.107380316,"top":0.31923383,"width":0.007978723,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"сега ще видя","depth":25,"bounds":{"left":0.11801862,"top":0.31683958,"width":0.029920213,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.29209897,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.29209897,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.29209897,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.29209897,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.29209897,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.29209897,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.29209897,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.29209897,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"bounds":{"left":0.11801862,"top":0.33918595,"width":0.038896278,"height":0.017557861},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.15658244,"top":0.34078214,"width":0.0029920214,"height":0.014365523},"role_description":"text"},{"role":"AXLink","text":"Today at 5:43:08 PM","depth":24,"bounds":{"left":0.15924202,"top":0.34317636,"width":0.015292553,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:43 PM","depth":25,"bounds":{"left":0.15924202,"top":0.34317636,"width":0.015292553,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"може да се чуем да","depth":25,"bounds":{"left":0.11801862,"top":0.35834,"width":0.045212764,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.3256185,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.3256185,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.3256185,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.3256185,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.3256185,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.3256185,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.3256185,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.3256185,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:43:09 PM","depth":25,"bounds":{"left":0.107380316,"top":0.38467678,"width":0.007978723,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:43","depth":26,"bounds":{"left":0.107380316,"top":0.38467678,"width":0.007978723,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"само кажи","depth":25,"bounds":{"left":0.11801862,"top":0.38228253,"width":0.024268618,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.3575419,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.3575419,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.3575419,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.3575419,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.3575419,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.3575419,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.3575419,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.3575419,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"bounds":{"left":0.11801862,"top":0.4046289,"width":0.030917553,"height":0.017557861},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.14860372,"top":0.40622506,"width":0.0029920214,"height":0.014365523},"role_description":"text"},{"role":"AXLink","text":"Today at 5:58:04 PM","depth":24,"bounds":{"left":0.1512633,"top":0.4086193,"width":0.015292553,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:58 PM","depth":25,"bounds":{"left":0.1512633,"top":0.4086193,"width":0.015292553,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"ок мисля че го оправих вече, само да го изтествам","depth":25,"bounds":{"left":0.11801862,"top":0.4237829,"width":0.09142287,"height":0.031923383},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.39106146,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.39106146,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.39106146,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.39106146,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.39106146,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.39106146,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.39106146,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.39106146,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:58:17 PM","depth":25,"bounds":{"left":0.107380316,"top":0.46767756,"width":0.007978723,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:58","depth":26,"bounds":{"left":0.107380316,"top":0.46767756,"width":0.007978723,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"за другите неща нещо се обръках","depth":25,"bounds":{"left":0.11801862,"top":0.46528333,"width":0.078125,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.4405427,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.4405427,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.4405427,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.4405427,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.4405427,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.4405427,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.4405427,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.4405427,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:58:20 PM","depth":25,"bounds":{"left":0.107380316,"top":0.49162012,"width":0.007978723,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:58","depth":26,"bounds":{"left":0.107380316,"top":0.49162012,"width":0.007978723,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"Галя иска в колоната SHARED","depth":25,"bounds":{"left":0.11801862,"top":0.48922586,"width":0.068484046,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като “Shared With”","depth":25,"bounds":{"left":0.11801862,"top":0.5067837,"width":0.10172872,"height":0.049481247},"role_description":"text"},{"role":"AXStaticText","text":"Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна","depth":25,"bounds":{"left":0.11801862,"top":0.5594573,"width":0.102726065,"height":0.049481247},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13696809,"top":0.46528333,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14760639,"top":0.46528333,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15824468,"top":0.46528333,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16888298,"top":0.46528333,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17952128,"top":0.46528333,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.19015957,"top":0.46528333,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.20079787,"top":0.46528333,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.21143617,"top":0.46528333,"width":0.010638298,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"ако съм creator на template","depth":23,"bounds":{"left":0.10372341,"top":0.6272945,"width":0.118351065,"height":0.030327214},"value":"ако съм creator на template","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"ако съм creator на template","depth":25,"bounds":{"left":0.10771277,"top":0.63527536,"width":0.0631649,"height":0.014365523},"role_description":"text"},{"role":"AXButton","text":"Shift + Return to add a new line","depth":20,"bounds":{"left":0.17121011,"top":0.6935355,"width":0.048537236,"height":0.012769354},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Shift + Return","depth":21,"bounds":{"left":0.17121011,"top":0.6943336,"width":0.021609042,"height":0.0103751},"role_description":"text"},{"role":"AXStaticText","text":"to add a new line","depth":21,"bounds":{"left":0.1924867,"top":0.6943336,"width":0.027260639,"height":0.0103751},"role_description":"text"},{"role":"AXStaticText","text":"Todor Stamatov, Direct Message, 1 of 15 suggestions","depth":11,"bounds":{"left":0.0,"top":0.7126895,"width":0.026263298,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Channel","depth":11,"bounds":{"left":0.0,"top":0.7126895,"width":0.017287234,"height":0.0007980846},"role_description":"text"}]...
|
-3546902520543800848
|
-6180876208320378792
|
idle
|
hybrid
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Today at 5:36:07 PM
5:36
eto go reporta w kiosk
image.png
Toggle file
image.png
Download image.png
Share file: image.png
View canvas details
More actions
Today at 5:36:33 PM
5:36
той трябва да се шерне само с Web Service Account 2
Today at 5:40:40 PM
5:40
вие нали използвате тази колона
groups
в момента при новите репорти за да сложите тимовете с които се шерва, а при репортите в киоска няма шерване с екипи и в тази колона за екипите от чиито активитита се филтрират активитита за репортите
Lukas Kovalik
Today at 5:41:02 PM
5:41 PM
да
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:41:09 PM
5:41
може ли да се чуем само да вид на прод
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:41:47 PM
5:41
или пак то може и без
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:41:51 PM
5:41
сега ще видя
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 5:43:08 PM
5:43 PM
може да се чуем да
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:43:09 PM
5:43
само кажи
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 5:58:04 PM
5:58 PM
ок мисля че го оправих вече, само да го изтествам
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:58:17 PM
5:58
за другите неща нещо се обръках
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:58:20 PM
5:58
Галя иска в колоната SHARED
значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като “Shared With”
Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
ако съм creator на template
ако съм creator на template
Shift + Return to add a new line
Shift + Return
to add a new line
Todor Stamatov, Direct Message, 1 of 15 suggestions
Channel
DMSActivityMoreSlackcalVIewMistonWindowJiminny ...# platform-tickets# product_launches¿randomi# releases# support# thank-yous# the_people_of jimi...^ Direct messagesP. Aneliya AngelovaB Aneliya Angelova,...&i. Mario GeorgievFR. Nikolay Yankov8: Todor StamatovP. Gabriela Dureva. Petko Kashinski€. Vasil Vasilev. Nikolay Nikolov. Galya Dimitrova8. Stefka Stoyanova8. Stoyan Tomov2. Stoyan TanevNikolav Ivanove. Ves• Apps6 Jira CloudToasthelp. Aneliya Angelova• Messagest Add canvasur Filesвие нали използвите тази колона groups Bмомента при + Today ~ орти за да сложитетимовете с които се шеова, а пои оепоотитьв киоска няма шерване с екипи и в тазиколона за екипите от чиито активитита сеФилтрират активитита за репортитеLukas Kovalik 5:41 PMможе ли да се чуем само да вид на продили пак то може и безсега ще видяAneliya Angelova 5:43 PMможе да се чуем дасамо кажиLukas Kovallk 5.58 PMок мисля че го оправих вече, само ла гоза друг5:58 аля иска в колоната SHARzDIзначи съзлателя на темплейта на АИ•Репоотс стоаницата вижла винаги и себе сикато "Shared With"аля иска ла се махне creator-a of SharedWith tако не е шеонал с никого. то колоната.ts(AutomatedReport $report): arraywe e noasнaSthis->transformRecinients(Srenort->aetRecinients000:ако съм creator на template |•Report()) €Shift + Return to add a new ling©) Acuivily lypeservice.ong© AskJiminnyReportActivitySi© AutomatedReportsCallbackc) Aulomareckepor sservice.c) DealStagesService.ohv©RecipientsService.php() ReportSort.ohpreturn [...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),...SreczolentsE) ReportSortDirection.oho3 usagespublic function hasCallTypeConference(AutomatedReport $report): boolf..,C) KioskService.ohoD MailMeetinaGeneratorM Notification3 usagespublic function hasCallTypeDialer (AutomatedReport Sreport): boolf...M ©Auth2transformersM RecallAIl1usage1 Securityprivate function transformTeam(Team Steam): arraví...}|aкepoпskepository.onp© AutomatedReportsRepositoryTest.php© Service.php© Field.phpC) FieldRepository.pnp©AskJiminnyReportActivityService.phpsendcommand.pnpAutomatedkeporscommand.pnp© AutomatedReportsService.php x) © CreateHeldActivityEvent.php©TrackProviderInstalledEvent.phpAutomatedReportsCallbackService.php© RequestGenerateAskJiminnyReportJob.php© SendReportMailJob.php©) RequestGenerateAskJimir©ReportController.php© CreateActivityLoggedEvent.php© RequestGenerateReportJob.php-Results(Col lection SautomatedReportResults): arrayIBy?->getEmailAddress(),ItedBy?->getPhotoUrZ(),keportResult->getUuid(),edReportResult->getName(),Ls->transformFrequency ($report->getFrequency()),1s->oU1LoKeciprentsreportythis-›transformReportType($report->getType()),соmасеокероr ckesuLt»›cecмedlalype,this->generateReportResultDownloadUrl($automatedReportResult),›generateReportResultViewUr2($automatedReportResult),automatedReportResult->getGeneratedAt?->toIso8601StringO.A 102 X 3 X34 ^100% S2Tue 21 Apr 17:58:52= custom.logA console (EU]& console SlAGINGE laravel.log4 SF [jiminny@localhost] xA HS_Jocal [jiminny@localhost]© ReportNotGenerated.php# report-not-generated.blade.phpA console (PROD]© SendReportNotGeneratedMailJob.php161—162164266=185189193-135=19%Tx: Auto vPlaygroundde jiminny~SELECT * FROM activity_searches where id = 1982; # 1981918614 Y2 Y4 AYSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;SELECT * FROM automated_reports where id = 68;UPDATE automated_reports set playboek categocies = NULL where id = 68;SELECT * FROM automated_report_results where id = 275;SELECT * FROM automated_reports order by id desc;SELECT * FROM automated_report_results order by id desc;select * from activity_searches where user_id = 143;SELECT * FROM groups WHERE id = 1439;SELEC * FROM users WHERE qroUD 1d = 14591select * from permissions; # 158select * from roles;select * from permission_roleselect * from teams where id = 1;select * from groups g JOIN playbooks p 1..n<->1: on g.playbook_id = p.id where g.team_id = 1;select * from groups where id = 28;select * from playbooks where team_id = 1;select * from playbooks where id = 179;select * from playbook_categories where id = 1391;select * from users where id = 143:select * from crm_profiles where user_id = 143;select * from activities where crm_configuration_id = 39 and type = 'conference'and crm_provider_id IS NOT NULL ORDER by id desc;select * from activities where id = 422003; # 00U0400000pB6fpMACSELECT ar.ig, ar.uuid, ar.nedia.txps, ar.status, a.tyReFROM automated_report_results arJOIN automated_reports a ON a.id = ar.cepent.idWHERE a.type = 'ask_jiminny'SELECT "automated_report_results'.* FROM "automated_report_resultsINNER JOIN 'automated_reports'ONselect * from teams where id = 3143;W Windsurf Teams 871:15 UTF-8 f 4 spaces...
|
66721
|
|
66726
|
NULL
|
0
|
2026-04-21T14:59:12.904226+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776783552904_m1.jpg...
|
Slack
|
Aneliya Angelova (DM) - Jiminny Inc - Slack
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Today at 5:36:07 PM
5:36
eto go reporta w kiosk
image.png
Toggle file
image.png
Download image.png
Share file: image.png
View canvas details
More actions
Today at 5:36:33 PM
5:36
той трябва да се шерне само с Web Service Account 2
Today at 5:40:40 PM
5:40
вие нали използвате тази колона
groups
в момента при новите репорти за да сложите тимовете с които се шерва, а при репортите в киоска няма шерване с екипи и в тази колона за екипите от чиито активитита се филтрират активитита за репортите
Lukas Kovalik
Today at 5:41:02 PM
5:41 PM
да
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:41:09 PM
5:41
може ли да се чуем само да вид на прод
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:41:47 PM
5:41
или пак то може и без
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:41:51 PM
5:41
сега ще видя
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 5:43:08 PM
5:43 PM
може да се чуем да
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:43:09 PM
5:43
само кажи
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 5:58:04 PM
5:58 PM
ок мисля че го оправих вече, само да го изтествам
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:58:17 PM
5:58
за другите неща нещо се обръках
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:58:20 PM
5:58
Галя иска в колоната SHARED
значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като “Shared With”
Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
ако съм creator на template и на result трябва да виждам всички с който е с
ако съм creator на template и на result трябва да виждам всички с който е с
Shift + Return to add a new line
Shift + Return
to add a new line
Todor Stamatov, Direct Message, 1 of 15 suggestions
Channel...
|
[{"role":"AXPopUpButton","text [{"role":"AXPopUpButton","text":"Switch workspaces… (Jiminny Inc) Has new messages","depth":14,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"Home","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Home","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"DMs","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"DMs","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"Activity","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Activity","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"Later","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Later","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"More…","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More","depth":16,"role_description":"text"},{"role":"AXStaticText","text":"Unreads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Threads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Huddles","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Drafts & sent","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Directories","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-x-integration-app","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-inner-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"ai-chapter","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"alerts","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"backend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"c-learning-people","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"confusion-clinic","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"curiosity_lab","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"engineering","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"frontend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"general","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"infra-changes","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-bg","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-copilot-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-zoom-phone-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-tickets","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"product_launches","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"random","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"releases","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"support","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"thank-yous","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"the_people_of_jiminny","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Steliyan Georgiev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Mario Georgiev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Todor Stamatov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Gabriela Dureva","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Petko Kashinski","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Vasil Vasilev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Nikolov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Galya Dimitrova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Stefka Stoyanova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tomov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tanev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Ivanov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Ves","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Jira Cloud","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Toast","depth":23,"role_description":"text"},{"role":"AXRadioButton","text":"Messages","depth":17,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Messages","depth":19,"role_description":"text"},{"role":"AXRadioButton","text":"Add canvas","depth":18,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Add canvas","depth":20,"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":17,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":19,"role_description":"text"},{"role":"AXPopUpButton","text":"Add and Edit Channel Tabs","depth":17,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Canvas","depth":17,"role_description":"text"},{"role":"AXStaticText","text":"List","depth":17,"role_description":"text"},{"role":"AXStaticText","text":"Folder","depth":17,"role_description":"text"},{"role":"AXPopUpButton","text":"Jump to date","depth":23,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:36:07 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:36","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"eto go reporta w kiosk","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"image.png","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"","depth":25,"role_description":"text"},{"role":"AXButton","text":"Toggle file","depth":25,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXLink","text":"image.png","depth":27,"role_description":"Unlabelled image","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Download image.png","depth":28,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Share file: image.png","depth":28,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View canvas details","depth":28,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":28,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:36:33 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:36","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"той трябва да се шерне само с Web Service Account 2","depth":25,"role_description":"text"},{"role":"AXLink","text":"Today at 5:40:40 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:40","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"вие нали използвате тази колона","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"groups","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"в момента при новите репорти за да сложите тимовете с които се шерва, а при репортите в киоска няма шерване с екипи и в тази колона за екипите от чиито активитита се филтрират активитита за репортите","depth":25,"role_description":"text"},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:41:02 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:41 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"да","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:41:09 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:41","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"може ли да се чуем само да вид на прод","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:41:47 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:41","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"или пак то може и без","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:41:51 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:41","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"сега ще видя","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:43:08 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:43 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"може да се чуем да","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:43:09 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:43","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"само кажи","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:58:04 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:58 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"ок мисля че го оправих вече, само да го изтествам","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:58:17 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:58","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"за другите неща нещо се обръках","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:58:20 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:58","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"Галя иска в колоната SHARED","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като “Shared With”","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"ако съм creator на template и на result трябва да виждам всички с който е с","depth":23,"value":"ако съм creator на template и на result трябва да виждам всички с който е с","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"ако съм creator на template и на result трябва да виждам всички с който е с","depth":25,"role_description":"text"},{"role":"AXButton","text":"Shift + Return to add a new line","depth":20,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Shift + Return","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"to add a new line","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Todor Stamatov, Direct Message, 1 of 15 suggestions","depth":11,"role_description":"text"},{"role":"AXStaticText","text":"Channel","depth":11,"role_description":"text"}]...
|
7091680215229172213
|
-1569190189758773176
|
visual_change
|
hybrid
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Today at 5:36:07 PM
5:36
eto go reporta w kiosk
image.png
Toggle file
image.png
Download image.png
Share file: image.png
View canvas details
More actions
Today at 5:36:33 PM
5:36
той трябва да се шерне само с Web Service Account 2
Today at 5:40:40 PM
5:40
вие нали използвате тази колона
groups
в момента при новите репорти за да сложите тимовете с които се шерва, а при репортите в киоска няма шерване с екипи и в тази колона за екипите от чиито активитита се филтрират активитита за репортите
Lukas Kovalik
Today at 5:41:02 PM
5:41 PM
да
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:41:09 PM
5:41
може ли да се чуем само да вид на прод
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:41:47 PM
5:41
или пак то може и без
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:41:51 PM
5:41
сега ще видя
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 5:43:08 PM
5:43 PM
може да се чуем да
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:43:09 PM
5:43
само кажи
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 5:58:04 PM
5:58 PM
ок мисля че го оправих вече, само да го изтествам
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:58:17 PM
5:58
за другите неща нещо се обръках
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:58:20 PM
5:58
Галя иска в колоната SHARED
значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като “Shared With”
Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
ако съм creator на template и на result трябва да виждам всички с който е с
ако съм creator на template и на result трябва да виждам всички с който е с
Shift + Return to add a new line
Shift + Return
to add a new line
Todor Stamatov, Direct Message, 1 of 15 suggestions
Channel
iTerm2ShellEditViewSessionScriptsProfilesWindowHelpБГ100% C8Tue 21 Apr 17:59:12•• 0DOCKER281-zsh®-₴82* Build full da...•83-zsh84STAGE (ssh)screenpipe"О 85-zsh|APP (-zsh)T2PROD (ssh)'do-release-upgrade' to upgrade to it.181ec2-user@ip-..• 88rk/schedule-390defd641effba0f73a895e426ded4cf2ba7f11" "$?") > '/dev/null' 2>&1 &docker_lamp_12026-04-21 14:58:09 Running ['artisan'calendar: sync--dateMode=daily2026-04-21 14:58:14Jiminny\Jobs\Calendar\SyncCalendarEventsdocker_1amp_12026-04-21 14:58:15 Jiminny\Jobs\Calendar\SyncCalendarEventsdocker_1amp_1docker_lamp_1roc/1/fd/1' 2>&1docker_lamp_1docker_lamp_1RUNNINGdocker_lamp_1docker_1amp_1msDONEdocker_lamp_1RUNNINGdocker_lamp_1ms DONEdocker_lamp_1docker_lamp_11sDONEdocker_lamp_1fd/1'2>81docker_lamp_11S DONEdocker_lamp_11/fd/1'2>&1docker_1amp_1S]1S DONEdocker_lamp_1proc/1/fd/1'docker_lamp_17S DONE1 '/usr/local/bin/php' 'artisan'calendar: sync --dateMode=daily › '/p2026-04-21 14:58:17 Jiminny Jobs\Calendar \SyncCalendarEventsrun_artisan_schedule:Done waiting for schedule:run2026-04-21 14:58:18 Jiminny\Jobs\Calendar\SyncCalendarEvents686.722026-04-21 14:58:18 Jiminny\Jobs\Calendar\SyncCalendarEvents2026-04-21 14:58:18Jiminny\Jobs\Calendar\SyncCalendarEvents . 967.492026-04-21 14:59:02 Running ['artisan'meeting-bot:schedule-bot]1 '/usr/local/bin/php' 'artisan'meeting-bot: schedule-bot > */proc/1/2026-04-21 14:59:04 Running ['artisan' dialers:monitor-activities] .1 '/usr/local/bin/php' 'artisan' dialers:monitor-activities › '/proc/2026-04-21 14:59:05 Running ['artisan' jiminny:monitor-social-account• '/usr/local/bin/php' 'artisan' jiminny:monitor-social-accounts > */2026-04-21 14:59:06 Running ['artisan'mailbox:skip-lists:refresh]docker_lamp_11 '/usr/local/bin/php' 'artisan'mailbox: skip-lists:refresh › '/proc/docker_lamp_12026-04-21 14:59:07 Running ['artisan'mailbox:batch: processdocker_1amp_11 '/usr/local/bin/php' 'artisan'mailbox:batch:process --max-batches='/proc/1/fd/1'docker_lamp_1docker_lamp_1run_artisan_schedule: Done waiting for schedule:runView in Docker DesktopView ConfigEnable Watch• 87-zshPROD*** System restart required ***Last login: Mon Apr 20 15:14:15 2026 from 212.5.153.87lukas@jiminny-prod-bastion:~$ UX L3 EU (ssh)New release '24.04.4 LTS' available.Run'do-release-upgrade' to upgrade to it.*** System restart required ***Last login: Mon Apr 20 15:14:23 2026 from 212.5.153.87lukas@jiminny-eu-bastion:~$ ||T4 STAGE (ssh)New release '24.04.4 LTS' available.Run 'do-release-upgrade' to upgrade to it.STAGELast login: Thu Apr 16 07:34:39 2026 from 212.39.71.189n:-$T5 QA (-zsh)Poetry could not find a pyproject.toml file in /Users/lukas or its parentsPoetry could not find a pyproject.toml file in /Users/lukas or its parentsX T6 FE (-zsh)Poetry could not find a pyproject.toml file in /Users/lukas or its parentsFRONTENDPoetry could not find a pyproject.toml file in /Users/lukas or its parentslukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $ IX 17|EXT (-zsh)Last login: Mon Apr 20 19:48:04 on ttys005Poetry could not find a pyproject.toml file in /Users/lukas or its parentsEXTENSIONPoetry could not find a pyproject.toml file in /Users/lukas or its parentsukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~ $...
|
NULL
|
|
66727
|
1502
|
0
|
2026-04-21T14:59:23.742554+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776783563742_m2.jpg...
|
Slack
|
Aneliya Angelova (DM) - Jiminny Inc - Slack
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Today at 5:36:07 PM
5:36
eto go reporta w kiosk
image.png
Toggle file
image.png
Download image.png
Share file: image.png
View canvas details
More actions
Today at 5:36:33 PM
5:36
той трябва да се шерне само с Web Service Account 2
Today at 5:40:40 PM
5:40
вие нали използвате тази колона
groups
в момента при новите репорти за да сложите тимовете с които се шерва, а при репортите в киоска няма шерване с екипи и в тази колона за екипите от чиито активитита се филтрират активитита за репортите
Lukas Kovalik
Today at 5:41:02 PM
5:41 PM
да
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:41:09 PM
5:41
може ли да се чуем само да вид на прод
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:41:47 PM
5:41
или пак то може и без
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:41:51 PM
5:41
сега ще видя
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 5:43:08 PM
5:43 PM
може да се чуем да
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:43:09 PM
5:43
само кажи
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 5:58:04 PM
5:58 PM
ок мисля че го оправих вече, само да го изтествам
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:58:17 PM
5:58
за другите неща нещо се обръках
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:58:20 PM
5:58
Галя иска в колоната SHARED
значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като “Shared With”
Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
ако съм creator на template и на result трябва да виждам всички с който е споделено , включително и
ако съм creator на template и на result трябва да виждам всички с който е споделено , включително и
Shift + Return to add a new line
Shift + Return
to add a new line
Todor Stamatov, Direct Message, 1 of 15 suggestions
Channel...
|
[{"role":"AXPopUpButton","text [{"role":"AXPopUpButton","text":"Switch workspaces… (Jiminny Inc) Has new messages","depth":14,"bounds":{"left":0.0056515955,"top":0.058260176,"width":0.011968086,"height":0.028731046},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"Home","depth":14,"bounds":{"left":0.0029920214,"top":0.10055866,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Home","depth":16,"bounds":{"left":0.0066489363,"top":0.13806863,"width":0.009973404,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"DMs","depth":14,"bounds":{"left":0.0029920214,"top":0.15482841,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"DMs","depth":16,"bounds":{"left":0.0076462766,"top":0.19233839,"width":0.007978723,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Activity","depth":14,"bounds":{"left":0.0029920214,"top":0.20909816,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Activity","depth":16,"bounds":{"left":0.004986702,"top":0.24660814,"width":0.012965426,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":14,"bounds":{"left":0.0029920214,"top":0.26336792,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":16,"bounds":{"left":0.0076462766,"top":0.3008779,"width":0.0076462766,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Later","depth":14,"bounds":{"left":0.0029920214,"top":0.31763768,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Later","depth":16,"bounds":{"left":0.00731383,"top":0.35514766,"width":0.008643617,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"More…","depth":14,"bounds":{"left":0.0029920214,"top":0.3719074,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More","depth":16,"bounds":{"left":0.006981383,"top":0.4094174,"width":0.008976064,"height":0.0103751},"role_description":"text"},{"role":"AXStaticText","text":"Unreads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Threads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Huddles","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Drafts & sent","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Directories","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-x-integration-app","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-inner-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"ai-chapter","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"alerts","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"backend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"c-learning-people","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"confusion-clinic","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"curiosity_lab","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"engineering","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"frontend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"general","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"infra-changes","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-bg","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-copilot-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-zoom-phone-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-tickets","depth":23,"bounds":{"left":0.042220745,"top":0.096568234,"width":0.034906916,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"product_launches","depth":23,"bounds":{"left":0.042220745,"top":0.118914604,"width":0.03856383,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"random","depth":23,"bounds":{"left":0.042220745,"top":0.14126097,"width":0.01662234,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"releases","depth":23,"bounds":{"left":0.042220745,"top":0.16360734,"width":0.018284574,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"support","depth":23,"bounds":{"left":0.042220745,"top":0.1859537,"width":0.016954787,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"thank-yous","depth":23,"bounds":{"left":0.042220745,"top":0.20830008,"width":0.024268618,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"the_people_of_jiminny","depth":23,"bounds":{"left":0.042220745,"top":0.23064645,"width":0.04488032,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"bounds":{"left":0.042220745,"top":0.28332004,"width":0.03756649,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"bounds":{"left":0.042220745,"top":0.3056664,"width":0.03756649,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"bounds":{"left":0.07945479,"top":0.3056664,"width":0.0063164895,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"bounds":{"left":0.08211436,"top":0.3056664,"width":0.014295213,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"bounds":{"left":0.09607713,"top":0.32322428,"width":0.0003324468,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Steliyan Georgiev","depth":23,"bounds":{"left":0.09607713,"top":0.32322428,"width":0.0003324468,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Mario Georgiev","depth":23,"bounds":{"left":0.042220745,"top":0.32801276,"width":0.033909574,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"bounds":{"left":0.042220745,"top":0.35035914,"width":0.032912236,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Todor Stamatov","depth":23,"bounds":{"left":0.042220745,"top":0.37270552,"width":0.034242023,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Gabriela Dureva","depth":23,"bounds":{"left":0.042220745,"top":0.39505187,"width":0.03523936,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Petko Kashinski","depth":23,"bounds":{"left":0.042220745,"top":0.41739824,"width":0.034242023,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Vasil Vasilev","depth":23,"bounds":{"left":0.042220745,"top":0.43974462,"width":0.026263298,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Nikolov","depth":23,"bounds":{"left":0.042220745,"top":0.46209097,"width":0.034242023,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Galya Dimitrova","depth":23,"bounds":{"left":0.042220745,"top":0.48443735,"width":0.034906916,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Stefka Stoyanova","depth":23,"bounds":{"left":0.042220745,"top":0.5067837,"width":0.03756649,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tomov","depth":23,"bounds":{"left":0.042220745,"top":0.5291301,"width":0.030585106,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tanev","depth":23,"bounds":{"left":0.042220745,"top":0.5514765,"width":0.028922873,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Ivanov","depth":23,"bounds":{"left":0.042220745,"top":0.5738228,"width":0.031914894,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Ves","depth":23,"bounds":{"left":0.042220745,"top":0.5961692,"width":0.0076462766,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Jira Cloud","depth":23,"bounds":{"left":0.042220745,"top":0.64884275,"width":0.021609042,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Toast","depth":23,"bounds":{"left":0.042220745,"top":0.6711891,"width":0.011635638,"height":0.014365523},"role_description":"text"},{"role":"AXRadioButton","text":"Messages","depth":17,"bounds":{"left":0.10206117,"top":0.09177973,"width":0.030585106,"height":0.030327214},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Messages","depth":19,"bounds":{"left":0.111369684,"top":0.10055866,"width":0.01861702,"height":0.012769354},"role_description":"text"},{"role":"AXRadioButton","text":"Add canvas","depth":18,"bounds":{"left":0.13397606,"top":0.09177973,"width":0.033909574,"height":0.030327214},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Add canvas","depth":20,"bounds":{"left":0.14328457,"top":0.10055866,"width":0.021941489,"height":0.012769354},"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":17,"bounds":{"left":0.16921543,"top":0.09177973,"width":0.020944148,"height":0.030327214},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":19,"bounds":{"left":0.17852394,"top":0.10055866,"width":0.008976064,"height":0.012769354},"role_description":"text"},{"role":"AXPopUpButton","text":"Add and Edit Channel Tabs","depth":17,"bounds":{"left":0.19115691,"top":0.09177973,"width":0.010970744,"height":0.030327214},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Canvas","depth":17,"bounds":{"left":0.096409574,"top":0.0518755,"width":0.015625,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"List","depth":17,"bounds":{"left":0.096409574,"top":0.0518755,"width":0.0076462766,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Folder","depth":17,"bounds":{"left":0.096409574,"top":0.0518755,"width":0.013962766,"height":0.0007980846},"role_description":"text"},{"role":"AXPopUpButton","text":"Jump to date","depth":23,"bounds":{"left":0.15026596,"top":0.12689546,"width":0.025265958,"height":0.022346368},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:36:07 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:36","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"eto go reporta w kiosk","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"image.png","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"","depth":25,"role_description":"text"},{"role":"AXButton","text":"Toggle file","depth":25,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXLink","text":"image.png","depth":27,"role_description":"Unlabelled image","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Download image.png","depth":28,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Share file: image.png","depth":28,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View canvas details","depth":28,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":28,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:36:33 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:36","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"той трябва да се шерне само с Web Service Account 2","depth":25,"role_description":"text"},{"role":"AXLink","text":"Today at 5:40:40 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:40","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"вие нали използвате тази колона","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"groups","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"в момента при новите репорти за да сложите тимовете с които се шерва, а при репортите в киоска няма шерване с екипи и в тази колона за екипите от чиито активитита се филтрират активитита за репортите","depth":25,"bounds":{"left":0.11801862,"top":0.11572227,"width":0.10239362,"height":0.06703911},"role_description":"text"},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"bounds":{"left":0.11801862,"top":0.19074222,"width":0.030917553,"height":0.017557861},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.14860372,"top":0.19233839,"width":0.0029920214,"height":0.014365523},"role_description":"text"},{"role":"AXLink","text":"Today at 5:41:02 PM","depth":24,"bounds":{"left":0.1512633,"top":0.19473264,"width":0.015292553,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:41 PM","depth":25,"bounds":{"left":0.1512633,"top":0.19473264,"width":0.015292553,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"да","depth":25,"bounds":{"left":0.11801862,"top":0.20989625,"width":0.0056515955,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.17717478,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.17717478,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.17717478,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.17717478,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.17717478,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.17717478,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.17717478,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.17717478,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:41:09 PM","depth":25,"bounds":{"left":0.107380316,"top":0.23623304,"width":0.007978723,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:41","depth":26,"bounds":{"left":0.107380316,"top":0.23623304,"width":0.007978723,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"може ли да се чуем само да вид на прод","depth":25,"bounds":{"left":0.11801862,"top":0.23383878,"width":0.09375,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.20909816,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.20909816,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.20909816,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.20909816,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.20909816,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.20909816,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.20909816,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.20909816,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:41:47 PM","depth":25,"bounds":{"left":0.107380316,"top":0.2601756,"width":0.007978723,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:41","depth":26,"bounds":{"left":0.107380316,"top":0.2601756,"width":0.007978723,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"или пак то може и без","depth":25,"bounds":{"left":0.11801862,"top":0.25778133,"width":0.051529255,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.2330407,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.2330407,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.2330407,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.2330407,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.2330407,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.2330407,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.2330407,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.2330407,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:41:51 PM","depth":25,"bounds":{"left":0.107380316,"top":0.28411812,"width":0.007978723,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:41","depth":26,"bounds":{"left":0.107380316,"top":0.28411812,"width":0.007978723,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"сега ще видя","depth":25,"bounds":{"left":0.11801862,"top":0.28172386,"width":0.029920213,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.25698325,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.25698325,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.25698325,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.25698325,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.25698325,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.25698325,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.25698325,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.25698325,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"bounds":{"left":0.11801862,"top":0.30407023,"width":0.038896278,"height":0.017557861},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.15658244,"top":0.3056664,"width":0.0029920214,"height":0.014365523},"role_description":"text"},{"role":"AXLink","text":"Today at 5:43:08 PM","depth":24,"bounds":{"left":0.15924202,"top":0.30806065,"width":0.015292553,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:43 PM","depth":25,"bounds":{"left":0.15924202,"top":0.30806065,"width":0.015292553,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"може да се чуем да","depth":25,"bounds":{"left":0.11801862,"top":0.32322428,"width":0.045212764,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.2905028,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.2905028,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.2905028,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.2905028,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.2905028,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.2905028,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.2905028,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.2905028,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:43:09 PM","depth":25,"bounds":{"left":0.107380316,"top":0.34956107,"width":0.007978723,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:43","depth":26,"bounds":{"left":0.107380316,"top":0.34956107,"width":0.007978723,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"само кажи","depth":25,"bounds":{"left":0.11801862,"top":0.3471668,"width":0.024268618,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.32242617,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.32242617,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.32242617,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.32242617,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.32242617,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.32242617,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.32242617,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.32242617,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"bounds":{"left":0.11801862,"top":0.36951315,"width":0.030917553,"height":0.017557861},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.14860372,"top":0.37110934,"width":0.0029920214,"height":0.014365523},"role_description":"text"},{"role":"AXLink","text":"Today at 5:58:04 PM","depth":24,"bounds":{"left":0.1512633,"top":0.3735036,"width":0.015292553,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:58 PM","depth":25,"bounds":{"left":0.1512633,"top":0.3735036,"width":0.015292553,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"ок мисля че го оправих вече, само да го изтествам","depth":25,"bounds":{"left":0.11801862,"top":0.3886672,"width":0.09142287,"height":0.031923383},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.35594574,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.35594574,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.35594574,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.35594574,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.35594574,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.35594574,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.35594574,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.35594574,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:58:17 PM","depth":25,"bounds":{"left":0.107380316,"top":0.43256184,"width":0.007978723,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:58","depth":26,"bounds":{"left":0.107380316,"top":0.43256184,"width":0.007978723,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"за другите неща нещо се обръках","depth":25,"bounds":{"left":0.11801862,"top":0.4301676,"width":0.078125,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.40542698,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.40542698,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.40542698,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.40542698,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.40542698,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.40542698,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.40542698,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.40542698,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:58:20 PM","depth":25,"bounds":{"left":0.107380316,"top":0.45650437,"width":0.007978723,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:58","depth":26,"bounds":{"left":0.107380316,"top":0.45650437,"width":0.007978723,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"Галя иска в колоната SHARED","depth":25,"bounds":{"left":0.11801862,"top":0.45411015,"width":0.068484046,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като “Shared With”","depth":25,"bounds":{"left":0.11801862,"top":0.471668,"width":0.10172872,"height":0.049481247},"role_description":"text"},{"role":"AXStaticText","text":"Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна","depth":25,"bounds":{"left":0.11801862,"top":0.5243416,"width":0.102726065,"height":0.049481247},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.4293695,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.4293695,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.4293695,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.4293695,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.4293695,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.4293695,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.4293695,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.4293695,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"ако съм creator на template и на result трябва да виждам всички с който е споделено , включително и","depth":23,"bounds":{"left":0.10372341,"top":0.59217876,"width":0.118351065,"height":0.065442935},"value":"ако съм creator на template и на result трябва да виждам всички с който е споделено , включително и","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"ако съм creator на template и на result трябва да виждам всички с който е споделено , включително и","depth":25,"bounds":{"left":0.10771277,"top":0.60015965,"width":0.11103723,"height":0.049481247},"role_description":"text"},{"role":"AXButton","text":"Shift + Return to add a new line","depth":20,"bounds":{"left":0.17121011,"top":0.6935355,"width":0.048537236,"height":0.012769354},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Shift + Return","depth":21,"bounds":{"left":0.17121011,"top":0.6943336,"width":0.021609042,"height":0.0103751},"role_description":"text"},{"role":"AXStaticText","text":"to add a new line","depth":21,"bounds":{"left":0.1924867,"top":0.6943336,"width":0.027260639,"height":0.0103751},"role_description":"text"},{"role":"AXStaticText","text":"Todor Stamatov, Direct Message, 1 of 15 suggestions","depth":11,"bounds":{"left":0.0,"top":0.7126895,"width":0.026263298,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Channel","depth":11,"bounds":{"left":0.0,"top":0.7126895,"width":0.017287234,"height":0.0007980846},"role_description":"text"}]...
|
-5628711152994325279
|
-1569190189758773160
|
idle
|
hybrid
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Today at 5:36:07 PM
5:36
eto go reporta w kiosk
image.png
Toggle file
image.png
Download image.png
Share file: image.png
View canvas details
More actions
Today at 5:36:33 PM
5:36
той трябва да се шерне само с Web Service Account 2
Today at 5:40:40 PM
5:40
вие нали използвате тази колона
groups
в момента при новите репорти за да сложите тимовете с които се шерва, а при репортите в киоска няма шерване с екипи и в тази колона за екипите от чиито активитита се филтрират активитита за репортите
Lukas Kovalik
Today at 5:41:02 PM
5:41 PM
да
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:41:09 PM
5:41
може ли да се чуем само да вид на прод
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:41:47 PM
5:41
или пак то може и без
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:41:51 PM
5:41
сега ще видя
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 5:43:08 PM
5:43 PM
може да се чуем да
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:43:09 PM
5:43
само кажи
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 5:58:04 PM
5:58 PM
ок мисля че го оправих вече, само да го изтествам
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:58:17 PM
5:58
за другите неща нещо се обръках
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:58:20 PM
5:58
Галя иска в колоната SHARED
значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като “Shared With”
Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
ако съм creator на template и на result трябва да виждам всички с който е споделено , включително и
ако съм creator на template и на result трябва да виждам всички с който е споделено , включително и
Shift + Return to add a new line
Shift + Return
to add a new line
Todor Stamatov, Direct Message, 1 of 15 suggestions
Channel
DMSActivityMoreSlackcalVIewMistonWindowJiminny ...# platform-tickets# product_launches¿randomi# releases# support# thank-yous# the_people_of jimi...^ Direct messagesP. Aneliya AngelovaB Aneliya Angelova,...&i. Mario GeorgievFR. Nikolay Yankov8: Todor StamatovP. Gabriela Dureva. Petko Kashinski€. Vasil Vasilev. Nikolay Nikolov. Galya Dimitrova8. Stefka Stoyanova8. Stoyan Tomov2. Stoyan TanevNikolav Ivanov• Apps6 Jira CloudToasthelp. Aneliya Angelova• Messagest Add canvasur Filesтимовете с които се шерва, а при репортитеекипи и в тазиколона за екипите от чиито активитита сефилтрират активитита за репортитеLukas Kovalik 5:41 PMможе ли да се чуем само да вид на продили пак то може и безceld щe bидяAneliya Angelova 5:43 PMможе да се чуем даLukas Kovalik 5:58 PMок мисля че го опоавих вече, само ла гоза пругите неша нешо се обръкахГаля иска в колоната SHAREDзначи съзлателя на темплейта на АИ•Репортс стоаницата вижла винаги и себе сикато "Shared With"аля иска ла се махне creator-a of SharediWith 1 ако не е шеонал с никого, то колонатаwe e noaзнаsAutomatedRenort Srenont)* arraviако сьм сrеасог на tеmplate и на result тояова даSthis->transformRecinients(Srenort->aetRecinients000:виждам всички с които е споделено.включително и•Report()) €+ Aa €©) Acuivily lypeservice.ong© AskJiminnyReportActivitySic) Automatedkeporiscallbackreturn [...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),...sreczolentsc) Aulomaredkepor sservice.c) DealStagesService.ohv©RecipientsService.php() ReportSort.ohpE) ReportSortDirection.oho3 usagespublic function hasCallTypeConference(AutomatedReport $report): boolf..,C) KioskService.ohoD MailMeetindGenerator3 usagesM Notificationpublic function hasCallTypeDialer (AutomatedReport Sreport): boolf...M ©Auth2transformersM RecallA1usage1 Securityprivate function transformTeam(Team Steam): arrayf...,aкepoпskepository.onp© AutomatedReportsRepositoryTest.php© Service.php© Field.phpC) FieldRepository.pnp©AskJiminnyReportActivityService.phpsendcommand.pnpAutomatedkeporscommand.pnp© AutomatedReportsService.php x) © CreateHeldActivityEvent.php©TrackProviderInstalledEvent.phpAutomatedReportsCallbackService.php© RequestGenerateAskJiminnyReportJob.php© SendReportMailJob.php©) RequestGenerateAskJimir©ReportController.php© CreateActivityLoggedEvent.php© RequestGenerateReportJob.php-Results(Col lection SautomatedReportResults): arrayIBy?->getEmailAddress(),tedBy?->getPhotoUrl(),keportResult->getUuid(),edReportResult->getName(),Ls->transformFrequency ($report->getFrequency()),1s->oU1LoKeciprentsreportythis-›transformReportType($report->getType()),соmасеокероr ckesuLt»›cecмedlalype,this->generateReportResultDownloadUrl($automatedReportResult),›generateReportResultViewUr2($automatedReportResult),iautomatedReportResult->getGeneratedAt()?->toIso8601String(),A 102 X 3 X34 ^100% S2Tue 21 Apr 17:59:23= custom.logA console (EU]& console SlAGINGE laravel.log4 SF [jiminny@localhost] xA HS_Jocal [jiminny@localhost]© ReportNotGenerated.php# report-not-generated.blade.phpA console (PROD]© SendReportNotGeneratedMailJob.php161—162164266=185189193-135=19%Tx: Auto vPlaygroundde jiminny~SELECT * FROM activity_searches where id = 1982; # 1981918614 Y2 Y4 AYSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;SELECT * FROM automated_reports where id = 68;UPDATE automated_reports set playboek categocies = NULL where id = 68;SELECT * FROM automated_report_results where id = 275;SELECT * FROM automated_reports order by id desc;SELECT * FROM automated_report_results order by id desc;select * from activity_searches where user_id = 143;SELECT * FROM groups WHERE id = 1439;SELEC * FROM users WHERE qroUD 1d = 14591select * from permissions; # 158select * from roles;select * from permission_roleselect * from teams where id = 1;select * from groups g JOIN playbooks p 1..n<->1: on g.playbook_id = p.id where g.team_id = 1;select * from groups where id = 28;select * from playbooks where team_id = 1;select * from playbooks where id = 179;select * from playbook_categories where id = 1391;select * from users where id = 143:select * from crm_profiles where user_id = 143;select * from activities where crm_configuration_id = 39 and type = 'conference'and crm_provider_id IS NOT NULL ORDER by id desc;select * from activities where id = 422003; # 00U0400000pB6fpMACSELECT ar.ig, ar.uuid, ar.nedid.type, ar.status, a.tyReFROM automated_report_results arJOIN automated_reports a ON a.id = ar.cepent.idWHERE a.type = 'ask_jiminny'SELECT "automated_report_results'.* FROM "automated_report_resultsINNER JOIN 'automated_reports'ONselect * from teams where id = 3143;W Windsurf Teams 871:15 UTF-8 f 4 spaces...
|
NULL
|
|
66728
|
1501
|
0
|
2026-04-21T14:59:40.330608+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776783580330_m1.jpg...
|
Firefox
|
Jiminny — Work
|
1
|
app.staging.jiminny.com/ai-reports
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Platform Sprint 2 Q2 - Platform Team - Scrum Board Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira
Project Phoenix – Figma
Project Phoenix – Figma
[JY-20372] AI Reports > Empty page design and promotion - Jira
[JY-20372] AI Reports > Empty page design and promotion - Jira
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Jiminny MCP Connector - Product - Confluence
Jiminny MCP Connector - Product - Confluence
Jiminny Mail
Jiminny Mail
[JY-20500] Batch initial sync for Salesforce - Jira
[JY-20500] Batch initial sync for Salesforce - Jira
Feed — jiminny — Sentry
Feed — jiminny — Sentry
Jiminny
Jiminny
Pipelines - jiminny/app
Pipelines - jiminny/app
Formalize
Formalize
[SRD-6793] Les Mills activity types not pulling in - Jira
[SRD-6793] Les Mills activity types not pulling in - Jira
Search results: calendar | Jiminny Help Center
Search results: calendar | Jiminny Help Center
Jiminny
Jiminny
Jiminny
Jiminny
Close tab
Edit - Calendar - Engineering - Confluence
Edit - Calendar - Engineering - Confluence
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
JY-18909-automated-reports-ask-jiminny ■ 874522
27
27
AI Reports
AI Reports
Ask Jiminny reports
Ask Jiminny reports
Report name
Period
Report Type Report Type
Report Type
Report Type
Clear all
NAME
FREQUENCY
SHARED
DATE
ACTIONS
Share With Team Test - Mar 2026
Monthly
21/04/2026
Share With Team Test - Mar 2026
Monthly
21/04/2026
Only Recorded Monthly - Ves Calls - Mar 2026
Monthly
21/04/2026
Only Recorded Monthly - Ves Calls - Mar 2026
Monthly
21/04/2026
Only Recorded Monthly - Ves Calls - Mar 2026
Monthly
21/04/2026
Only Recorded Monthly - Ves Calls - Mar 2026
Monthly
21/04/2026
Expires On - 20 April - New - 13 - 19 Apr 2026
Monthly
20/04/2026
Expires On - 20 April - New - 13 - 19 Apr 2026
Monthly
20/04/2026
Expires On - 20 April - New - 13 - 19 Apr 2026
Monthly
20/04/2026
Expires On - 20 April - New - 13 - 19 Apr 2026
Monthly
20/04/2026
Health - 9 - 15 Apr 2026
Weekly
16/04/2026
Test 6 - 15 Apr 2026
Daily
16/04/2026
Test 7 - 15 Apr 2026
Daily
16/04/2026
Ask Jiminny Test Report - 15 Apr 2026
Daily
16/04/2026
Test 6 - 13 Apr 2026
Daily
14/04/2026
Ask Jiminny Test Report - 13 Apr 2026
Daily
14/04/2026
Ask Jiminny Test Report - 13 Apr 2026
Daily
14/04/2026
Shared With Group - 1 Jul 2025 - 15 Apr 2026
One-Off
31/03/2026
Product Feedback - 1 Feb - 31 Mar 2026 - All
One-Off
31/03/2026
Jiminny Recipient - 1 Dec 2025 - 14 May 2026
One-Off
31/03/2026
Jiminny Recipient - 1 Dec 2025 - 14 May 2026
One-Off
31/03/2026
Jiminny Recipient - 1 Dec 2025 - 14 May 2026
One-Off
31/03/2026
Exec Summary - 9 Nov 2024 - 12 Mar 2026 - All
Monthly
26/03/2026
Exec Summary Podcast - 5 Sep 2024 - 10 Mar 2026 - All
Monthly
26/03/2026
Product Feedback - 1 Feb - 31 Mar 2026 - All
One-Off
27/02/2026
You are currently impersonating Aneliya Angelova
Clear
Filter URLs
Pause/Resume recording network log
New Request
Search
Request Blocking
Disable Cache
Disable Cache
No Throttling
Network Settings
All
HTML
CSS
JS
XHR
Fonts
Images
Media
WS
Other
Status
Status
Method
Method
Domain
Domain
File
File
Initiator
Initiator
Type
Type
Transferred
Transferred
Size
Size
200
POST
o36719.ingest.sentry.io
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
fetch
json
500 B
2 B
200
POST
o36719.ingest.sentry.io
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
fetch
json
500 B
2 B
200
GET
app.staging.jiminny.com
search?status[]=completed&sort_by=dateHeld&sort_direction=desc&exclude[]=stats&only_recorded=1&user_id[]=b497352e-96dd-4e53-ab44-05de24c4f424
xhr
json
6.21 kB
12.94 kB
200
GET
app.staging.jiminny.com
automated-reports
xhr
json
5.95 kB
32.51 kB
200
GET
app.staging.jiminny.com
recent
xhr
json
5.56 kB
14.84 kB
200
GET
app.staging.jiminny.com
integrations
xhr
json
3.83 kB
5.53 kB
200
POST
app.staging.jiminny.com
authenticate
xhr
json
3.11 kB
96 B
200
GET
find.userpilot.io
NX-094be170
xhr
json
cached
62 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
1.55 MB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
2.54 kB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
2.54 kB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
2.40 kB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
2.20 kB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
3.58 kB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
3.39 kB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
4.04 kB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
3.14 kB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
8.89 kB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
2.53 kB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
2.27 kB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
2.53 kB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
2.53 kB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
2.53 kB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20372] AI Reports > Empty page design and promotion - Jira","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20372] AI Reports > Empty page design and promotion - Jira","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny MCP Connector - Product - Confluence","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny MCP Connector - Product - Confluence","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny Mail","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny Mail","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20500] Batch initial sync for Salesforce - Jira","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20500] Batch initial sync for Salesforce - Jira","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Feed — jiminny — Sentry","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Feed — jiminny — Sentry","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Pipelines - jiminny/app","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pipelines - jiminny/app","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Formalize","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Formalize","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[SRD-6793] Les Mills activity types not pulling in - Jira","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[SRD-6793] Les Mills activity types not pulling in - Jira","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Search results: calendar | Jiminny Help Center","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Search results: calendar | Jiminny Help Center","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Jiminny","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Edit - Calendar - Engineering - Confluence","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Edit - Calendar - Engineering - Confluence","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Tabs from other devices","depth":6,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-18909-automated-reports-ask-jiminny ■ 874522","depth":9,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"27","depth":12,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"27","depth":14,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"AI Reports","depth":13,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"AI Reports","depth":14,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Ask Jiminny reports","depth":13,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ask Jiminny reports","depth":14,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXTextField","text":"Report name","depth":17,"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Period","depth":20,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXComboBox","text":"Report Type Report Type","depth":16,"value":"Report Type Report Type","help_text":"","role_description":"combo box","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Report Type","depth":18,"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Report Type","depth":19,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Clear all","depth":13,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"NAME","depth":16,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"FREQUENCY","depth":16,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"SHARED","depth":16,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"DATE","depth":16,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"ACTIONS","depth":16,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Share With Team Test - Mar 2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Monthly","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"21/04/2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Share With Team Test - Mar 2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Monthly","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"21/04/2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Only Recorded Monthly - Ves Calls - Mar 2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Monthly","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"21/04/2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Only Recorded Monthly - Ves Calls - Mar 2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Monthly","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"21/04/2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Only Recorded Monthly - Ves Calls - Mar 2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Monthly","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"21/04/2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Only Recorded Monthly - Ves Calls - Mar 2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Monthly","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"21/04/2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Expires On - 20 April - New - 13 - 19 Apr 2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Monthly","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"20/04/2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Expires On - 20 April - New - 13 - 19 Apr 2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Monthly","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"20/04/2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Expires On - 20 April - New - 13 - 19 Apr 2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Monthly","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"20/04/2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Expires On - 20 April - New - 13 - 19 Apr 2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Monthly","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"20/04/2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Health - 9 - 15 Apr 2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Weekly","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"16/04/2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Test 6 - 15 Apr 2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Daily","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"16/04/2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Test 7 - 15 Apr 2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Daily","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"16/04/2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ask Jiminny Test Report - 15 Apr 2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Daily","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"16/04/2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Test 6 - 13 Apr 2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Daily","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"14/04/2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ask Jiminny Test Report - 13 Apr 2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Daily","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"14/04/2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ask Jiminny Test Report - 13 Apr 2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Daily","depth":17,"bounds":{"left":0.184375,"top":0.0,"width":0.021180555,"height":0.018333333},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"14/04/2026","depth":17,"bounds":{"left":0.53229165,"top":0.0,"width":0.050694443,"height":0.018333333},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Shared With Group - 1 Jul 2025 - 15 Apr 2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"bounds":{"left":0.184375,"top":0.018333333,"width":0.034375,"height":0.018333333},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"31/03/2026","depth":17,"bounds":{"left":0.53229165,"top":0.018333333,"width":0.050694443,"height":0.018333333},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Product Feedback - 1 Feb - 31 Mar 2026 - All","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"bounds":{"left":0.184375,"top":0.08388889,"width":0.034375,"height":0.018333333},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"31/03/2026","depth":17,"bounds":{"left":0.53229165,"top":0.08388889,"width":0.050694443,"height":0.018333333},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Jiminny Recipient - 1 Dec 2025 - 14 May 2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"bounds":{"left":0.184375,"top":0.14944445,"width":0.034375,"height":0.018333333},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"31/03/2026","depth":17,"bounds":{"left":0.53229165,"top":0.14944445,"width":0.050694443,"height":0.018333333},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Jiminny Recipient - 1 Dec 2025 - 14 May 2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"bounds":{"left":0.184375,"top":0.215,"width":0.034375,"height":0.018333333},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"31/03/2026","depth":17,"bounds":{"left":0.53229165,"top":0.215,"width":0.050694443,"height":0.018333333},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Jiminny Recipient - 1 Dec 2025 - 14 May 2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"bounds":{"left":0.184375,"top":0.28055555,"width":0.034375,"height":0.018333333},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"31/03/2026","depth":17,"bounds":{"left":0.53229165,"top":0.28055555,"width":0.050694443,"height":0.018333333},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exec Summary - 9 Nov 2024 - 12 Mar 2026 - All","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Monthly","depth":17,"bounds":{"left":0.184375,"top":0.34611112,"width":0.034722224,"height":0.018333333},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"26/03/2026","depth":17,"bounds":{"left":0.53229165,"top":0.34611112,"width":0.050694443,"height":0.018333333},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exec Summary Podcast - 5 Sep 2024 - 10 Mar 2026 - All","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Monthly","depth":17,"bounds":{"left":0.184375,"top":0.41166666,"width":0.034722224,"height":0.018333333},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"26/03/2026","depth":17,"bounds":{"left":0.53229165,"top":0.41166666,"width":0.050694443,"height":0.018333333},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Product Feedback - 1 Feb - 31 Mar 2026 - All","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"bounds":{"left":0.184375,"top":0.47722223,"width":0.034375,"height":0.018333333},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"27/02/2026","depth":17,"bounds":{"left":0.53229165,"top":0.47722223,"width":0.050694443,"height":0.018333333},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You are currently impersonating Aneliya Angelova","depth":11,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Clear","depth":16,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextField","text":"Filter URLs","depth":16,"help_text":"","role_description":"search text field","subrole":"AXSearchField","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Pause/Resume recording network log","depth":16,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"New Request","depth":16,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Search","depth":16,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Request Blocking","depth":16,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Disable Cache","depth":17,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Disable Cache","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"No Throttling","depth":16,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Network Settings","depth":16,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"All","depth":17,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"HTML","depth":17,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"CSS","depth":17,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"JS","depth":17,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"XHR","depth":17,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Fonts","depth":17,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Images","depth":17,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Media","depth":17,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"WS","depth":17,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Other","depth":17,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Status","depth":24,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Status","depth":26,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Method","depth":24,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Method","depth":26,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Domain","depth":24,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Domain","depth":26,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"File","depth":24,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"File","depth":26,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Initiator","depth":24,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Initiator","depth":26,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Type","depth":24,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Type","depth":26,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Transferred","depth":24,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Transferred","depth":26,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Size","depth":24,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Size","depth":26,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"o36719.ingest.sentry.io","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"fetch","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"500 B","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2 B","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"o36719.ingest.sentry.io","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"fetch","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"500 B","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2 B","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"search?status[]=completed&sort_by=dateHeld&sort_direction=desc&exclude[]=stats&only_recorded=1&user_id[]=b497352e-96dd-4e53-ab44-05de24c4f424","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"6.21 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"12.94 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"automated-reports","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"5.95 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"32.51 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"recent","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"5.56 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"14.84 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"integrations","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3.83 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"5.53 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"authenticate","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3.11 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"96 B","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"find.userpilot.io","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"NX-094be170","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"cached","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"62 B","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"1.55 MB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2.54 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2.54 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2.40 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2.20 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3.58 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3.39 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4.04 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3.14 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"8.89 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2.53 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2.27 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2.53 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2.53 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2.53 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-8872945539670827668
|
-5304137138061007351
|
visual_change
|
accessibility
|
NULL
|
Platform Sprint 2 Q2 - Platform Team - Scrum Board Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira
Project Phoenix – Figma
Project Phoenix – Figma
[JY-20372] AI Reports > Empty page design and promotion - Jira
[JY-20372] AI Reports > Empty page design and promotion - Jira
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Jiminny MCP Connector - Product - Confluence
Jiminny MCP Connector - Product - Confluence
Jiminny Mail
Jiminny Mail
[JY-20500] Batch initial sync for Salesforce - Jira
[JY-20500] Batch initial sync for Salesforce - Jira
Feed — jiminny — Sentry
Feed — jiminny — Sentry
Jiminny
Jiminny
Pipelines - jiminny/app
Pipelines - jiminny/app
Formalize
Formalize
[SRD-6793] Les Mills activity types not pulling in - Jira
[SRD-6793] Les Mills activity types not pulling in - Jira
Search results: calendar | Jiminny Help Center
Search results: calendar | Jiminny Help Center
Jiminny
Jiminny
Jiminny
Jiminny
Close tab
Edit - Calendar - Engineering - Confluence
Edit - Calendar - Engineering - Confluence
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
JY-18909-automated-reports-ask-jiminny ■ 874522
27
27
AI Reports
AI Reports
Ask Jiminny reports
Ask Jiminny reports
Report name
Period
Report Type Report Type
Report Type
Report Type
Clear all
NAME
FREQUENCY
SHARED
DATE
ACTIONS
Share With Team Test - Mar 2026
Monthly
21/04/2026
Share With Team Test - Mar 2026
Monthly
21/04/2026
Only Recorded Monthly - Ves Calls - Mar 2026
Monthly
21/04/2026
Only Recorded Monthly - Ves Calls - Mar 2026
Monthly
21/04/2026
Only Recorded Monthly - Ves Calls - Mar 2026
Monthly
21/04/2026
Only Recorded Monthly - Ves Calls - Mar 2026
Monthly
21/04/2026
Expires On - 20 April - New - 13 - 19 Apr 2026
Monthly
20/04/2026
Expires On - 20 April - New - 13 - 19 Apr 2026
Monthly
20/04/2026
Expires On - 20 April - New - 13 - 19 Apr 2026
Monthly
20/04/2026
Expires On - 20 April - New - 13 - 19 Apr 2026
Monthly
20/04/2026
Health - 9 - 15 Apr 2026
Weekly
16/04/2026
Test 6 - 15 Apr 2026
Daily
16/04/2026
Test 7 - 15 Apr 2026
Daily
16/04/2026
Ask Jiminny Test Report - 15 Apr 2026
Daily
16/04/2026
Test 6 - 13 Apr 2026
Daily
14/04/2026
Ask Jiminny Test Report - 13 Apr 2026
Daily
14/04/2026
Ask Jiminny Test Report - 13 Apr 2026
Daily
14/04/2026
Shared With Group - 1 Jul 2025 - 15 Apr 2026
One-Off
31/03/2026
Product Feedback - 1 Feb - 31 Mar 2026 - All
One-Off
31/03/2026
Jiminny Recipient - 1 Dec 2025 - 14 May 2026
One-Off
31/03/2026
Jiminny Recipient - 1 Dec 2025 - 14 May 2026
One-Off
31/03/2026
Jiminny Recipient - 1 Dec 2025 - 14 May 2026
One-Off
31/03/2026
Exec Summary - 9 Nov 2024 - 12 Mar 2026 - All
Monthly
26/03/2026
Exec Summary Podcast - 5 Sep 2024 - 10 Mar 2026 - All
Monthly
26/03/2026
Product Feedback - 1 Feb - 31 Mar 2026 - All
One-Off
27/02/2026
You are currently impersonating Aneliya Angelova
Clear
Filter URLs
Pause/Resume recording network log
New Request
Search
Request Blocking
Disable Cache
Disable Cache
No Throttling
Network Settings
All
HTML
CSS
JS
XHR
Fonts
Images
Media
WS
Other
Status
Status
Method
Method
Domain
Domain
File
File
Initiator
Initiator
Type
Type
Transferred
Transferred
Size
Size
200
POST
o36719.ingest.sentry.io
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
fetch
json
500 B
2 B
200
POST
o36719.ingest.sentry.io
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
fetch
json
500 B
2 B
200
GET
app.staging.jiminny.com
search?status[]=completed&sort_by=dateHeld&sort_direction=desc&exclude[]=stats&only_recorded=1&user_id[]=b497352e-96dd-4e53-ab44-05de24c4f424
xhr
json
6.21 kB
12.94 kB
200
GET
app.staging.jiminny.com
automated-reports
xhr
json
5.95 kB
32.51 kB
200
GET
app.staging.jiminny.com
recent
xhr
json
5.56 kB
14.84 kB
200
GET
app.staging.jiminny.com
integrations
xhr
json
3.83 kB
5.53 kB
200
POST
app.staging.jiminny.com
authenticate
xhr
json
3.11 kB
96 B
200
GET
find.userpilot.io
NX-094be170
xhr
json
cached
62 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
1.55 MB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
2.54 kB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
2.54 kB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
2.40 kB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
2.20 kB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
3.58 kB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
3.39 kB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
4.04 kB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
3.14 kB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
8.89 kB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
2.53 kB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
2.27 kB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
2.53 kB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
2.53 kB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t
xhr
json
2.53 kB
0 B
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=b497352e-96dd-4e53-ab44-05de24c4f424&is=IDENTIFIED&rs=0,t...
|
66726
|
|
66791
|
NULL
|
0
|
2026-04-21T15:04:08.433663+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776783848433_m2.jpg...
|
PhpStorm
|
faVsco.js – AutomatedReportsService.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsRepositoryTest
Run 'AutomatedReportsRepositoryTest'
Debug 'AutomatedReportsRepositoryTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
102
3
34
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Kiosk\AutomatedReports;
use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Carbon\Exceptions\InvalidFormatException;
use DateTime;
use DateTimeInterface;
use DateTimeZone;
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcher;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Jiminny\Component\ActivitySearch\FilterDefinition\InputTypeEnum;
use Jiminny\Component\AskAnything\AskAnythingPromptService;
use Jiminny\Component\AskAnything\Dtos\AskAnythingPromptDto;
use Jiminny\Component\UrlGenerator\Webhook;
use Jiminny\Contracts\Repositories\PlaybookCategoryRepository;
use Jiminny\Contracts\Repositories\TeamRepository;
use Jiminny\Contracts\Repositories\UserRepository;
use Jiminny\Exceptions\ApplicationException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Exceptions\ModelNotFoundException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateReportJob;
use Jiminny\Models\Activity\Search;
use Jiminny\Models\AskAnything\AskAnythingPrompt;
use Jiminny\Models\AskAnything\AskAnythingPromptTarget;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Contracts\UserContract;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AskAnythingRepository;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Repositories\GroupRepository;
use Jiminny\Repositories\SearchRepository;
use Jiminny\Repositories\StageRepository;
use Throwable;
class AutomatedReportsService
{
public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';
public const string TYPE_ASK_JIMINNY = 'ask_jiminny';
/**
* Standard report types (used by kiosk for existing automated reports).
*/
// @TODO this will add filter, however if we need to control feature by FF we need conditional logic
public const array TYPES = [
['id' => 'exec_summary', 'name' => 'Exec Summary'],
['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],
['id' => 'product_feedback', 'name' => 'Product Feedback'],
['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],
// ['id' => 'questions', 'name' => 'Questions'],
// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],
];
public const array ALL_TYPES = [
...self::TYPES,
['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],
];
public const string FREQUENCY_DAILY = 'daily';
public const string FREQUENCY_WEEKLY = 'weekly';
public const string FREQUENCY_MONTHLY = 'monthly';
public const string FREQUENCY_QUARTERLY = 'quarterly';
public const string FREQUENCY_ONE_OFF = 'one_off';
/**
* Frequencies for standard (non-Ask Jiminny) reports.
*/
public const array FREQUENCIES = [
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
/**
* Frequencies for Ask Jiminny reports.
*/
public const array ASK_JIMINNY_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
];
public const string MEDIA_TYPE_PDF = 'pdf';
public const string MEDIA_TYPE_PODCAST = 'podcast';
public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];
public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];
public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];
public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];
public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];
public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];
public const int SENT_REPORT_AT_HOURS = 5;
public const string PDF_KEY = 'pdf';
public const string AUDIO_KEY = 'audio';
private const array ALL_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
private const string S3_DIR = 'reports';
private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];
private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];
public function __construct(
private readonly TeamRepository $teamRepository,
private readonly GroupRepository $groupRepository,
private readonly UserRepository $userRepository,
private readonly StageRepository $stageRepository,
private readonly DealStagesService $dealStagesService,
private readonly RecipientsService $recipientsService,
private readonly AutomatedReportsRepository $automatedReportsRepository,
private readonly Webhook $webhookService,
private readonly BusDispatcher $dispatcher,
private readonly ActivityTypeService $activityTypeService,
private readonly PlaybookCategoryRepository $playbookCategoryRepository,
private readonly AskAnythingPromptService $askAnythingPromptService,
private readonly SearchRepository $activitySearchRepository,
private readonly AskAnythingRepository $askAnythingRepository,
) {
}
public static function getTypes(): array
{
$types = self::TYPES;
return array_map(static function ($type) {
return $type['id'];
}, $types);
}
public static function getCallTypes(): array
{
return array_map(static function ($callType) {
return $callType['id'];
}, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);
}
public static function getFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::FREQUENCIES);
}
// front-facing structure
public function getReportEnabledFieldData(bool $value = false): array
{
return [
'id' => 'report_enabled',
'label' => '',
'inputType' => InputTypeEnum::TOGGLE,
'value' => $value,
];
}
// Organizations = Teams
public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array
{
$options = $this->getTeams();
if ($shortVersion) {
return [
'id' => 'organization',
'label' => 'Organization',
'options' => $options,
];
}
return [
'id' => 'organization',
'label' => 'Organization',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $options,
'value' => $value,
'dependencies' => [
'teams',
'deal_stage_at_call',
'current_deal_stage',
'recipients',
ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,
],
'dependsOn' => [],
];
}
// Teams = Groups
public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array
{
if ($shortVersion) {
return [
'id' => 'teams',
'label' => 'Team',
'options' => $options,
];
}
return [
'id' => 'teams',
'label' => 'Team',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => false,
'placeholder' => 'Select',
'options' => $options,
'value' => $value, // value should be an array of objects {id, name}
'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],
'dependsOn' => [],
];
}
public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array
{
$types = [];
if ($team instanceof Team) {
if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
$types = self::TYPES;
}
if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {
$types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];
}
} else {
$types = self::TYPES;
}
if ($shortVersion) {
return [
'id' => 'report_type',
'label' => 'Report Type',
'options' => $types,
];
}
return [
'id' => 'report_type',
'label' => 'Report Type',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $types,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getFrequencyFieldData(?string $value = null): array
{
return [
'id' => 'frequency',
'label' => 'Frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => self::FREQUENCIES,
'value' => $value,
'dependencies' => ['period'],
'dependsOn' => [],
];
}
public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array
{
return [
'id' => 'period',
'label' => 'Select one-off period',
'inputType' => InputTypeEnum::DATE_RANGE,
'required' => true,
'placeholder' => 'Select',
'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],
'queryParams' => [
'startDate' => 'start_date_period',
'endDate' => 'end_date_period',
],
'dependencies' => [],
'dependsOn' => ['frequency'],
];
}
public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array
{
return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);
}
public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);
}
public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);
}
public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'deal_value',
'label' => 'Deal Value',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_deal_value',
'max' => 'max_deal_value',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array
{
$value = [];
$conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;
$dialerOn && $value[] = self::CALL_TYPE_DIALER;
return [
'id' => 'call_type',
'label' => 'Call Type',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => [
self::CALL_TYPE_CONFERENCE,
self::CALL_TYPE_DIALER,
],
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getMediaTypeFieldData(?AutomatedReport $report = null): array
{
$value = [];
if ($report) {
$value = $this->transformMediaTypes($report);
}
return [
'id' => 'media_types',
'label' => 'Export as',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => self::MEDIA_TYPE_OBJECTS,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'call_duration',
'label' => 'Call Duration',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_call_duration',
'max' => 'max_call_duration',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getRecipientsFieldData(?Team $team = null, array $value = []): array
{
return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);
}
public function getJiminnyRecipientsFieldData(array $value = []): array
{
return $this->recipientsService->getJiminnyRecipientsFieldData($value);
}
public function getAdditionalPromptInputFieldData(?string $value = null): array
{
return [
'id' => 'additional_prompt_input',
'label' => 'Special requirements',
'inputType' => InputTypeEnum::TEXTAREA,
'required' => false,
'placeholder' => 'What should be the focus of the report?',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCustomReportNameFieldData(?string $value = null): array
{
return [
'id' => 'custom_name',
'label' => 'Custom report name',
'inputType' => InputTypeEnum::TEXT,
'required' => false,
'placeholder' => 'Enter custom name',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
// data providers
public function getTeams(): array
{
$teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);
$teamData = [];
foreach ($teams as $team) {
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
continue;
}
$teamData[] = $this->transformTeam($team);
}
return $teamData;
}
public function getTeamGroups(string $teamUuid): array
{
$data = [];
$team = $this->getTeam($teamUuid);
if ($team !== null) {
$groups = $team->groups()->get();
foreach ($groups as $group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
];
}
}
return $data;
}
public function getTeamsGroupsOptions(array $filterTeamUuids = []): array
{
$data = [];
$teams = $this->getTeams();
foreach ($teams as $team) {
if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {
continue;
}
$data[] = [
'label' => $team['name'],
'groups' => $this->getTeamGroups($team['id']),
];
}
return $data;
}
public function getTeam(string $teamUuid): ?Team
{
return $this->teamRepository->idOrUuid($teamUuid);
}
public function getTeamById(int $teamId): ?Team
{
return $this->teamRepository->find($teamId);
}
public function getGroupsUuids(AutomatedReport $report): array
{
$uuids = [];
$reportGroups = $report->getGroups();
foreach ($reportGroups as $groupId) {
if ($group = $this->groupRepository->find($groupId)) {
$uuids[] = $group->getUuid();
}
}
return $uuids;
}
public function getPlaybookCategoriesUuids(AutomatedReport $report): array
{
$uuids = [];
$playbookCategories = $report->getPlaybookCategories();
foreach ($playbookCategories as $id) {
if ($category = $this->playbookCategoryRepository->find($id)) {
$uuids[] = $category->getUuid();
}
}
return $uuids;
}
public function getDealAtCallStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getDealAtCallStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getCurrentDealStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getCurrentDealStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getRecipients());
}
public function getJiminnyUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function extractUserUuids(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => $user->getUuid())
->values()
->all();
}
// get mail data
public function getRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getRecipients());
}
/**
* @return array<UserContract>
*/
public function getRecipientUserObjects(AutomatedReport $report): array
{
$userIds = $report->getRecipients()['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->values()
->all();
}
private function getJiminnyRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function buildRecipientUsers(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => [
'email' => $user->getEmailAddress(),
'name' => $user->getName(),
'timezone' => $user->getTimezone()->getName(),
])
->values()
->all();
}
public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array
{
if ($report->isAskJiminnyReport()) {
$recipients = $this->resolveAskJiminnyRecipients($report);
} else {
$recipients = $this->getRecipientUsers($report);
if ($includeJiminny) {
$recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));
}
}
$emails = [];
return array_values(array_filter(
$recipients,
static function ($recipient) use (&$emails) {
if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {
return false;
}
$emails[] = $recipient['email'];
return true;
}
));
}
private function resolveAskJiminnyRecipients(AutomatedReport $report): array
{
$recipients = [];
$creator = $report->getCreator();
if ($creator !== null) {
$recipients[] = [
'email' => $creator->getEmailAddress(),
'name' => $creator->getName(),
'timezone' => $creator->getTimezone()->getName(),
];
}
return array_merge(
$recipients,
$this->buildRecipientUsers($report->getRecipients()),
$this->getGroupRecipientUsers($report),
);
}
private function getGroupRecipientUsers(AutomatedReport $report): array
{
$users = [];
foreach ($report->getGroups() as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group === null) {
continue;
}
foreach ($group->getMembers() as $member) {
$users[] = [
'email' => $member->getEmailAddress(),
'name' => $member->getName(),
'timezone' => $member->getTimezone()->getName(),
];
}
}
return $users;
}
public function getReportTypeName(AutomatedReportResult $report): string
{
$type = $report->getReport()->getType();
$getType = $this->transformReportType($type);
return $getType['name'];
}
public function getReportPeriodName(AutomatedReportResult $report): string
{
$from = $report->getFromDate();
$to = $report->getToDate();
$frequency = $report->getReport()->getFrequency();
if ($from === null || $to === null) {
if (! $report->getReport()->isAskJiminnyReport()) {
$invalidPeriod = $from === null ? 'from' : 'to';
throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);
}
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
}
return $this->formatReportPeriodName($frequency, $from, $to);
}
private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string
{
$fromYear = $from->format('Y');
$toYear = $to->format('Y');
$differentYears = $fromYear !== $toYear;
switch ($frequency) {
case self::FREQUENCY_DAILY:
return $from->format('j M Y');
case self::FREQUENCY_QUARTERLY:
// 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ
$startMonth = $from->format('M');
$endMonth = $to->copy()->subMonth();
$endMonthName = $endMonth->format('M');
$endMonthYear = $endMonth->format('Y');
if ($differentYears) {
return "{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}";
}
return "{$startMonth} - {$endMonthName} {$toYear}";
case self::FREQUENCY_MONTHLY:
// 'May 2025' - monthly reports are always within the same year
return $from->format('M Y');
case self::FREQUENCY_WEEKLY:
// '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ
$startDay = $from->format('j');
$endDay = $to->format('j');
$startMonth = $from->format('M');
$endMonth = $to->format('M');
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
if ($startMonth !== $endMonth) {
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
}
return "{$startDay} - {$endDay} {$endMonth} {$toYear}";
case self::FREQUENCY_ONE_OFF:
// '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ
$startDay = $from->format('j');
$startMonth = $from->format('M');
$endDay = $to->format('j');
$endMonth = $to->format('M');
// If same month and year, use a format like '2-31 May 2025'
if ($startMonth === $endMonth && ! $differentYears) {
return "{$startDay} - {$endDay} {$startMonth} {$toYear}";
}
// If different years, include both years
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
// Same year but different months
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
default:
// Default format for unknown frequencies
return $from->format('j M Y') . ' - ' . $to->format('j M Y');
}
}
public function getReportTeamsName(AutomatedReportResult $report): string
{
$groups = $report->getGroups();
if (empty($groups)) {
return 'All';
}
// Get group names from repository
$groupNames = [];
foreach ($groups as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group) {
$groupNames[] = $group->getName();
}
}
if (count($groupNames) === 1) {
// Single team format
$teamsName = $groupNames[0];
} else {
// Multiple teams format
$teamsName = implode(', ', $groupNames);
}
return $teamsName;
}
public function getReportFileName(AutomatedReportResult $report): string
{
$customName = $report->getReport()->getCustomName();
$periodName = $this->getReportPeriodName($report);
$filenameSuffix = $this->getFilenameSuffix($report);
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$customName} - {$periodName}");
}
$baseName = $this->getReportTypeName($report);
if ($filenameSuffix) {
$baseName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}");
}
public function getReportFileNameWithExtension(AutomatedReportResult $result): string
{
$extension = $this->getMediaTypeMetadata($result)['extension'];
return $this->getReportFileName($result) . '.' . $extension;
}
public function sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool
{
$recipients = array_map('intval', $report->getRecipients()['users'] ?? []);
return in_array($user->getId(), $recipients);
}
public function transformReportResults(Collection $automatedReportResults): array
{
$data = [];
foreach ($automatedReportResults as $automatedReportResult) {
/** @var AutomatedReportResult $automatedReportResult */
$report = $automatedReportResult->getReport();
$createdBy = $report->getCreator();
$creator = [
'id' => $createdBy?->getUuid(),
'name' => $createdBy?->getName(),
'email' => $createdBy?->getEmailAddress(),
'photoUrl' => $createdBy?->getPhotoUrl(),
];
$data[] = [
'id' => $automatedReportResult->getUuid(),
'name' => $automatedReportResult->getName(),
'frequency' => $this->transformFrequency($report->getFrequency()),
'recipients' => $this->buildRecipients($report),
'report_type' => $this->transformReportType($report->getType()),
'media_type' => $automatedReportResult->getMediaType(),
'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),
'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),
'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),
'creator' => $creator,
];
}
return $data;
}
private function buildRecipients(AutomatedReport $report): array
{
$creatorUuid = $report->getCreator()?->getUuid();
$recipients = array_values(array_filter(
$this->transformRecipients($report->getRecipients()),
static fn (array $recipient): bool => $recipient['id'] !== $creatorUuid,
));
if (! $report->isAskJiminnyReport()) {
return $recipients;
}
return [
...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),
...$recipients,
];
}
public function hasCallTypeConference(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);
}
public function hasCallTypeDialer(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);
}
// transformers
private function transformTeam(Team $team): array
{
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
return [];
}
return [
'id' => $team->getUuid(),
'name' => $team->getName(),
];
}
private function transformReportFullView(AutomatedReport $report): array
{
$base = $this->transformReportBase($report);
return $report->getType() === self::TYPE_ASK_JIMINNY
? $base + $this->transformAskJiminnyFields($report)
: $base + $this->transformStandardReportFields($report);
}
private function transformReportBase(AutomatedReport $report): array
{
return [
'id' => $report->getUuid(),
'organization' => $this->transformOrganization(team: $report->getTeam()),
'report_type' => $this->transformReportType($report->getType()),
'frequency' => $this->transformFrequency($report->getFrequency()),
];
}
private function transformStandardReportFields(AutomatedReport $report): array
{
$team = $report->getTeam();
return [
'report_enabled' => $report->getStatus(),
'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),
'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),
'deal_value_min' => $report->getDealValueMin(),
'deal_value_max' => $report->getDealValueMax(),
'call_types' => $this->transformCallType($report->getCallTypes()),
'media_types' => $this->transformMediaTypes($report),
'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),
'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),
'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),
'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),
'recipients' => $this->transformRecipients($report->getRecipients()),
'created_by' => $this->transformCreator($report->getCreator()),
'additional_prompt_input' => $report->getAdditionalPromptInput(),
'custom_name' => $report->getCustomName(),
'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),
'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),
'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),
];
}
private function transformAskJiminnyFields(AutomatedReport $report): array
{
$team = $report->getTeam();
$creatorId = $report->getAttribute('created_by');
$explicitUserIds = array_values(array_filter(
$report->getRecipients()['users'] ?? [],
static fn ($id) => $id !== $creatorId
));
return [
'report_name' => $report->getCustomName(),
'enabled' => $report->getStatus(),
'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),
'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),
'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),
'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),
];
}
private function transformOrganization(?Team $team): array
{
return [
'id' => $team?->getUuid(),
'name' => $team?->getName(),
];
}
private function transformReportType(string $type): array
{
foreach (self::ALL_TYPES as $typeItem) {
if ($typeItem['id'] === $type) {
return $typeItem;
}
}
return [];
}
private function transformCallType(array $types): array
{
$result = [];
$callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];
foreach ($types as $type) {
foreach ($callTypes as $callTypeItem) {
if ($callTypeItem['id'] === $type) {
$result[] = $callTypeItem;
break;
}
}
}
return $result;
}
private function transformMediaTypes(AutomatedReport $report): array
{
$values = [];
foreach ($report->getMediaTypes() as $mediaType) {
if (! in_array($mediaType, self::MEDIA_TYPES, true)) {
continue;
}
$values[] = match ($mediaType) {
self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,
self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,
};
}
return $values;
}
private function transformFrequency(string $frequency): array
{
foreach (self::ALL_FREQUENCIES as $frequencyItem) {
if ($frequencyItem['id'] === $frequency) {
return $frequencyItem;
}
}
return [];
}
public function transformDurationToMinutes(?int $duration): ?int
{
if (! $duration) {
return null;
}
return (int) ($duration / 60);
}
private function transformGroups(?Team $team, array $groupsIds): array
{
if (empty($groupsIds) || ! $team) {
return [];
}
$data = [];
foreach ($groupsIds as $groupId) {
$group = $team->groups()->where('id', $groupId)->first();
if ($group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
'photoUrl' => $group->getPhotoUrl(),
];
}
}
return $data;
}
private function transformStages(?Team $team, array $stagesIds): array
{
if (empty($stagesIds) || ! $team) {
return [];
}
$data = [];
foreach ($stagesIds as $stageId) {
$stage = $team->stages()->where('id', $stageId)->first();
if ($stage) {
$data[] = [
'id' => $stage->getUuid(),
'name' => $stage->getName(),
];
}
}
return $data;
}
private function transformRecipients(array $recipients): array
{
$users = [];
foreach ($recipients['users'] ?? [] as $userId) {
$users[] = $this->transformUser($userId);
}
return $users;
}
private function transformCreator(?User $user): ?array
{
if ($user === null) {
return null;
}
return $this->transformUser($user->getId());
}
private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array
{
if ($prompt === null) {
return null;
}
return [
'id' => $prompt->getUuid(),
'name' => $prompt->getTitle(),
];
}
private function transformSafeSearch(?Search $search): ?array
{
if ($search === null) {
return null;
}
return [
'id' => $search->getUuid(),
'name' => $search->getName(),
];
}
private function transformUser(int $userId): array
{
/* @var ?User $user */
$user = $this->userRepository->find($userId);
return [
'id' => $user?->getUuid(),
'name' => $user?->getName(),
'email' => $user?->getEmailAddress(),
'photoUrl' => $user?->getPhotoUrl(),
];
}
public function create(array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$validatedData['created_by'] = auth()->id();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
public function update(string $uuid, array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$report = $this->automatedReportsRepository->findByUuid($uuid);
if (! $report) {
throw new InvalidArgumentException('Report not found');
}
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
/**
* Create an Ask Jiminny report.
*/
public function createAskJiminnyReport(array $data, User $creator): array
{
$validatedData = $this->validateAskJiminnyReportData($data, $creator);
$validatedData['created_by'] = $creator->getId();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
return $this->transformReportFullView($automatedReport);
}
/**
* Update an Ask Jiminny report.
*/
public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array
{
if (! $report->isAskJiminnyReport()) {
throw new InvalidArgumentException('Report is not an Ask Jiminny report');
}
$validatedData = $this->validateAskJiminnyReportData($data, $user);
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
return $this->transformReportFullView($automatedReport);
}
public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array
{
$this->automatedReportsRepository->update($report, ['status' => $status]);
return $this->transformReportFullView($report->fresh());
}
/**
* Validate and transform data for Ask Jiminny reports.
*/
private function validateAskJiminnyReportData(array $data, User $user): array
{
// Validate name
$name = trim($data['report_name'] ?? '');
if (empty($name)) {
throw new InvalidArgumentException('Report name is required');
}
if (mb_strlen($name) > 50) {
throw new InvalidArgumentException('Report name must be 50 characters or less');
}
// Validate frequency (only daily, weekly, monthly for Ask Jiminny)
$frequency = $data['frequency'] ?? null;
$askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];
if (! in_array($frequency, $askJiminnyFrequencies, true)) {
throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');
}
// Validate expiration date
$expiresAt = $data['expires_on'] ?? null;
if (empty($expiresAt)) {
throw new InvalidArgumentException('Expiration date is required');
}
try {
$expiresAtDate = Carbon::parse($expiresAt);
} catch (InvalidFormatException $e) {
throw new InvalidArgumentException('Expiration date format is invalid');
}
$maxExpiration = Carbon::now()->addYear()->endOfDay();
if ($expiresAtDate->gt($maxExpiration)) {
throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');
}
if ($expiresAtDate->isPast()) {
throw new InvalidArgumentException('Expiration date cannot be in the past');
}
// Validate saved search
$activitySearchId = $data['saved_search'] ?? null;
if (empty($activitySearchId)) {
throw new InvalidArgumentException('Saved search is required');
}
$savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);
if (! $savedSearch) {
throw new InvalidArgumentException('Saved search not found or does not belong to you');
}
// Validate saved prompt
$askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;
if (empty($askAnythingPromptId)) {
throw new InvalidArgumentException('Ask Jiminny prompt is required');
}
$prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);
if (! $prompt) {
throw new InvalidArgumentException('Ask Jiminny prompt not found');
}
// Validate status
$status = $data['enabled'] ?? false;
$recipientUserIds = [$user->getId()];
if (! empty($data['share_users'])) {
$sharedUserIds = $this->validateAndGetUserIdsByTeam(
$user->team,
(array) $data['share_users']
);
$recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);
}
$sharedGroupIds = [];
if (! empty($data['share_teams'])) {
$sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);
}
$recipientUserIds = array_values(array_unique($recipientUserIds));
return [
'team_id' => $user->getTeamId(),
'type' => self::TYPE_ASK_JIMINNY,
'status' => (bool) $status,
'frequency' => $frequency,
'custom_name' => $name,
'activity_search_id' => $savedSearch->getId(),
'ask_anything_prompt_id' => $prompt->getId(),
'expires_at' => $expiresAtDate->toDateString(),
'media_types' => [self::MEDIA_TYPE_PDF],
'call_types' => [],
'recipients' => ['users' => $recipientUserIds],
'groups' => $sharedGroupIds,
];
}
public static function getAskJiminnyFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::ASK_JIMINNY_FREQUENCIES);
}
public function getAskJiminnyReportFilters(User $user): array
{
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
return [
[
'id' => 'prompt',
'label' => 'Prompt',
'options' => $prompts,
],
[
'id' => 'saved_search',
'label' => 'Saved Search',
'options' => $savedSearches,
],
];
}
public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array
{
$team = $user->getTeam();
$userTimezone = $user->getTimezone();
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
$teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [
'id' => $group->getUuid(),
'name' => $group->getName(),
])->values()->all();
$shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];
$sharedTeamsValue = [];
$sharedUsersValue = [];
if ($report) {
$sharedTeamsValue = $this->transformGroups($team, $report->getGroups());
$recipientUserIds = $report->getRecipients()['users'] ?? [];
$creatorId = $report->getAttribute('created_by');
$sharedUserIds = array_values(array_filter(
$recipientUserIds,
static fn ($id) => $id !== $creatorId
));
$sharedUsersValue = collect($sharedUserIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (User $u) => [
'id' => $u->getUuid(),
'name' => $u->getName(),
])
->values()
->all();
}
return [
'fields' => [
[
'id' => 'enabled',
'inputType' => InputTypeEnum::TOGGLE,
'label' => '',
'value' => $report?->getStatus() ?? false,
],
[
'id' => 'report_name',
'inputType' => InputTypeEnum::TEXT,
'label' => 'Name',
'placeholder' => 'Enter name',
'required' => true,
'validation' => ['maxLength' => 50],
'value' => $report?->getCustomName() ?? '',
],
[
'id' => 'frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'label' => 'Frequency',
'required' => true,
'placeholder' => 'Select',
'options' => self::ASK_JIMINNY_FREQUENCIES,
'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,
],
[
'id' => 'expires_on',
'inputType' => InputTypeEnum::DATE,
'label' => 'Expires on',
'required' => true,
'placeholder' => 'Select',
'validation' => [
'minDate' => now($userTimezone)->toDateString(),
'maxDate' => n...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"#11894 on JY-18909-automated-reports-ask-jiminny, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.12134308,"height":0.025538707},"help_text":"Pull request #11894 exists for current branch JY-18909-automated-reports-ask-jiminny","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8161569,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AutomatedReportsRepositoryTest","depth":6,"bounds":{"left":0.83144945,"top":0.019952115,"width":0.084109046,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AutomatedReportsRepositoryTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AutomatedReportsRepositoryTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"102","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.011968086,"height":0.0},"role_description":"text"},{"role":"AXStaticText","text":"3","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.007978723,"height":0.0},"role_description":"text"},{"role":"AXStaticText","text":"34","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.010305851,"height":0.0},"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.006981383,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Kiosk\\AutomatedReports;\n\nuse Carbon\\CarbonImmutable;\nuse Carbon\\CarbonInterface;\nuse Carbon\\Exceptions\\InvalidFormatException;\nuse DateTime;\nuse DateTimeInterface;\nuse DateTimeZone;\nuse Illuminate\\Contracts\\Bus\\Dispatcher as BusDispatcher;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Support\\Facades\\Log;\nuse Illuminate\\Support\\Facades\\Storage;\nuse Jiminny\\Component\\ActivitySearch\\FilterDefinition\\InputTypeEnum;\nuse Jiminny\\Component\\AskAnything\\AskAnythingPromptService;\nuse Jiminny\\Component\\AskAnything\\Dtos\\AskAnythingPromptDto;\nuse Jiminny\\Component\\UrlGenerator\\Webhook;\nuse Jiminny\\Contracts\\Repositories\\PlaybookCategoryRepository;\nuse Jiminny\\Contracts\\Repositories\\TeamRepository;\nuse Jiminny\\Contracts\\Repositories\\UserRepository;\nuse Jiminny\\Exceptions\\ApplicationException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Exceptions\\ModelNotFoundException;\nuse Jiminny\\Jobs\\AutomatedReports\\RequestGenerateReportJob;\nuse Jiminny\\Models\\Activity\\Search;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPrompt;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPromptTarget;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Contracts\\UserContract;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Repositories\\AskAnythingRepository;\nuse Jiminny\\Repositories\\AutomatedReportsRepository;\nuse Jiminny\\Repositories\\GroupRepository;\nuse Jiminny\\Repositories\\SearchRepository;\nuse Jiminny\\Repositories\\StageRepository;\nuse Throwable;\n\nclass AutomatedReportsService\n{\n public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';\n public const string TYPE_ASK_JIMINNY = 'ask_jiminny';\n\n /**\n * Standard report types (used by kiosk for existing automated reports).\n */\n // @TODO this will add filter, however if we need to control feature by FF we need conditional logic\n public const array TYPES = [\n ['id' => 'exec_summary', 'name' => 'Exec Summary'],\n ['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],\n ['id' => 'product_feedback', 'name' => 'Product Feedback'],\n ['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],\n// ['id' => 'questions', 'name' => 'Questions'],\n// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],\n ];\n\n public const array ALL_TYPES = [\n ...self::TYPES,\n ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],\n ];\n\n public const string FREQUENCY_DAILY = 'daily';\n public const string FREQUENCY_WEEKLY = 'weekly';\n public const string FREQUENCY_MONTHLY = 'monthly';\n public const string FREQUENCY_QUARTERLY = 'quarterly';\n public const string FREQUENCY_ONE_OFF = 'one_off';\n\n /**\n * Frequencies for standard (non-Ask Jiminny) reports.\n */\n public const array FREQUENCIES = [\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n\n /**\n * Frequencies for Ask Jiminny reports.\n */\n public const array ASK_JIMINNY_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ];\n\n public const string MEDIA_TYPE_PDF = 'pdf';\n public const string MEDIA_TYPE_PODCAST = 'podcast';\n public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];\n public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];\n public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];\n public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];\n\n public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];\n public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];\n public const int SENT_REPORT_AT_HOURS = 5;\n public const string PDF_KEY = 'pdf';\n public const string AUDIO_KEY = 'audio';\n\n private const array ALL_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n private const string S3_DIR = 'reports';\n private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];\n private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];\n\n public function __construct(\n private readonly TeamRepository $teamRepository,\n private readonly GroupRepository $groupRepository,\n private readonly UserRepository $userRepository,\n private readonly StageRepository $stageRepository,\n private readonly DealStagesService $dealStagesService,\n private readonly RecipientsService $recipientsService,\n private readonly AutomatedReportsRepository $automatedReportsRepository,\n private readonly Webhook $webhookService,\n private readonly BusDispatcher $dispatcher,\n private readonly ActivityTypeService $activityTypeService,\n private readonly PlaybookCategoryRepository $playbookCategoryRepository,\n private readonly AskAnythingPromptService $askAnythingPromptService,\n private readonly SearchRepository $activitySearchRepository,\n private readonly AskAnythingRepository $askAnythingRepository,\n ) {\n }\n\n public static function getTypes(): array\n {\n $types = self::TYPES;\n\n return array_map(static function ($type) {\n return $type['id'];\n }, $types);\n }\n\n public static function getCallTypes(): array\n {\n return array_map(static function ($callType) {\n return $callType['id'];\n }, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);\n }\n\n public static function getFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::FREQUENCIES);\n }\n\n // front-facing structure\n public function getReportEnabledFieldData(bool $value = false): array\n {\n return [\n 'id' => 'report_enabled',\n 'label' => '',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'value' => $value,\n ];\n }\n\n // Organizations = Teams\n public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array\n {\n $options = $this->getTeams();\n\n if ($shortVersion) {\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value,\n 'dependencies' => [\n 'teams',\n 'deal_stage_at_call',\n 'current_deal_stage',\n 'recipients',\n ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,\n ],\n 'dependsOn' => [],\n ];\n }\n\n // Teams = Groups\n public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array\n {\n if ($shortVersion) {\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value, // value should be an array of objects {id, name}\n 'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],\n 'dependsOn' => [],\n ];\n }\n\n public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array\n {\n $types = [];\n if ($team instanceof Team) {\n if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n $types = self::TYPES;\n }\n if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {\n $types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];\n }\n } else {\n $types = self::TYPES;\n }\n\n if ($shortVersion) {\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'options' => $types,\n ];\n }\n\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $types,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getFrequencyFieldData(?string $value = null): array\n {\n return [\n 'id' => 'frequency',\n 'label' => 'Frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::FREQUENCIES,\n 'value' => $value,\n 'dependencies' => ['period'],\n 'dependsOn' => [],\n ];\n }\n\n public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array\n {\n return [\n 'id' => 'period',\n 'label' => 'Select one-off period',\n 'inputType' => InputTypeEnum::DATE_RANGE,\n 'required' => true,\n 'placeholder' => 'Select',\n 'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],\n 'queryParams' => [\n 'startDate' => 'start_date_period',\n 'endDate' => 'end_date_period',\n ],\n 'dependencies' => [],\n 'dependsOn' => ['frequency'],\n ];\n }\n\n public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array\n {\n return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);\n }\n\n public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);\n }\n\n public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);\n }\n\n public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'deal_value',\n 'label' => 'Deal Value',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_deal_value',\n 'max' => 'max_deal_value',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array\n {\n $value = [];\n $conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;\n $dialerOn && $value[] = self::CALL_TYPE_DIALER;\n\n return [\n 'id' => 'call_type',\n 'label' => 'Call Type',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => [\n self::CALL_TYPE_CONFERENCE,\n self::CALL_TYPE_DIALER,\n ],\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getMediaTypeFieldData(?AutomatedReport $report = null): array\n {\n $value = [];\n\n if ($report) {\n $value = $this->transformMediaTypes($report);\n }\n\n return [\n 'id' => 'media_types',\n 'label' => 'Export as',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => self::MEDIA_TYPE_OBJECTS,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'call_duration',\n 'label' => 'Call Duration',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_call_duration',\n 'max' => 'max_call_duration',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getRecipientsFieldData(?Team $team = null, array $value = []): array\n {\n return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);\n }\n\n public function getJiminnyRecipientsFieldData(array $value = []): array\n {\n return $this->recipientsService->getJiminnyRecipientsFieldData($value);\n }\n\n public function getAdditionalPromptInputFieldData(?string $value = null): array\n {\n return [\n 'id' => 'additional_prompt_input',\n 'label' => 'Special requirements',\n 'inputType' => InputTypeEnum::TEXTAREA,\n 'required' => false,\n 'placeholder' => 'What should be the focus of the report?',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCustomReportNameFieldData(?string $value = null): array\n {\n return [\n 'id' => 'custom_name',\n 'label' => 'Custom report name',\n 'inputType' => InputTypeEnum::TEXT,\n 'required' => false,\n 'placeholder' => 'Enter custom name',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n // data providers\n public function getTeams(): array\n {\n $teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);\n\n $teamData = [];\n foreach ($teams as $team) {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n continue;\n }\n\n $teamData[] = $this->transformTeam($team);\n }\n\n return $teamData;\n }\n\n public function getTeamGroups(string $teamUuid): array\n {\n $data = [];\n $team = $this->getTeam($teamUuid);\n\n if ($team !== null) {\n $groups = $team->groups()->get();\n\n foreach ($groups as $group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n public function getTeamsGroupsOptions(array $filterTeamUuids = []): array\n {\n $data = [];\n $teams = $this->getTeams();\n\n foreach ($teams as $team) {\n if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {\n continue;\n }\n\n $data[] = [\n 'label' => $team['name'],\n 'groups' => $this->getTeamGroups($team['id']),\n ];\n }\n\n return $data;\n }\n\n public function getTeam(string $teamUuid): ?Team\n {\n return $this->teamRepository->idOrUuid($teamUuid);\n }\n\n public function getTeamById(int $teamId): ?Team\n {\n return $this->teamRepository->find($teamId);\n }\n\n public function getGroupsUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportGroups = $report->getGroups();\n foreach ($reportGroups as $groupId) {\n if ($group = $this->groupRepository->find($groupId)) {\n $uuids[] = $group->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getPlaybookCategoriesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $playbookCategories = $report->getPlaybookCategories();\n foreach ($playbookCategories as $id) {\n if ($category = $this->playbookCategoryRepository->find($id)) {\n $uuids[] = $category->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getDealAtCallStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getDealAtCallStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getCurrentDealStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getCurrentDealStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getRecipients());\n }\n\n public function getJiminnyUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function extractUserUuids(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => $user->getUuid())\n ->values()\n ->all();\n }\n\n // get mail data\n public function getRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getRecipients());\n }\n\n /**\n * @return array<UserContract>\n */\n public function getRecipientUserObjects(AutomatedReport $report): array\n {\n $userIds = $report->getRecipients()['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->values()\n ->all();\n }\n\n private function getJiminnyRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function buildRecipientUsers(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => [\n 'email' => $user->getEmailAddress(),\n 'name' => $user->getName(),\n 'timezone' => $user->getTimezone()->getName(),\n ])\n ->values()\n ->all();\n }\n\n public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array\n {\n if ($report->isAskJiminnyReport()) {\n $recipients = $this->resolveAskJiminnyRecipients($report);\n } else {\n $recipients = $this->getRecipientUsers($report);\n if ($includeJiminny) {\n $recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));\n }\n }\n\n $emails = [];\n\n return array_values(array_filter(\n $recipients,\n static function ($recipient) use (&$emails) {\n if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {\n return false;\n }\n $emails[] = $recipient['email'];\n\n return true;\n }\n ));\n }\n\n private function resolveAskJiminnyRecipients(AutomatedReport $report): array\n {\n $recipients = [];\n\n $creator = $report->getCreator();\n if ($creator !== null) {\n $recipients[] = [\n 'email' => $creator->getEmailAddress(),\n 'name' => $creator->getName(),\n 'timezone' => $creator->getTimezone()->getName(),\n ];\n }\n\n return array_merge(\n $recipients,\n $this->buildRecipientUsers($report->getRecipients()),\n $this->getGroupRecipientUsers($report),\n );\n }\n\n private function getGroupRecipientUsers(AutomatedReport $report): array\n {\n $users = [];\n foreach ($report->getGroups() as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group === null) {\n continue;\n }\n foreach ($group->getMembers() as $member) {\n $users[] = [\n 'email' => $member->getEmailAddress(),\n 'name' => $member->getName(),\n 'timezone' => $member->getTimezone()->getName(),\n ];\n }\n }\n\n return $users;\n }\n\n public function getReportTypeName(AutomatedReportResult $report): string\n {\n $type = $report->getReport()->getType();\n\n $getType = $this->transformReportType($type);\n\n return $getType['name'];\n }\n\n public function getReportPeriodName(AutomatedReportResult $report): string\n {\n $from = $report->getFromDate();\n $to = $report->getToDate();\n $frequency = $report->getReport()->getFrequency();\n\n if ($from === null || $to === null) {\n if (! $report->getReport()->isAskJiminnyReport()) {\n $invalidPeriod = $from === null ? 'from' : 'to';\n\n throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);\n }\n\n $period = $this->calculateFromAndToDatePeriod($frequency);\n $from = $period['fromDate'];\n $to = $period['toDate'];\n }\n\n return $this->formatReportPeriodName($frequency, $from, $to);\n }\n\n private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string\n {\n $fromYear = $from->format('Y');\n $toYear = $to->format('Y');\n $differentYears = $fromYear !== $toYear;\n\n switch ($frequency) {\n case self::FREQUENCY_DAILY:\n return $from->format('j M Y');\n\n case self::FREQUENCY_QUARTERLY:\n // 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ\n $startMonth = $from->format('M');\n $endMonth = $to->copy()->subMonth();\n $endMonthName = $endMonth->format('M');\n $endMonthYear = $endMonth->format('Y');\n\n if ($differentYears) {\n return \"{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}\";\n }\n\n return \"{$startMonth} - {$endMonthName} {$toYear}\";\n\n case self::FREQUENCY_MONTHLY:\n // 'May 2025' - monthly reports are always within the same year\n return $from->format('M Y');\n\n case self::FREQUENCY_WEEKLY:\n // '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ\n $startDay = $from->format('j');\n $endDay = $to->format('j');\n $startMonth = $from->format('M');\n $endMonth = $to->format('M');\n\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n if ($startMonth !== $endMonth) {\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n return \"{$startDay} - {$endDay} {$endMonth} {$toYear}\";\n\n case self::FREQUENCY_ONE_OFF:\n // '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ\n $startDay = $from->format('j');\n $startMonth = $from->format('M');\n $endDay = $to->format('j');\n $endMonth = $to->format('M');\n\n // If same month and year, use a format like '2-31 May 2025'\n if ($startMonth === $endMonth && ! $differentYears) {\n return \"{$startDay} - {$endDay} {$startMonth} {$toYear}\";\n }\n\n // If different years, include both years\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n // Same year but different months\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n\n default:\n // Default format for unknown frequencies\n return $from->format('j M Y') . ' - ' . $to->format('j M Y');\n }\n }\n\n public function getReportTeamsName(AutomatedReportResult $report): string\n {\n $groups = $report->getGroups();\n\n if (empty($groups)) {\n return 'All';\n }\n\n // Get group names from repository\n $groupNames = [];\n foreach ($groups as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group) {\n $groupNames[] = $group->getName();\n }\n }\n\n if (count($groupNames) === 1) {\n // Single team format\n $teamsName = $groupNames[0];\n } else {\n // Multiple teams format\n $teamsName = implode(', ', $groupNames);\n }\n\n return $teamsName;\n }\n\n public function getReportFileName(AutomatedReportResult $report): string\n {\n $customName = $report->getReport()->getCustomName();\n $periodName = $this->getReportPeriodName($report);\n $filenameSuffix = $this->getFilenameSuffix($report);\n\n if ($customName) {\n if ($filenameSuffix) {\n $customName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$customName} - {$periodName}\");\n }\n\n $baseName = $this->getReportTypeName($report);\n\n if ($filenameSuffix) {\n $baseName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}\");\n }\n\n public function getReportFileNameWithExtension(AutomatedReportResult $result): string\n {\n $extension = $this->getMediaTypeMetadata($result)['extension'];\n\n return $this->getReportFileName($result) . '.' . $extension;\n }\n\n public function sanitizeFileName(string $fileName): string\n {\n return str_replace(['/', '\\\\'], '-', $fileName);\n }\n\n public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool\n {\n $recipients = array_map('intval', $report->getRecipients()['users'] ?? []);\n\n return in_array($user->getId(), $recipients);\n }\n\n public function transformReportResults(Collection $automatedReportResults): array\n {\n $data = [];\n foreach ($automatedReportResults as $automatedReportResult) {\n /** @var AutomatedReportResult $automatedReportResult */\n\n $report = $automatedReportResult->getReport();\n\n $createdBy = $report->getCreator();\n $creator = [\n 'id' => $createdBy?->getUuid(),\n 'name' => $createdBy?->getName(),\n 'email' => $createdBy?->getEmailAddress(),\n 'photoUrl' => $createdBy?->getPhotoUrl(),\n ];\n\n $data[] = [\n 'id' => $automatedReportResult->getUuid(),\n 'name' => $automatedReportResult->getName(),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n 'recipients' => $this->buildRecipients($report),\n 'report_type' => $this->transformReportType($report->getType()),\n 'media_type' => $automatedReportResult->getMediaType(),\n 'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),\n 'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),\n 'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),\n 'creator' => $creator,\n ];\n }\n\n return $data;\n }\n\n private function buildRecipients(AutomatedReport $report): array\n {\n $creatorUuid = $report->getCreator()?->getUuid();\n\n $recipients = array_values(array_filter(\n $this->transformRecipients($report->getRecipients()),\n static fn (array $recipient): bool => $recipient['id'] !== $creatorUuid,\n ));\n\n if (! $report->isAskJiminnyReport()) {\n return $recipients;\n }\n\n return [\n ...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),\n ...$recipients,\n ];\n }\n\n public function hasCallTypeConference(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);\n }\n\n public function hasCallTypeDialer(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);\n }\n\n // transformers\n private function transformTeam(Team $team): array\n {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n return [];\n }\n\n return [\n 'id' => $team->getUuid(),\n 'name' => $team->getName(),\n ];\n }\n\n private function transformReportFullView(AutomatedReport $report): array\n {\n $base = $this->transformReportBase($report);\n\n return $report->getType() === self::TYPE_ASK_JIMINNY\n ? $base + $this->transformAskJiminnyFields($report)\n : $base + $this->transformStandardReportFields($report);\n }\n\n private function transformReportBase(AutomatedReport $report): array\n {\n return [\n 'id' => $report->getUuid(),\n 'organization' => $this->transformOrganization(team: $report->getTeam()),\n 'report_type' => $this->transformReportType($report->getType()),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n ];\n }\n\n private function transformStandardReportFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n\n return [\n 'report_enabled' => $report->getStatus(),\n 'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),\n 'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),\n 'deal_value_min' => $report->getDealValueMin(),\n 'deal_value_max' => $report->getDealValueMax(),\n 'call_types' => $this->transformCallType($report->getCallTypes()),\n 'media_types' => $this->transformMediaTypes($report),\n 'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),\n 'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),\n 'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),\n 'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),\n 'recipients' => $this->transformRecipients($report->getRecipients()),\n 'created_by' => $this->transformCreator($report->getCreator()),\n 'additional_prompt_input' => $report->getAdditionalPromptInput(),\n 'custom_name' => $report->getCustomName(),\n 'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),\n 'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),\n 'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),\n ];\n }\n\n private function transformAskJiminnyFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n $creatorId = $report->getAttribute('created_by');\n $explicitUserIds = array_values(array_filter(\n $report->getRecipients()['users'] ?? [],\n static fn ($id) => $id !== $creatorId\n ));\n\n return [\n 'report_name' => $report->getCustomName(),\n 'enabled' => $report->getStatus(),\n 'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),\n 'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),\n 'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),\n 'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),\n ];\n }\n\n private function transformOrganization(?Team $team): array\n {\n return [\n 'id' => $team?->getUuid(),\n 'name' => $team?->getName(),\n ];\n }\n\n private function transformReportType(string $type): array\n {\n foreach (self::ALL_TYPES as $typeItem) {\n if ($typeItem['id'] === $type) {\n return $typeItem;\n }\n }\n\n return [];\n }\n\n private function transformCallType(array $types): array\n {\n $result = [];\n $callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];\n\n foreach ($types as $type) {\n foreach ($callTypes as $callTypeItem) {\n if ($callTypeItem['id'] === $type) {\n $result[] = $callTypeItem;\n\n break;\n }\n }\n }\n\n return $result;\n }\n\n private function transformMediaTypes(AutomatedReport $report): array\n {\n $values = [];\n\n foreach ($report->getMediaTypes() as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n continue;\n }\n\n $values[] = match ($mediaType) {\n self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,\n self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,\n };\n }\n\n return $values;\n }\n\n private function transformFrequency(string $frequency): array\n {\n foreach (self::ALL_FREQUENCIES as $frequencyItem) {\n if ($frequencyItem['id'] === $frequency) {\n return $frequencyItem;\n }\n }\n\n return [];\n }\n\n public function transformDurationToMinutes(?int $duration): ?int\n {\n if (! $duration) {\n return null;\n }\n\n return (int) ($duration / 60);\n }\n\n private function transformGroups(?Team $team, array $groupsIds): array\n {\n if (empty($groupsIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($groupsIds as $groupId) {\n $group = $team->groups()->where('id', $groupId)->first();\n\n if ($group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n 'photoUrl' => $group->getPhotoUrl(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformStages(?Team $team, array $stagesIds): array\n {\n if (empty($stagesIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($stagesIds as $stageId) {\n $stage = $team->stages()->where('id', $stageId)->first();\n\n if ($stage) {\n $data[] = [\n 'id' => $stage->getUuid(),\n 'name' => $stage->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformRecipients(array $recipients): array\n {\n $users = [];\n foreach ($recipients['users'] ?? [] as $userId) {\n $users[] = $this->transformUser($userId);\n }\n\n return $users;\n }\n\n private function transformCreator(?User $user): ?array\n {\n if ($user === null) {\n return null;\n }\n\n return $this->transformUser($user->getId());\n }\n\n private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array\n {\n if ($prompt === null) {\n return null;\n }\n\n return [\n 'id' => $prompt->getUuid(),\n 'name' => $prompt->getTitle(),\n ];\n }\n\n private function transformSafeSearch(?Search $search): ?array\n {\n if ($search === null) {\n return null;\n }\n\n return [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ];\n }\n\n private function transformUser(int $userId): array\n {\n /* @var ?User $user */\n $user = $this->userRepository->find($userId);\n\n return [\n 'id' => $user?->getUuid(),\n 'name' => $user?->getName(),\n 'email' => $user?->getEmailAddress(),\n 'photoUrl' => $user?->getPhotoUrl(),\n ];\n }\n\n public function create(array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $validatedData['created_by'] = auth()->id();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function update(string $uuid, array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $report = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $report) {\n throw new InvalidArgumentException('Report not found');\n }\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Create an Ask Jiminny report.\n */\n public function createAskJiminnyReport(array $data, User $creator): array\n {\n $validatedData = $this->validateAskJiminnyReportData($data, $creator);\n $validatedData['created_by'] = $creator->getId();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Update an Ask Jiminny report.\n */\n public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array\n {\n if (! $report->isAskJiminnyReport()) {\n throw new InvalidArgumentException('Report is not an Ask Jiminny report');\n }\n\n $validatedData = $this->validateAskJiminnyReportData($data, $user);\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array\n {\n $this->automatedReportsRepository->update($report, ['status' => $status]);\n\n return $this->transformReportFullView($report->fresh());\n }\n\n /**\n * Validate and transform data for Ask Jiminny reports.\n */\n private function validateAskJiminnyReportData(array $data, User $user): array\n {\n // Validate name\n $name = trim($data['report_name'] ?? '');\n if (empty($name)) {\n throw new InvalidArgumentException('Report name is required');\n }\n if (mb_strlen($name) > 50) {\n throw new InvalidArgumentException('Report name must be 50 characters or less');\n }\n\n // Validate frequency (only daily, weekly, monthly for Ask Jiminny)\n $frequency = $data['frequency'] ?? null;\n $askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];\n if (! in_array($frequency, $askJiminnyFrequencies, true)) {\n throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');\n }\n\n // Validate expiration date\n $expiresAt = $data['expires_on'] ?? null;\n if (empty($expiresAt)) {\n throw new InvalidArgumentException('Expiration date is required');\n }\n\n try {\n $expiresAtDate = Carbon::parse($expiresAt);\n } catch (InvalidFormatException $e) {\n throw new InvalidArgumentException('Expiration date format is invalid');\n }\n $maxExpiration = Carbon::now()->addYear()->endOfDay();\n if ($expiresAtDate->gt($maxExpiration)) {\n throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');\n }\n if ($expiresAtDate->isPast()) {\n throw new InvalidArgumentException('Expiration date cannot be in the past');\n }\n\n // Validate saved search\n $activitySearchId = $data['saved_search'] ?? null;\n if (empty($activitySearchId)) {\n throw new InvalidArgumentException('Saved search is required');\n }\n $savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);\n if (! $savedSearch) {\n throw new InvalidArgumentException('Saved search not found or does not belong to you');\n }\n\n // Validate saved prompt\n $askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;\n if (empty($askAnythingPromptId)) {\n throw new InvalidArgumentException('Ask Jiminny prompt is required');\n }\n $prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);\n if (! $prompt) {\n throw new InvalidArgumentException('Ask Jiminny prompt not found');\n }\n\n // Validate status\n $status = $data['enabled'] ?? false;\n\n $recipientUserIds = [$user->getId()];\n\n if (! empty($data['share_users'])) {\n $sharedUserIds = $this->validateAndGetUserIdsByTeam(\n $user->team,\n (array) $data['share_users']\n );\n $recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);\n }\n\n $sharedGroupIds = [];\n if (! empty($data['share_teams'])) {\n $sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);\n }\n\n $recipientUserIds = array_values(array_unique($recipientUserIds));\n\n return [\n 'team_id' => $user->getTeamId(),\n 'type' => self::TYPE_ASK_JIMINNY,\n 'status' => (bool) $status,\n 'frequency' => $frequency,\n 'custom_name' => $name,\n 'activity_search_id' => $savedSearch->getId(),\n 'ask_anything_prompt_id' => $prompt->getId(),\n 'expires_at' => $expiresAtDate->toDateString(),\n 'media_types' => [self::MEDIA_TYPE_PDF],\n 'call_types' => [],\n 'recipients' => ['users' => $recipientUserIds],\n 'groups' => $sharedGroupIds,\n ];\n }\n\n public static function getAskJiminnyFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::ASK_JIMINNY_FREQUENCIES);\n }\n\n public function getAskJiminnyReportFilters(User $user): array\n {\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n return [\n [\n 'id' => 'prompt',\n 'label' => 'Prompt',\n 'options' => $prompts,\n ],\n [\n 'id' => 'saved_search',\n 'label' => 'Saved Search',\n 'options' => $savedSearches,\n ],\n ];\n }\n\n public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array\n {\n $team = $user->getTeam();\n $userTimezone = $user->getTimezone();\n\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n $teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ])->values()->all();\n\n $shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];\n\n $sharedTeamsValue = [];\n $sharedUsersValue = [];\n if ($report) {\n $sharedTeamsValue = $this->transformGroups($team, $report->getGroups());\n\n $recipientUserIds = $report->getRecipients()['users'] ?? [];\n $creatorId = $report->getAttribute('created_by');\n $sharedUserIds = array_values(array_filter(\n $recipientUserIds,\n static fn ($id) => $id !== $creatorId\n ));\n $sharedUsersValue = collect($sharedUserIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (User $u) => [\n 'id' => $u->getUuid(),\n 'name' => $u->getName(),\n ])\n ->values()\n ->all();\n }\n\n return [\n 'fields' => [\n [\n 'id' => 'enabled',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'label' => '',\n 'value' => $report?->getStatus() ?? false,\n ],\n [\n 'id' => 'report_name',\n 'inputType' => InputTypeEnum::TEXT,\n 'label' => 'Name',\n 'placeholder' => 'Enter name',\n 'required' => true,\n 'validation' => ['maxLength' => 50],\n 'value' => $report?->getCustomName() ?? '',\n ],\n [\n 'id' => 'frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Frequency',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::ASK_JIMINNY_FREQUENCIES,\n 'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,\n ],\n [\n 'id' => 'expires_on',\n 'inputType' => InputTypeEnum::DATE,\n 'label' => 'Expires on',\n 'required' => true,\n 'placeholder' => 'Select',\n 'validation' => [\n 'minDate' => now($userTimezone)->toDateString(),\n 'maxDate' => now($userTimezone)->addYear()->toDateString(),\n ],\n 'value' => $report?->getExpiresAt()?->toDateString(),\n ],\n [\n 'id' => 'share_teams',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team',\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $teamGroups,\n 'value' => $sharedTeamsValue,\n ],\n [\n 'id' => 'share_users',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team member',\n 'required' => false,\n 'placeholder' => 'Select',\n 'groupLabelKey' => 'label',\n 'groupValuesKey' => 'users',\n 'optionLabelKey' => 'name',\n 'optionValueKey' => 'id',\n 'options' => $shareUsers,\n 'value' => $sharedUsersValue,\n ],\n [\n 'id' => 'saved_search',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Saved search',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $savedSearches,\n 'value' => $report && $report->getSavedSearch() ? [\n 'id' => $report->getSavedSearch()->getUuid(),\n 'name' => $report->getSavedSearch()->getName(),\n ] : null,\n ],\n [\n 'id' => 'ask_jiminny_prompt',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Ask Jiminny prompt',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $prompts,\n 'value' => $report && $report->getAskAnythingPrompt() ? [\n 'id' => $report->getAskAnythingPrompt()->getUuid(),\n 'name' => $report->getAskAnythingPrompt()->getTitle(),\n ] : null,\n ],\n ],\n ];\n }\n\n private function updateResultNames(AutomatedReport $automatedReport): void\n {\n $results = $this->automatedReportsRepository->getResultsByReport($automatedReport);\n\n foreach ($results as $result) {\n $result->update(['name' => $this->getReportFileName($result)]);\n }\n }\n\n public function updateStatus(string $uuid, array $data): array\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $automatedReport->update([\n 'status' => $status,\n ]);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n private function generateOneOffReport(AutomatedReport $automatedReport): void\n {\n // the scheduler handles all the other frequency types\n if ($automatedReport->getStatus() === false || $automatedReport->getFrequency() !== self::FREQUENCY_ONE_OFF) {\n return;\n }\n\n $this->dispatcher->dispatch(new RequestGenerateReportJob($automatedReport->getUuid()));\n }\n\n public function getReport(string $uuid): AutomatedReport\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n return $automatedReport;\n }\n\n public function get(string $uuid): array\n {\n $automatedReport = $this->getReport($uuid);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function list(string $sortColumn = 'created_at', string $sortDirection = 'desc'): array\n {\n $results = [];\n $collection = $this->automatedReportsRepository->getAllStandardReports($sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function listAskJiminnyReports(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): array {\n $results = [];\n $collection = $this->automatedReportsRepository->getAskJiminnyReportsByUser($user, $sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function delete(string $uuid): void\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $automatedReport->delete();\n }\n\n public function createReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n return $this->automatedReportsRepository->createResult(\n array_merge(\n [\n 'report_id' => $automatedReport->getId(),\n 'status' => AutomatedReportResult::STATUS_DEFAULT,\n ],\n $data\n )\n );\n }\n\n public function getOrCreateReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n $existing = $this->automatedReportsRepository->findLatestDefaultOrFailedResult($automatedReport);\n\n if ($existing !== null) {\n $existing->update(['status' => AutomatedReportResult::STATUS_DEFAULT]);\n\n return $existing;\n }\n\n return $this->createReportResult($automatedReport, $data);\n }\n\n public function getReportResult(string $resultUuid): AutomatedReportResult\n {\n $report = $this->automatedReportsRepository->findResultByUuid($resultUuid);\n\n if (! $report) {\n throw new ModelNotFoundException('Report Result not found');\n }\n\n return $report;\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return $this->automatedReportsRepository->findChildResult($result, $type);\n }\n\n // prophet API calls\n /**\n * @throws ApplicationException\n */\n public function getGenerateReportPayload(AutomatedReport $automatedReport, string $reportResultUuid): array\n {\n $period = $this->calculateFromAndToDate($automatedReport);\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n return [\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResultUuid,\n 'report_type' => $automatedReport->getType(),\n 'media_types' => $automatedReport->getMediaTypes(),\n 'from_date' => $fromDate->startOfDay()->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->endOfDay()->format(DateTimeInterface::RFC3339),\n 'group_ids' => $automatedReport->getGroups(),\n 'call_deal_stage' => $automatedReport->getDealAtCallStages(),\n 'current_deal_stage' => $automatedReport->getCurrentDealStages(),\n 'deal_min_value' => $automatedReport->getDealValueMin(),\n 'deal_max_value' => $automatedReport->getDealValueMax(),\n 'call_types' => $automatedReport->getCallTypes(),\n 'call_duration_min_seconds' => $automatedReport->getCallDurationMin(),\n 'call_duration_max_seconds' => $automatedReport->getCallDurationMax(),\n 'special_requirements' => $automatedReport->getAdditionalPromptInput(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->formatReportPeriodName(\n $automatedReport->getFrequency(),\n $fromDate,\n $toDate,\n ),\n 'playbook_categories' => $automatedReport->getPlaybookCategories(),\n 'custom_name' => $automatedReport->getCustomName(),\n ];\n }\n\n // $inputPayload - FE payload structure\n public function getActivitiesCountPayload(array $inputPayload): array\n {\n // Use validateAndTransformData to validate and normalize input\n $validatedData = $this->validateAndTransformData($inputPayload);\n $period = $this->calculateFromAndToDatePeriod(\n $validatedData['frequency'],\n Carbon::parse($validatedData['from']),\n Carbon::parse($validatedData['to']),\n );\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n // Create payload similar to getGenerateReportPayload\n return [\n 'team_id' => $validatedData['team_id'],\n 'group_ids' => $validatedData['groups'] ?? [],\n 'report_type' => $validatedData['type'],\n 'from_date' => $fromDate->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->format(DateTimeInterface::RFC3339),\n 'call_deal_stage' => $validatedData['deal_at_call_stages'] ?? [],\n 'current_deal_stage' => $validatedData['current_deal_stages'] ?? [],\n 'deal_min_value' => $validatedData['deal_value_min'] ?? null,\n 'deal_max_value' => $validatedData['deal_value_max'] ?? null,\n 'call_types' => $validatedData['call_types'],\n 'call_duration_min_seconds' => $validatedData['call_duration_min'] ?? null,\n 'call_duration_max_seconds' => $validatedData['call_duration_max'] ?? null,\n 'special_requirements' => $validatedData['additional_prompt_input'] ?? null,\n 'playbook_categories' => $validatedData['playbook_categories'] ?? [],\n 'request_id' => null,\n 'callback_url' => null,\n ];\n }\n\n public function shouldSendReport(array $users, ?CarbonInterface $generatedAt = null): bool\n {\n if (empty($users)) {\n return false;\n }\n\n $earliestTz = collect($users)\n ->mapWithKeys(function (array $user) {\n $tz = new DateTimeZone($user['timezone']);\n $nowUtc = new DateTime('now', new DateTimeZone('UTC'));\n $offset = $tz->getOffset($nowUtc);\n\n return [$user['timezone'] => $offset];\n })\n ->sortDesc()\n ->keys()\n ->first();\n\n $now = Carbon::now($earliestTz);\n $isScheduledTime = (int) $now->format('H') === self::SENT_REPORT_AT_HOURS;\n\n if ($isScheduledTime) {\n return true;\n }\n\n return $this->hasPassedScheduledTime($generatedAt, $earliestTz);\n }\n\n public function hasPassedScheduledTime(?CarbonInterface $generatedAt, string $timezone): bool\n {\n if ($generatedAt === null) {\n return false;\n }\n\n $now = Carbon::now($timezone);\n $scheduledTime = $now->copy()->setTime(self::SENT_REPORT_AT_HOURS, 0, 0);\n\n if ($now->hour < self::SENT_REPORT_AT_HOURS) {\n $scheduledTime = $scheduledTime->subDay();\n }\n\n $scheduledTimeUtc = $scheduledTime->copy()->utc();\n $generatedAtUtc = $generatedAt->copy()->utc();\n $nowUtc = $now->copy()->utc();\n\n return $generatedAtUtc->lt($scheduledTimeUtc) && $nowUtc->gt($scheduledTimeUtc);\n }\n\n public function calculateFromAndToDatePeriod(\n string $frequency,\n ?Carbon $fromDate = null,\n ?Carbon $toDate = null\n ): array {\n if ($frequency === self::FREQUENCY_ONE_OFF) {\n return [\n 'fromDate' => $fromDate,\n 'toDate' => $toDate,\n ];\n }\n\n $now = Carbon::now();\n\n return match ($frequency) {\n self::FREQUENCY_DAILY => [\n 'fromDate' => $now->copy()->subDay()->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_WEEKLY => [\n 'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_MONTHLY => [\n 'fromDate' => $now->copy()->subMonths(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_QUARTERLY => [\n 'fromDate' => $now->copy()->subMonths(3)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n default => throw new InvalidArgumentException(\"Unsupported frequency: {$frequency}\"),\n };\n }\n\n private function calculateFromAndToDate(AutomatedReport $automatedReport): array\n {\n return $this->calculateFromAndToDatePeriod(\n $automatedReport->getFrequency(),\n $automatedReport->getFrom(),\n $automatedReport->getTo()\n );\n }\n\n public function getAskJiminnyGenerateReportPayload(\n AutomatedReport $automatedReport,\n AutomatedReportResult $reportResult,\n array $activityIds,\n ): array {\n return [\n 'user_question' => $automatedReport->getAskAnythingPrompt()?->getContent(),\n 'call_ids' => array_map('strval', $activityIds),\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResult->getUuid(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->getReportPeriodName($reportResult),\n 'report_name' => $automatedReport->getCustomName(),\n ];\n }\n\n private function getCallbackUrl(): string\n {\n return $this->webhookService->route('jiminny.webhook.reports.ready');\n }\n\n /**\n * Validate and transform payload data for automated reports\n *\n * @param array $data\n *\n * @throws InvalidArgumentException\n *\n * @return array\n */\n private function validateAndTransformData(array $data): array\n {\n // Validate organization (team) and check feature\n $team = $this->validateOrganization($data['organization'] ?? null);\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $type = $this->validateReportType($data['report_type'] ?? null);\n $frequency = $this->validateFrequency($data['frequency'] ?? null);\n $additionalPromptInput = $this->validateAdditionalPromptInput(\n $data['additional_prompt_input'] ?? null\n );\n $customReportName = $this->validateCustomReportName($data['custom_name'] ?? null);\n\n // Prepare data for the database\n $reportData = [\n 'team_id' => $team->getId(),\n 'type' => $type,\n 'status' => $status,\n 'frequency' => $frequency,\n 'additional_prompt_input' => $additionalPromptInput,\n 'custom_name' => $customReportName,\n ];\n\n // Validate deal values\n $reportData = $this->validateDealValues($data, $reportData);\n\n // Validate date range\n $reportData = $this->validateDateRange($data, $reportData, $frequency);\n\n // Validate call durations\n $reportData = $this->validateCallDurations($data, $reportData);\n\n // Validate call types\n $reportData = $this->validateCallTypes($data, $reportData);\n\n // Validate media types\n $reportData = $this->validateMediaTypes($data, $reportData);\n\n // Validate groups\n if (isset($data['teams'])) {\n $reportData['groups'] = $this->validateAndGetGroupIds($team, $data['teams']);\n }\n\n // Validate deal stages\n $reportData = $this->validateDealStages($data, $reportData, $team, $type);\n\n // Validate playbook categories\n $reportData = $this->validatePlaybookCategories($data, $reportData, $team);\n\n // Validate recipients\n $reportData['recipients'] = [\n 'users' => $this->validateAndGetUserIdsByTeam($team, $data['recipients'] ?? []),\n ];\n\n if (isset($data['jiminny_recipients'])) {\n // Validate Jiminny recipients\n $reportData['jiminny_recipients'] = [\n 'users' => $this->validateAndGetJiminnyUserIds((array) $data['jiminny_recipients']),\n ];\n }\n\n return $reportData;\n }\n\n private function validateDealValues(array $data, array $reportData): array\n {\n if (isset($data['min_deal_value'])) {\n $reportData['deal_value_min'] = (int) $data['min_deal_value'];\n\n if ($reportData['deal_value_min'] > 4294967295 || $reportData['deal_value_min'] < 0) {\n throw new InvalidArgumentException('Min deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_deal_value'])) {\n $reportData['deal_value_max'] = (int) $data['max_deal_value'];\n\n if ($reportData['deal_value_max'] > 4294967295 || $reportData['deal_value_max'] < 0) {\n throw new InvalidArgumentException('Max deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['min_deal_value'], $data['max_deal_value'])\n && $data['min_deal_value'] > $data['max_deal_value']\n ) {\n throw new InvalidArgumentException('Min deal value cannot be greater than max deal value');\n }\n\n return $reportData;\n }\n\n private function validateDateRange(array $data, array $reportData, string $frequency): array\n {\n // Set date range only for one_off frequency\n if ($frequency === 'one_off') {\n if (isset($data['start_date_period'])) {\n $reportData['from'] = $this->parseDate($data['start_date_period']);\n }\n\n if (isset($data['end_date_period'])) {\n $reportData['to'] = $this->parseDate($data['end_date_period']);\n }\n\n if (empty($reportData['from']) || empty($reportData['to'])) {\n throw new InvalidArgumentException(\n 'Start date and end date are required for one_off frequency'\n );\n }\n } else {\n $reportData['from'] = null;\n $reportData['to'] = null;\n }\n\n return $reportData;\n }\n\n private function validateCallDurations(array $data, array $reportData): array\n {\n // Convert call durations from minutes to seconds\n if (isset($data['min_call_duration'])) {\n $reportData['call_duration_min'] = (int) $data['min_call_duration'] * 60;\n\n if ($reportData['call_duration_min'] > 4294967295 || $reportData['call_duration_min'] < 0) {\n throw new InvalidArgumentException('Min call duration should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_call_duration'])) {\n $reportData['call_duration_max'] = (int) $data['max_call_duration'] * 60;\n\n if ($reportData['call_duration_max'] > 4294967295 || $reportData['call_duration_max'] < 0) {\n throw new InvalidArgumentException('Max call duration should be between 0 and 4294967295');\n }\n }\n\n return $reportData;\n }\n\n private function validateCallTypes(array $data, array $reportData): array\n {\n // Set call types\n $reportData['call_types'] = $data['call_type'] ?? [];\n if (empty($reportData['call_types'])) {\n $reportData['call_types'] = self::getCallTypes();\n }\n\n foreach ($reportData['call_types'] as $callType) {\n if (! in_array($callType, self::getCallTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Call type %s is invalid', $callType));\n }\n }\n\n return $reportData;\n }\n\n private function validateMediaTypes(array $data, array $reportData): array\n {\n // Set media types from input data\n $reportData['media_types'] = $data['media_types'] ?? [];\n\n if (empty($reportData['media_types'])) {\n throw new InvalidArgumentException('Media types are required');\n }\n\n foreach ($reportData['media_types'] as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n throw new InvalidArgumentException(sprintf('Media type %s is invalid', $mediaType));\n }\n }\n\n return $reportData;\n }\n\n private function validateDealStages(array $data, array $reportData, Team $team, string $reportType): array\n {\n // Validate and set deal stages\n if (isset($data['deal_stage_at_call'])) {\n $reportData['deal_at_call_stages'] =\n $this->validateAndGetDealStageIds($team, $data['deal_stage_at_call'], 'Deal stage at call');\n }\n\n if (isset($data['current_deal_stage'])) {\n $reportData['current_deal_stages'] =\n $this->validateAndGetDealStageIds($team, $data['current_deal_stage'], 'Current deal stage');\n }\n\n // Ensure current_deal_stage is not provided for loss_analysis report type\n if ($reportType === self::TYPE_LOSS_ANALYSIS && ! empty($data['current_deal_stage'])) {\n throw new InvalidArgumentException('Current deal stage is not applicable for Loss Analysis reports');\n }\n\n return $reportData;\n }\n\n // transform uuid to id\n private function validatePlaybookCategories(array $data, array $reportData, Team $team): array\n {\n $key = 'playbook_categories';\n\n if (isset($data[$key])) {\n $payloadIds = $data[$key];\n $ids = [];\n\n foreach ($payloadIds as $uuid) {\n $uuid = (string) $uuid;\n\n try {\n $playbookCategory = $this->playbookCategoryRepository->findByUuid($uuid);\n } catch (Throwable $throwable) {\n Log::error(__METHOD__ . ' ' . $throwable->getMessage());\n\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory) {\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory->hasPlaybook()) {\n throw new InvalidArgumentException(sprintf('Playbook category %s has no playbook', $uuid));\n }\n\n if ($playbookCategory->getPlaybook()->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Playbook category %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $ids[] = $playbookCategory->getId();\n }\n\n $reportData[$key] = $ids;\n }\n\n return $reportData;\n }\n\n private function validateReportStatus($status): bool\n {\n if (! in_array($status, [true, false], true)) {\n throw new InvalidArgumentException('Report status is invalid');\n }\n\n return $status;\n }\n\n private function validateReportType($type): string\n {\n if (! in_array($type, self::getTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Report type is invalid: %s', $type));\n }\n\n return $type;\n }\n\n private function validateFrequency($frequency): string\n {\n if (! in_array($frequency, self::getFrequencies(), true)) {\n throw new InvalidArgumentException('Frequency is invalid');\n }\n\n return $frequency;\n }\n\n private function validateAdditionalPromptInput(?string $additionalPromptInput): ?string\n {\n if ($additionalPromptInput && strlen($additionalPromptInput) > 5000) {\n throw new InvalidArgumentException('Additional Prompt Input should be less than 5000 characters');\n }\n\n return $additionalPromptInput;\n }\n\n private function validateCustomReportName(?string $customReportName): ?string\n {\n if ($customReportName === null || $customReportName === '') {\n return null;\n }\n\n if (strlen($customReportName) > 70) {\n throw new InvalidArgumentException('Custom report name should be less than 70 characters');\n }\n\n return $customReportName;\n }\n\n private function validateOrganization(?string $organizationUuid): Team\n {\n if (! $organizationUuid) {\n throw new InvalidArgumentException('Organization is required');\n }\n\n $team = $this->teamRepository->idOrUuid($organizationUuid);\n\n if (! $team) {\n throw new InvalidArgumentException('Organization not found');\n }\n\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n throw new InvalidArgumentException('Organization does not have the Automated Reports feature');\n }\n\n return $team;\n }\n\n private function validateAndGetGroupIds(Team $team, array $teamUuids): array\n {\n $groupIds = [];\n\n foreach ($teamUuids as $uuid) {\n $group = $this->groupRepository->findByUuid($uuid);\n\n if ($group === null || $group->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Group %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $groupIds[] = $group->getId();\n\n }\n\n return $groupIds;\n }\n\n private function validateAndGetDealStageIds(Team $team, array $stageUuids, string $propertyLabel): array\n {\n $stageIds = [];\n\n foreach ($stageUuids as $uuid) {\n $stage = $this->stageRepository->findByUuid($uuid);\n\n if ($stage === null || $stage->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Stage %s not found for team %s for %s', $uuid, $team->getUuid(), $propertyLabel)\n );\n }\n\n $stageIds[] = $stage->getId();\n }\n\n return $stageIds;\n }\n\n private function validateAndGetUserIds(array $userUuids, callable $teamCheck): array\n {\n if (empty($userUuids)) {\n return [];\n }\n\n $userIds = [];\n\n foreach ($userUuids as $uuid) {\n $user = $this->userRepository->findByUuid($uuid);\n\n if (! $user || ! $user->isStatusActive()) {\n throw new InvalidArgumentException(\n sprintf('User %s not found or is not active', $uuid)\n );\n }\n\n if (! $teamCheck($user)) {\n throw new InvalidArgumentException(\n sprintf('User %s does not belong to the allowed team(s)', $uuid)\n );\n }\n\n $userIds[] = $user->getId();\n }\n\n return $userIds;\n }\n\n private function validateAndGetUserIdsByTeam(Team $team, array $userUuids): array\n {\n return $this->validateAndGetUserIds($userUuids, fn ($user) => $user->getTeamId() === $team->getId());\n }\n\n private function validateAndGetJiminnyUserIds(array $userUuids): array\n {\n $allowedTeamIds = config('kiosk.teamIds', []);\n\n return $this->validateAndGetUserIds($userUuids, fn ($user) => in_array($user->getTeamId(), $allowedTeamIds, true));\n }\n\n private function parseDate(string $dateString): string\n {\n return date('Y-m-d H:i:s', strtotime($dateString));\n }\n\n private function generateReportResultViewUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.view', ['uuid' => $result->getUuid()]);\n }\n\n private function generateReportResultDownloadUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.download', ['uuid' => $result->getUuid()]);\n }\n\n private function getReportMediaRouteResource(AutomatedReportResult $result): string\n {\n if ($result->getMediaType() === self::MEDIA_TYPE_PDF) {\n return self::PDF_KEY;\n } elseif ($result->getMediaType() === self::MEDIA_TYPE_PODCAST) {\n return self::AUDIO_KEY;\n }\n\n throw new \\InvalidArgumentException('Unknown media type.');\n }\n\n public function getMediaPath(AutomatedReportResult $result): ?string\n {\n $url = match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => $result->getPdfUrl(),\n self::MEDIA_TYPE_PODCAST => $result->getPodcastAudioUrl(),\n default => null,\n };\n\n if ($url === null) {\n return null;\n }\n\n $path = parse_url(trim($url, '\"\\''), PHP_URL_PATH);\n\n return $path ?: null;\n }\n\n public function getFilenameSuffix(AutomatedReportResult $result): ?string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => 'Podcast',\n default => null,\n };\n }\n\n public function getMailSubjectSuffix(AutomatedReportResult $result): string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => 'report',\n self::MEDIA_TYPE_PODCAST => 'podcast',\n default => '',\n };\n }\n\n public function getMediaTypeMetadata(AutomatedReportResult $result): array\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => ['extension' => 'mp3', 'mime' => 'audio/mpeg'],\n self::MEDIA_TYPE_PDF => ['extension' => 'pdf', 'mime' => 'application/pdf'],\n default => ['extension' => null, 'mime' => null],\n };\n }\n\n public function deleteS3Files(AutomatedReportResult $result): void\n {\n $teamUuid = $result->getReport()->getTeam()->getUuid();\n $reportUuid = $result->getUuid();\n\n // delete all files for a report uuid no mather of pdf, podcast, or both\n // in case of both - the podcast files are linked to the pdf (parent) uuid\n // pdf and podcast date times should be close\n $path = sprintf('%s/%s/%s', $teamUuid, self::S3_DIR, $reportUuid);\n\n foreach (self::FILE_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted S3 file', [\n 'path' => $file,\n ]);\n }\n }\n\n foreach (self::FILE_PODCAST_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '_podcast.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted Podcast S3 file', [\n 'path' => $file,\n ]);\n }\n }\n }\n\n /**\n *\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): Collection\n {\n return $this->automatedReportsRepository->getTeamIdsWithReportsResults($teamId);\n }\n\n /**\n * Core delete logic for report results using a query\n *\n * @param Builder $query\n * @param array $logContext\n *\n * @return int\n */\n private function deleteReportResultsByQuery(Builder $query, array $logContext = []): int\n {\n $deletedCount = 0;\n\n if ($query->exists()) {\n Log::info(\n 'Run delete report results',\n array_merge(\n $logContext,\n [\n 'service' => 'AutomatedReportsService',\n ]\n )\n );\n\n $query->chunkById(50, function ($results) use (&$deletedCount, $logContext) {\n foreach ($results as $result) {\n $this->deleteReportResult($result);\n $deletedCount++;\n\n Log::info(\n 'Deleted a report result',\n array_merge(\n $logContext,\n [\n 'result_id' => $result->getId(),\n 'report_id' => $result->getReportId(),\n ]\n )\n );\n }\n });\n }\n\n return $deletedCount;\n }\n\n /**\n * Delete report results for a team by retention period\n *\n * @param Team $team\n * @param CarbonImmutable $retentionDate\n *\n * @return int Number of deleted report results\n */\n public function deleteReportsResultsInRetentionPeriod(Team $team, CarbonImmutable $retentionDate): int\n {\n $reportIds = $this->automatedReportsRepository->getReportIdsByTeam($team);\n\n if ($reportIds->isEmpty()) {\n return 0;\n }\n\n $query = $this->automatedReportsRepository\n ->getReportResultsQueryForRetention($team, $retentionDate);\n\n return $this->deleteReportResultsByQuery($query, [\n 'team_id' => $team->getId(),\n 'retention_date' => $retentionDate->toDateTimeString(),\n ]);\n }\n\n /**\n * Delete ALL report results for a specific automated report\n *\n * @param string $uuid\n *\n * @return int\n */\n public function deleteReportResults(string $uuid): int\n {\n $report = $this->getReport($uuid);\n\n $query = $this->automatedReportsRepository->getResultsByReportQuery($report);\n\n return $this->deleteReportResultsByQuery($query, [\n 'report_uuid' => $uuid,\n 'report_id' => $report->getId(),\n ]);\n }\n\n public function deleteReportResult(AutomatedReportResult $result): void\n {\n $this->deleteS3Files($result);\n\n $result->delete();\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getTeamReports(Team $team): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getReportsByTeam($team);\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getReportResults(AutomatedReport $report): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getResultsByReport($report);\n }\n\n public function deleteAllReportResults(AutomatedReport $report): void\n {\n $results = $this->getReportResults($report);\n\n /** @var AutomatedReportResult $result */\n foreach ($results as $result) {\n Log::info('Deleting result', [\n 'report' => $report->getId(),\n 'result' => $result->getId(),\n ]);\n\n $this->deleteReportResult($result);\n }\n }\n\n public function deleteAllData(Team $team): void\n {\n Log::info('Deleting automated report and results for team', [\n 'team' => $team->getId(),\n ]);\n\n $reports = $this->getTeamReports($team);\n\n /** @var AutomatedReport $report */\n foreach ($reports as $report) {\n Log::info('Deleting report', [\n 'team' => $team->getId(),\n 'report' => $report->getId(),\n ]);\n\n $this->deleteAllReportResults($report);\n\n $report->delete();\n }\n }\n}","depth":4,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Kiosk\\AutomatedReports;\n\nuse Carbon\\CarbonImmutable;\nuse Carbon\\CarbonInterface;\nuse Carbon\\Exceptions\\InvalidFormatException;\nuse DateTime;\nuse DateTimeInterface;\nuse DateTimeZone;\nuse Illuminate\\Contracts\\Bus\\Dispatcher as BusDispatcher;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Support\\Facades\\Log;\nuse Illuminate\\Support\\Facades\\Storage;\nuse Jiminny\\Component\\ActivitySearch\\FilterDefinition\\InputTypeEnum;\nuse Jiminny\\Component\\AskAnything\\AskAnythingPromptService;\nuse Jiminny\\Component\\AskAnything\\Dtos\\AskAnythingPromptDto;\nuse Jiminny\\Component\\UrlGenerator\\Webhook;\nuse Jiminny\\Contracts\\Repositories\\PlaybookCategoryRepository;\nuse Jiminny\\Contracts\\Repositories\\TeamRepository;\nuse Jiminny\\Contracts\\Repositories\\UserRepository;\nuse Jiminny\\Exceptions\\ApplicationException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Exceptions\\ModelNotFoundException;\nuse Jiminny\\Jobs\\AutomatedReports\\RequestGenerateReportJob;\nuse Jiminny\\Models\\Activity\\Search;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPrompt;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPromptTarget;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Contracts\\UserContract;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Repositories\\AskAnythingRepository;\nuse Jiminny\\Repositories\\AutomatedReportsRepository;\nuse Jiminny\\Repositories\\GroupRepository;\nuse Jiminny\\Repositories\\SearchRepository;\nuse Jiminny\\Repositories\\StageRepository;\nuse Throwable;\n\nclass AutomatedReportsService\n{\n public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';\n public const string TYPE_ASK_JIMINNY = 'ask_jiminny';\n\n /**\n * Standard report types (used by kiosk for existing automated reports).\n */\n // @TODO this will add filter, however if we need to control feature by FF we need conditional logic\n public const array TYPES = [\n ['id' => 'exec_summary', 'name' => 'Exec Summary'],\n ['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],\n ['id' => 'product_feedback', 'name' => 'Product Feedback'],\n ['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],\n// ['id' => 'questions', 'name' => 'Questions'],\n// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],\n ];\n\n public const array ALL_TYPES = [\n ...self::TYPES,\n ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],\n ];\n\n public const string FREQUENCY_DAILY = 'daily';\n public const string FREQUENCY_WEEKLY = 'weekly';\n public const string FREQUENCY_MONTHLY = 'monthly';\n public const string FREQUENCY_QUARTERLY = 'quarterly';\n public const string FREQUENCY_ONE_OFF = 'one_off';\n\n /**\n * Frequencies for standard (non-Ask Jiminny) reports.\n */\n public const array FREQUENCIES = [\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n\n /**\n * Frequencies for Ask Jiminny reports.\n */\n public const array ASK_JIMINNY_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ];\n\n public const string MEDIA_TYPE_PDF = 'pdf';\n public const string MEDIA_TYPE_PODCAST = 'podcast';\n public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];\n public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];\n public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];\n public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];\n\n public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];\n public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];\n public const int SENT_REPORT_AT_HOURS = 5;\n public const string PDF_KEY = 'pdf';\n public const string AUDIO_KEY = 'audio';\n\n private const array ALL_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n private const string S3_DIR = 'reports';\n private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];\n private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];\n\n public function __construct(\n private readonly TeamRepository $teamRepository,\n private readonly GroupRepository $groupRepository,\n private readonly UserRepository $userRepository,\n private readonly StageRepository $stageRepository,\n private readonly DealStagesService $dealStagesService,\n private readonly RecipientsService $recipientsService,\n private readonly AutomatedReportsRepository $automatedReportsRepository,\n private readonly Webhook $webhookService,\n private readonly BusDispatcher $dispatcher,\n private readonly ActivityTypeService $activityTypeService,\n private readonly PlaybookCategoryRepository $playbookCategoryRepository,\n private readonly AskAnythingPromptService $askAnythingPromptService,\n private readonly SearchRepository $activitySearchRepository,\n private readonly AskAnythingRepository $askAnythingRepository,\n ) {\n }\n\n public static function getTypes(): array\n {\n $types = self::TYPES;\n\n return array_map(static function ($type) {\n return $type['id'];\n }, $types);\n }\n\n public static function getCallTypes(): array\n {\n return array_map(static function ($callType) {\n return $callType['id'];\n }, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);\n }\n\n public static function getFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::FREQUENCIES);\n }\n\n // front-facing structure\n public function getReportEnabledFieldData(bool $value = false): array\n {\n return [\n 'id' => 'report_enabled',\n 'label' => '',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'value' => $value,\n ];\n }\n\n // Organizations = Teams\n public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array\n {\n $options = $this->getTeams();\n\n if ($shortVersion) {\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value,\n 'dependencies' => [\n 'teams',\n 'deal_stage_at_call',\n 'current_deal_stage',\n 'recipients',\n ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,\n ],\n 'dependsOn' => [],\n ];\n }\n\n // Teams = Groups\n public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array\n {\n if ($shortVersion) {\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value, // value should be an array of objects {id, name}\n 'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],\n 'dependsOn' => [],\n ];\n }\n\n public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array\n {\n $types = [];\n if ($team instanceof Team) {\n if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n $types = self::TYPES;\n }\n if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {\n $types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];\n }\n } else {\n $types = self::TYPES;\n }\n\n if ($shortVersion) {\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'options' => $types,\n ];\n }\n\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $types,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getFrequencyFieldData(?string $value = null): array\n {\n return [\n 'id' => 'frequency',\n 'label' => 'Frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::FREQUENCIES,\n 'value' => $value,\n 'dependencies' => ['period'],\n 'dependsOn' => [],\n ];\n }\n\n public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array\n {\n return [\n 'id' => 'period',\n 'label' => 'Select one-off period',\n 'inputType' => InputTypeEnum::DATE_RANGE,\n 'required' => true,\n 'placeholder' => 'Select',\n 'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],\n 'queryParams' => [\n 'startDate' => 'start_date_period',\n 'endDate' => 'end_date_period',\n ],\n 'dependencies' => [],\n 'dependsOn' => ['frequency'],\n ];\n }\n\n public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array\n {\n return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);\n }\n\n public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);\n }\n\n public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);\n }\n\n public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'deal_value',\n 'label' => 'Deal Value',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_deal_value',\n 'max' => 'max_deal_value',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array\n {\n $value = [];\n $conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;\n $dialerOn && $value[] = self::CALL_TYPE_DIALER;\n\n return [\n 'id' => 'call_type',\n 'label' => 'Call Type',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => [\n self::CALL_TYPE_CONFERENCE,\n self::CALL_TYPE_DIALER,\n ],\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getMediaTypeFieldData(?AutomatedReport $report = null): array\n {\n $value = [];\n\n if ($report) {\n $value = $this->transformMediaTypes($report);\n }\n\n return [\n 'id' => 'media_types',\n 'label' => 'Export as',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => self::MEDIA_TYPE_OBJECTS,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'call_duration',\n 'label' => 'Call Duration',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_call_duration',\n 'max' => 'max_call_duration',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getRecipientsFieldData(?Team $team = null, array $value = []): array\n {\n return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);\n }\n\n public function getJiminnyRecipientsFieldData(array $value = []): array\n {\n return $this->recipientsService->getJiminnyRecipientsFieldData($value);\n }\n\n public function getAdditionalPromptInputFieldData(?string $value = null): array\n {\n return [\n 'id' => 'additional_prompt_input',\n 'label' => 'Special requirements',\n 'inputType' => InputTypeEnum::TEXTAREA,\n 'required' => false,\n 'placeholder' => 'What should be the focus of the report?',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCustomReportNameFieldData(?string $value = null): array\n {\n return [\n 'id' => 'custom_name',\n 'label' => 'Custom report name',\n 'inputType' => InputTypeEnum::TEXT,\n 'required' => false,\n 'placeholder' => 'Enter custom name',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n // data providers\n public function getTeams(): array\n {\n $teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);\n\n $teamData = [];\n foreach ($teams as $team) {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n continue;\n }\n\n $teamData[] = $this->transformTeam($team);\n }\n\n return $teamData;\n }\n\n public function getTeamGroups(string $teamUuid): array\n {\n $data = [];\n $team = $this->getTeam($teamUuid);\n\n if ($team !== null) {\n $groups = $team->groups()->get();\n\n foreach ($groups as $group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n public function getTeamsGroupsOptions(array $filterTeamUuids = []): array\n {\n $data = [];\n $teams = $this->getTeams();\n\n foreach ($teams as $team) {\n if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {\n continue;\n }\n\n $data[] = [\n 'label' => $team['name'],\n 'groups' => $this->getTeamGroups($team['id']),\n ];\n }\n\n return $data;\n }\n\n public function getTeam(string $teamUuid): ?Team\n {\n return $this->teamRepository->idOrUuid($teamUuid);\n }\n\n public function getTeamById(int $teamId): ?Team\n {\n return $this->teamRepository->find($teamId);\n }\n\n public function getGroupsUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportGroups = $report->getGroups();\n foreach ($reportGroups as $groupId) {\n if ($group = $this->groupRepository->find($groupId)) {\n $uuids[] = $group->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getPlaybookCategoriesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $playbookCategories = $report->getPlaybookCategories();\n foreach ($playbookCategories as $id) {\n if ($category = $this->playbookCategoryRepository->find($id)) {\n $uuids[] = $category->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getDealAtCallStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getDealAtCallStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getCurrentDealStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getCurrentDealStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getRecipients());\n }\n\n public function getJiminnyUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function extractUserUuids(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => $user->getUuid())\n ->values()\n ->all();\n }\n\n // get mail data\n public function getRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getRecipients());\n }\n\n /**\n * @return array<UserContract>\n */\n public function getRecipientUserObjects(AutomatedReport $report): array\n {\n $userIds = $report->getRecipients()['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->values()\n ->all();\n }\n\n private function getJiminnyRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function buildRecipientUsers(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => [\n 'email' => $user->getEmailAddress(),\n 'name' => $user->getName(),\n 'timezone' => $user->getTimezone()->getName(),\n ])\n ->values()\n ->all();\n }\n\n public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array\n {\n if ($report->isAskJiminnyReport()) {\n $recipients = $this->resolveAskJiminnyRecipients($report);\n } else {\n $recipients = $this->getRecipientUsers($report);\n if ($includeJiminny) {\n $recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));\n }\n }\n\n $emails = [];\n\n return array_values(array_filter(\n $recipients,\n static function ($recipient) use (&$emails) {\n if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {\n return false;\n }\n $emails[] = $recipient['email'];\n\n return true;\n }\n ));\n }\n\n private function resolveAskJiminnyRecipients(AutomatedReport $report): array\n {\n $recipients = [];\n\n $creator = $report->getCreator();\n if ($creator !== null) {\n $recipients[] = [\n 'email' => $creator->getEmailAddress(),\n 'name' => $creator->getName(),\n 'timezone' => $creator->getTimezone()->getName(),\n ];\n }\n\n return array_merge(\n $recipients,\n $this->buildRecipientUsers($report->getRecipients()),\n $this->getGroupRecipientUsers($report),\n );\n }\n\n private function getGroupRecipientUsers(AutomatedReport $report): array\n {\n $users = [];\n foreach ($report->getGroups() as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group === null) {\n continue;\n }\n foreach ($group->getMembers() as $member) {\n $users[] = [\n 'email' => $member->getEmailAddress(),\n 'name' => $member->getName(),\n 'timezone' => $member->getTimezone()->getName(),\n ];\n }\n }\n\n return $users;\n }\n\n public function getReportTypeName(AutomatedReportResult $report): string\n {\n $type = $report->getReport()->getType();\n\n $getType = $this->transformReportType($type);\n\n return $getType['name'];\n }\n\n public function getReportPeriodName(AutomatedReportResult $report): string\n {\n $from = $report->getFromDate();\n $to = $report->getToDate();\n $frequency = $report->getReport()->getFrequency();\n\n if ($from === null || $to === null) {\n if (! $report->getReport()->isAskJiminnyReport()) {\n $invalidPeriod = $from === null ? 'from' : 'to';\n\n throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);\n }\n\n $period = $this->calculateFromAndToDatePeriod($frequency);\n $from = $period['fromDate'];\n $to = $period['toDate'];\n }\n\n return $this->formatReportPeriodName($frequency, $from, $to);\n }\n\n private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string\n {\n $fromYear = $from->format('Y');\n $toYear = $to->format('Y');\n $differentYears = $fromYear !== $toYear;\n\n switch ($frequency) {\n case self::FREQUENCY_DAILY:\n return $from->format('j M Y');\n\n case self::FREQUENCY_QUARTERLY:\n // 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ\n $startMonth = $from->format('M');\n $endMonth = $to->copy()->subMonth();\n $endMonthName = $endMonth->format('M');\n $endMonthYear = $endMonth->format('Y');\n\n if ($differentYears) {\n return \"{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}\";\n }\n\n return \"{$startMonth} - {$endMonthName} {$toYear}\";\n\n case self::FREQUENCY_MONTHLY:\n // 'May 2025' - monthly reports are always within the same year\n return $from->format('M Y');\n\n case self::FREQUENCY_WEEKLY:\n // '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ\n $startDay = $from->format('j');\n $endDay = $to->format('j');\n $startMonth = $from->format('M');\n $endMonth = $to->format('M');\n\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n if ($startMonth !== $endMonth) {\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n return \"{$startDay} - {$endDay} {$endMonth} {$toYear}\";\n\n case self::FREQUENCY_ONE_OFF:\n // '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ\n $startDay = $from->format('j');\n $startMonth = $from->format('M');\n $endDay = $to->format('j');\n $endMonth = $to->format('M');\n\n // If same month and year, use a format like '2-31 May 2025'\n if ($startMonth === $endMonth && ! $differentYears) {\n return \"{$startDay} - {$endDay} {$startMonth} {$toYear}\";\n }\n\n // If different years, include both years\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n // Same year but different months\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n\n default:\n // Default format for unknown frequencies\n return $from->format('j M Y') . ' - ' . $to->format('j M Y');\n }\n }\n\n public function getReportTeamsName(AutomatedReportResult $report): string\n {\n $groups = $report->getGroups();\n\n if (empty($groups)) {\n return 'All';\n }\n\n // Get group names from repository\n $groupNames = [];\n foreach ($groups as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group) {\n $groupNames[] = $group->getName();\n }\n }\n\n if (count($groupNames) === 1) {\n // Single team format\n $teamsName = $groupNames[0];\n } else {\n // Multiple teams format\n $teamsName = implode(', ', $groupNames);\n }\n\n return $teamsName;\n }\n\n public function getReportFileName(AutomatedReportResult $report): string\n {\n $customName = $report->getReport()->getCustomName();\n $periodName = $this->getReportPeriodName($report);\n $filenameSuffix = $this->getFilenameSuffix($report);\n\n if ($customName) {\n if ($filenameSuffix) {\n $customName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$customName} - {$periodName}\");\n }\n\n $baseName = $this->getReportTypeName($report);\n\n if ($filenameSuffix) {\n $baseName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}\");\n }\n\n public function getReportFileNameWithExtension(AutomatedReportResult $result): string\n {\n $extension = $this->getMediaTypeMetadata($result)['extension'];\n\n return $this->getReportFileName($result) . '.' . $extension;\n }\n\n public function sanitizeFileName(string $fileName): string\n {\n return str_replace(['/', '\\\\'], '-', $fileName);\n }\n\n public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool\n {\n $recipients = array_map('intval', $report->getRecipients()['users'] ?? []);\n\n return in_array($user->getId(), $recipients);\n }\n\n public function transformReportResults(Collection $automatedReportResults): array\n {\n $data = [];\n foreach ($automatedReportResults as $automatedReportResult) {\n /** @var AutomatedReportResult $automatedReportResult */\n\n $report = $automatedReportResult->getReport();\n\n $createdBy = $report->getCreator();\n $creator = [\n 'id' => $createdBy?->getUuid(),\n 'name' => $createdBy?->getName(),\n 'email' => $createdBy?->getEmailAddress(),\n 'photoUrl' => $createdBy?->getPhotoUrl(),\n ];\n\n $data[] = [\n 'id' => $automatedReportResult->getUuid(),\n 'name' => $automatedReportResult->getName(),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n 'recipients' => $this->buildRecipients($report),\n 'report_type' => $this->transformReportType($report->getType()),\n 'media_type' => $automatedReportResult->getMediaType(),\n 'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),\n 'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),\n 'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),\n 'creator' => $creator,\n ];\n }\n\n return $data;\n }\n\n private function buildRecipients(AutomatedReport $report): array\n {\n $creatorUuid = $report->getCreator()?->getUuid();\n\n $recipients = array_values(array_filter(\n $this->transformRecipients($report->getRecipients()),\n static fn (array $recipient): bool => $recipient['id'] !== $creatorUuid,\n ));\n\n if (! $report->isAskJiminnyReport()) {\n return $recipients;\n }\n\n return [\n ...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),\n ...$recipients,\n ];\n }\n\n public function hasCallTypeConference(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);\n }\n\n public function hasCallTypeDialer(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);\n }\n\n // transformers\n private function transformTeam(Team $team): array\n {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n return [];\n }\n\n return [\n 'id' => $team->getUuid(),\n 'name' => $team->getName(),\n ];\n }\n\n private function transformReportFullView(AutomatedReport $report): array\n {\n $base = $this->transformReportBase($report);\n\n return $report->getType() === self::TYPE_ASK_JIMINNY\n ? $base + $this->transformAskJiminnyFields($report)\n : $base + $this->transformStandardReportFields($report);\n }\n\n private function transformReportBase(AutomatedReport $report): array\n {\n return [\n 'id' => $report->getUuid(),\n 'organization' => $this->transformOrganization(team: $report->getTeam()),\n 'report_type' => $this->transformReportType($report->getType()),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n ];\n }\n\n private function transformStandardReportFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n\n return [\n 'report_enabled' => $report->getStatus(),\n 'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),\n 'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),\n 'deal_value_min' => $report->getDealValueMin(),\n 'deal_value_max' => $report->getDealValueMax(),\n 'call_types' => $this->transformCallType($report->getCallTypes()),\n 'media_types' => $this->transformMediaTypes($report),\n 'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),\n 'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),\n 'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),\n 'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),\n 'recipients' => $this->transformRecipients($report->getRecipients()),\n 'created_by' => $this->transformCreator($report->getCreator()),\n 'additional_prompt_input' => $report->getAdditionalPromptInput(),\n 'custom_name' => $report->getCustomName(),\n 'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),\n 'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),\n 'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),\n ];\n }\n\n private function transformAskJiminnyFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n $creatorId = $report->getAttribute('created_by');\n $explicitUserIds = array_values(array_filter(\n $report->getRecipients()['users'] ?? [],\n static fn ($id) => $id !== $creatorId\n ));\n\n return [\n 'report_name' => $report->getCustomName(),\n 'enabled' => $report->getStatus(),\n 'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),\n 'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),\n 'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),\n 'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),\n ];\n }\n\n private function transformOrganization(?Team $team): array\n {\n return [\n 'id' => $team?->getUuid(),\n 'name' => $team?->getName(),\n ];\n }\n\n private function transformReportType(string $type): array\n {\n foreach (self::ALL_TYPES as $typeItem) {\n if ($typeItem['id'] === $type) {\n return $typeItem;\n }\n }\n\n return [];\n }\n\n private function transformCallType(array $types): array\n {\n $result = [];\n $callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];\n\n foreach ($types as $type) {\n foreach ($callTypes as $callTypeItem) {\n if ($callTypeItem['id'] === $type) {\n $result[] = $callTypeItem;\n\n break;\n }\n }\n }\n\n return $result;\n }\n\n private function transformMediaTypes(AutomatedReport $report): array\n {\n $values = [];\n\n foreach ($report->getMediaTypes() as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n continue;\n }\n\n $values[] = match ($mediaType) {\n self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,\n self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,\n };\n }\n\n return $values;\n }\n\n private function transformFrequency(string $frequency): array\n {\n foreach (self::ALL_FREQUENCIES as $frequencyItem) {\n if ($frequencyItem['id'] === $frequency) {\n return $frequencyItem;\n }\n }\n\n return [];\n }\n\n public function transformDurationToMinutes(?int $duration): ?int\n {\n if (! $duration) {\n return null;\n }\n\n return (int) ($duration / 60);\n }\n\n private function transformGroups(?Team $team, array $groupsIds): array\n {\n if (empty($groupsIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($groupsIds as $groupId) {\n $group = $team->groups()->where('id', $groupId)->first();\n\n if ($group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n 'photoUrl' => $group->getPhotoUrl(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformStages(?Team $team, array $stagesIds): array\n {\n if (empty($stagesIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($stagesIds as $stageId) {\n $stage = $team->stages()->where('id', $stageId)->first();\n\n if ($stage) {\n $data[] = [\n 'id' => $stage->getUuid(),\n 'name' => $stage->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformRecipients(array $recipients): array\n {\n $users = [];\n foreach ($recipients['users'] ?? [] as $userId) {\n $users[] = $this->transformUser($userId);\n }\n\n return $users;\n }\n\n private function transformCreator(?User $user): ?array\n {\n if ($user === null) {\n return null;\n }\n\n return $this->transformUser($user->getId());\n }\n\n private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array\n {\n if ($prompt === null) {\n return null;\n }\n\n return [\n 'id' => $prompt->getUuid(),\n 'name' => $prompt->getTitle(),\n ];\n }\n\n private function transformSafeSearch(?Search $search): ?array\n {\n if ($search === null) {\n return null;\n }\n\n return [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ];\n }\n\n private function transformUser(int $userId): array\n {\n /* @var ?User $user */\n $user = $this->userRepository->find($userId);\n\n return [\n 'id' => $user?->getUuid(),\n 'name' => $user?->getName(),\n 'email' => $user?->getEmailAddress(),\n 'photoUrl' => $user?->getPhotoUrl(),\n ];\n }\n\n public function create(array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $validatedData['created_by'] = auth()->id();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function update(string $uuid, array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $report = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $report) {\n throw new InvalidArgumentException('Report not found');\n }\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Create an Ask Jiminny report.\n */\n public function createAskJiminnyReport(array $data, User $creator): array\n {\n $validatedData = $this->validateAskJiminnyReportData($data, $creator);\n $validatedData['created_by'] = $creator->getId();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Update an Ask Jiminny report.\n */\n public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array\n {\n if (! $report->isAskJiminnyReport()) {\n throw new InvalidArgumentException('Report is not an Ask Jiminny report');\n }\n\n $validatedData = $this->validateAskJiminnyReportData($data, $user);\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array\n {\n $this->automatedReportsRepository->update($report, ['status' => $status]);\n\n return $this->transformReportFullView($report->fresh());\n }\n\n /**\n * Validate and transform data for Ask Jiminny reports.\n */\n private function validateAskJiminnyReportData(array $data, User $user): array\n {\n // Validate name\n $name = trim($data['report_name'] ?? '');\n if (empty($name)) {\n throw new InvalidArgumentException('Report name is required');\n }\n if (mb_strlen($name) > 50) {\n throw new InvalidArgumentException('Report name must be 50 characters or less');\n }\n\n // Validate frequency (only daily, weekly, monthly for Ask Jiminny)\n $frequency = $data['frequency'] ?? null;\n $askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];\n if (! in_array($frequency, $askJiminnyFrequencies, true)) {\n throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');\n }\n\n // Validate expiration date\n $expiresAt = $data['expires_on'] ?? null;\n if (empty($expiresAt)) {\n throw new InvalidArgumentException('Expiration date is required');\n }\n\n try {\n $expiresAtDate = Carbon::parse($expiresAt);\n } catch (InvalidFormatException $e) {\n throw new InvalidArgumentException('Expiration date format is invalid');\n }\n $maxExpiration = Carbon::now()->addYear()->endOfDay();\n if ($expiresAtDate->gt($maxExpiration)) {\n throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');\n }\n if ($expiresAtDate->isPast()) {\n throw new InvalidArgumentException('Expiration date cannot be in the past');\n }\n\n // Validate saved search\n $activitySearchId = $data['saved_search'] ?? null;\n if (empty($activitySearchId)) {\n throw new InvalidArgumentException('Saved search is required');\n }\n $savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);\n if (! $savedSearch) {\n throw new InvalidArgumentException('Saved search not found or does not belong to you');\n }\n\n // Validate saved prompt\n $askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;\n if (empty($askAnythingPromptId)) {\n throw new InvalidArgumentException('Ask Jiminny prompt is required');\n }\n $prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);\n if (! $prompt) {\n throw new InvalidArgumentException('Ask Jiminny prompt not found');\n }\n\n // Validate status\n $status = $data['enabled'] ?? false;\n\n $recipientUserIds = [$user->getId()];\n\n if (! empty($data['share_users'])) {\n $sharedUserIds = $this->validateAndGetUserIdsByTeam(\n $user->team,\n (array) $data['share_users']\n );\n $recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);\n }\n\n $sharedGroupIds = [];\n if (! empty($data['share_teams'])) {\n $sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);\n }\n\n $recipientUserIds = array_values(array_unique($recipientUserIds));\n\n return [\n 'team_id' => $user->getTeamId(),\n 'type' => self::TYPE_ASK_JIMINNY,\n 'status' => (bool) $status,\n 'frequency' => $frequency,\n 'custom_name' => $name,\n 'activity_search_id' => $savedSearch->getId(),\n 'ask_anything_prompt_id' => $prompt->getId(),\n 'expires_at' => $expiresAtDate->toDateString(),\n 'media_types' => [self::MEDIA_TYPE_PDF],\n 'call_types' => [],\n 'recipients' => ['users' => $recipientUserIds],\n 'groups' => $sharedGroupIds,\n ];\n }\n\n public static function getAskJiminnyFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::ASK_JIMINNY_FREQUENCIES);\n }\n\n public function getAskJiminnyReportFilters(User $user): array\n {\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n return [\n [\n 'id' => 'prompt',\n 'label' => 'Prompt',\n 'options' => $prompts,\n ],\n [\n 'id' => 'saved_search',\n 'label' => 'Saved Search',\n 'options' => $savedSearches,\n ],\n ];\n }\n\n public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array\n {\n $team = $user->getTeam();\n $userTimezone = $user->getTimezone();\n\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n $teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ])->values()->all();\n\n $shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];\n\n $sharedTeamsValue = [];\n $sharedUsersValue = [];\n if ($report) {\n $sharedTeamsValue = $this->transformGroups($team, $report->getGroups());\n\n $recipientUserIds = $report->getRecipients()['users'] ?? [];\n $creatorId = $report->getAttribute('created_by');\n $sharedUserIds = array_values(array_filter(\n $recipientUserIds,\n static fn ($id) => $id !== $creatorId\n ));\n $sharedUsersValue = collect($sharedUserIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (User $u) => [\n 'id' => $u->getUuid(),\n 'name' => $u->getName(),\n ])\n ->values()\n ->all();\n }\n\n return [\n 'fields' => [\n [\n 'id' => 'enabled',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'label' => '',\n 'value' => $report?->getStatus() ?? false,\n ],\n [\n 'id' => 'report_name',\n 'inputType' => InputTypeEnum::TEXT,\n 'label' => 'Name',\n 'placeholder' => 'Enter name',\n 'required' => true,\n 'validation' => ['maxLength' => 50],\n 'value' => $report?->getCustomName() ?? '',\n ],\n [\n 'id' => 'frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Frequency',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::ASK_JIMINNY_FREQUENCIES,\n 'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,\n ],\n [\n 'id' => 'expires_on',\n 'inputType' => InputTypeEnum::DATE,\n 'label' => 'Expires on',\n 'required' => true,\n 'placeholder' => 'Select',\n 'validation' => [\n 'minDate' => now($userTimezone)->toDateString(),\n 'maxDate' => now($userTimezone)->addYear()->toDateString(),\n ],\n 'value' => $report?->getExpiresAt()?->toDateString(),\n ],\n [\n 'id' => 'share_teams',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team',\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $teamGroups,\n 'value' => $sharedTeamsValue,\n ],\n [\n 'id' => 'share_users',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team member',\n 'required' => false,\n 'placeholder' => 'Select',\n 'groupLabelKey' => 'label',\n 'groupValuesKey' => 'users',\n 'optionLabelKey' => 'name',\n 'optionValueKey' => 'id',\n 'options' => $shareUsers,\n 'value' => $sharedUsersValue,\n ],\n [\n 'id' => 'saved_search',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Saved search',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $savedSearches,\n 'value' => $report && $report->getSavedSearch() ? [\n 'id' => $report->getSavedSearch()->getUuid(),\n 'name' => $report->getSavedSearch()->getName(),\n ] : null,\n ],\n [\n 'id' => 'ask_jiminny_prompt',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Ask Jiminny prompt',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $prompts,\n 'value' => $report && $report->getAskAnythingPrompt() ? [\n 'id' => $report->getAskAnythingPrompt()->getUuid(),\n 'name' => $report->getAskAnythingPrompt()->getTitle(),\n ] : null,\n ],\n ],\n ];\n }\n\n private function updateResultNames(AutomatedReport $automatedReport): void\n {\n $results = $this->automatedReportsRepository->getResultsByReport($automatedReport);\n\n foreach ($results as $result) {\n $result->update(['name' => $this->getReportFileName($result)]);\n }\n }\n\n public function updateStatus(string $uuid, array $data): array\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $automatedReport->update([\n 'status' => $status,\n ]);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n private function generateOneOffReport(AutomatedReport $automatedReport): void\n {\n // the scheduler handles all the other frequency types\n if ($automatedReport->getStatus() === false || $automatedReport->getFrequency() !== self::FREQUENCY_ONE_OFF) {\n return;\n }\n\n $this->dispatcher->dispatch(new RequestGenerateReportJob($automatedReport->getUuid()));\n }\n\n public function getReport(string $uuid): AutomatedReport\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n return $automatedReport;\n }\n\n public function get(string $uuid): array\n {\n $automatedReport = $this->getReport($uuid);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function list(string $sortColumn = 'created_at', string $sortDirection = 'desc'): array\n {\n $results = [];\n $collection = $this->automatedReportsRepository->getAllStandardReports($sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function listAskJiminnyReports(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): array {\n $results = [];\n $collection = $this->automatedReportsRepository->getAskJiminnyReportsByUser($user, $sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function delete(string $uuid): void\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $automatedReport->delete();\n }\n\n public function createReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n return $this->automatedReportsRepository->createResult(\n array_merge(\n [\n 'report_id' => $automatedReport->getId(),\n 'status' => AutomatedReportResult::STATUS_DEFAULT,\n ],\n $data\n )\n );\n }\n\n public function getOrCreateReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n $existing = $this->automatedReportsRepository->findLatestDefaultOrFailedResult($automatedReport);\n\n if ($existing !== null) {\n $existing->update(['status' => AutomatedReportResult::STATUS_DEFAULT]);\n\n return $existing;\n }\n\n return $this->createReportResult($automatedReport, $data);\n }\n\n public function getReportResult(string $resultUuid): AutomatedReportResult\n {\n $report = $this->automatedReportsRepository->findResultByUuid($resultUuid);\n\n if (! $report) {\n throw new ModelNotFoundException('Report Result not found');\n }\n\n return $report;\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return $this->automatedReportsRepository->findChildResult($result, $type);\n }\n\n // prophet API calls\n /**\n * @throws ApplicationException\n */\n public function getGenerateReportPayload(AutomatedReport $automatedReport, string $reportResultUuid): array\n {\n $period = $this->calculateFromAndToDate($automatedReport);\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n return [\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResultUuid,\n 'report_type' => $automatedReport->getType(),\n 'media_types' => $automatedReport->getMediaTypes(),\n 'from_date' => $fromDate->startOfDay()->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->endOfDay()->format(DateTimeInterface::RFC3339),\n 'group_ids' => $automatedReport->getGroups(),\n 'call_deal_stage' => $automatedReport->getDealAtCallStages(),\n 'current_deal_stage' => $automatedReport->getCurrentDealStages(),\n 'deal_min_value' => $automatedReport->getDealValueMin(),\n 'deal_max_value' => $automatedReport->getDealValueMax(),\n 'call_types' => $automatedReport->getCallTypes(),\n 'call_duration_min_seconds' => $automatedReport->getCallDurationMin(),\n 'call_duration_max_seconds' => $automatedReport->getCallDurationMax(),\n 'special_requirements' => $automatedReport->getAdditionalPromptInput(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->formatReportPeriodName(\n $automatedReport->getFrequency(),\n $fromDate,\n $toDate,\n ),\n 'playbook_categories' => $automatedReport->getPlaybookCategories(),\n 'custom_name' => $automatedReport->getCustomName(),\n ];\n }\n\n // $inputPayload - FE payload structure\n public function getActivitiesCountPayload(array $inputPayload): array\n {\n // Use validateAndTransformData to validate and normalize input\n $validatedData = $this->validateAndTransformData($inputPayload);\n $period = $this->calculateFromAndToDatePeriod(\n $validatedData['frequency'],\n Carbon::parse($validatedData['from']),\n Carbon::parse($validatedData['to']),\n );\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n // Create payload similar to getGenerateReportPayload\n return [\n 'team_id' => $validatedData['team_id'],\n 'group_ids' => $validatedData['groups'] ?? [],\n 'report_type' => $validatedData['type'],\n 'from_date' => $fromDate->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->format(DateTimeInterface::RFC3339),\n 'call_deal_stage' => $validatedData['deal_at_call_stages'] ?? [],\n 'current_deal_stage' => $validatedData['current_deal_stages'] ?? [],\n 'deal_min_value' => $validatedData['deal_value_min'] ?? null,\n 'deal_max_value' => $validatedData['deal_value_max'] ?? null,\n 'call_types' => $validatedData['call_types'],\n 'call_duration_min_seconds' => $validatedData['call_duration_min'] ?? null,\n 'call_duration_max_seconds' => $validatedData['call_duration_max'] ?? null,\n 'special_requirements' => $validatedData['additional_prompt_input'] ?? null,\n 'playbook_categories' => $validatedData['playbook_categories'] ?? [],\n 'request_id' => null,\n 'callback_url' => null,\n ];\n }\n\n public function shouldSendReport(array $users, ?CarbonInterface $generatedAt = null): bool\n {\n if (empty($users)) {\n return false;\n }\n\n $earliestTz = collect($users)\n ->mapWithKeys(function (array $user) {\n $tz = new DateTimeZone($user['timezone']);\n $nowUtc = new DateTime('now', new DateTimeZone('UTC'));\n $offset = $tz->getOffset($nowUtc);\n\n return [$user['timezone'] => $offset];\n })\n ->sortDesc()\n ->keys()\n ->first();\n\n $now = Carbon::now($earliestTz);\n $isScheduledTime = (int) $now->format('H') === self::SENT_REPORT_AT_HOURS;\n\n if ($isScheduledTime) {\n return true;\n }\n\n return $this->hasPassedScheduledTime($generatedAt, $earliestTz);\n }\n\n public function hasPassedScheduledTime(?CarbonInterface $generatedAt, string $timezone): bool\n {\n if ($generatedAt === null) {\n return false;\n }\n\n $now = Carbon::now($timezone);\n $scheduledTime = $now->copy()->setTime(self::SENT_REPORT_AT_HOURS, 0, 0);\n\n if ($now->hour < self::SENT_REPORT_AT_HOURS) {\n $scheduledTime = $scheduledTime->subDay();\n }\n\n $scheduledTimeUtc = $scheduledTime->copy()->utc();\n $generatedAtUtc = $generatedAt->copy()->utc();\n $nowUtc = $now->copy()->utc();\n\n return $generatedAtUtc->lt($scheduledTimeUtc) && $nowUtc->gt($scheduledTimeUtc);\n }\n\n public function calculateFromAndToDatePeriod(\n string $frequency,\n ?Carbon $fromDate = null,\n ?Carbon $toDate = null\n ): array {\n if ($frequency === self::FREQUENCY_ONE_OFF) {\n return [\n 'fromDate' => $fromDate,\n 'toDate' => $toDate,\n ];\n }\n\n $now = Carbon::now();\n\n return match ($frequency) {\n self::FREQUENCY_DAILY => [\n 'fromDate' => $now->copy()->subDay()->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_WEEKLY => [\n 'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_MONTHLY => [\n 'fromDate' => $now->copy()->subMonths(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_QUARTERLY => [\n 'fromDate' => $now->copy()->subMonths(3)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n default => throw new InvalidArgumentException(\"Unsupported frequency: {$frequency}\"),\n };\n }\n\n private function calculateFromAndToDate(AutomatedReport $automatedReport): array\n {\n return $this->calculateFromAndToDatePeriod(\n $automatedReport->getFrequency(),\n $automatedReport->getFrom(),\n $automatedReport->getTo()\n );\n }\n\n public function getAskJiminnyGenerateReportPayload(\n AutomatedReport $automatedReport,\n AutomatedReportResult $reportResult,\n array $activityIds,\n ): array {\n return [\n 'user_question' => $automatedReport->getAskAnythingPrompt()?->getContent(),\n 'call_ids' => array_map('strval', $activityIds),\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResult->getUuid(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->getReportPeriodName($reportResult),\n 'report_name' => $automatedReport->getCustomName(),\n ];\n }\n\n private function getCallbackUrl(): string\n {\n return $this->webhookService->route('jiminny.webhook.reports.ready');\n }\n\n /**\n * Validate and transform payload data for automated reports\n *\n * @param array $data\n *\n * @throws InvalidArgumentException\n *\n * @return array\n */\n private function validateAndTransformData(array $data): array\n {\n // Validate organization (team) and check feature\n $team = $this->validateOrganization($data['organization'] ?? null);\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $type = $this->validateReportType($data['report_type'] ?? null);\n $frequency = $this->validateFrequency($data['frequency'] ?? null);\n $additionalPromptInput = $this->validateAdditionalPromptInput(\n $data['additional_prompt_input'] ?? null\n );\n $customReportName = $this->validateCustomReportName($data['custom_name'] ?? null);\n\n // Prepare data for the database\n $reportData = [\n 'team_id' => $team->getId(),\n 'type' => $type,\n 'status' => $status,\n 'frequency' => $frequency,\n 'additional_prompt_input' => $additionalPromptInput,\n 'custom_name' => $customReportName,\n ];\n\n // Validate deal values\n $reportData = $this->validateDealValues($data, $reportData);\n\n // Validate date range\n $reportData = $this->validateDateRange($data, $reportData, $frequency);\n\n // Validate call durations\n $reportData = $this->validateCallDurations($data, $reportData);\n\n // Validate call types\n $reportData = $this->validateCallTypes($data, $reportData);\n\n // Validate media types\n $reportData = $this->validateMediaTypes($data, $reportData);\n\n // Validate groups\n if (isset($data['teams'])) {\n $reportData['groups'] = $this->validateAndGetGroupIds($team, $data['teams']);\n }\n\n // Validate deal stages\n $reportData = $this->validateDealStages($data, $reportData, $team, $type);\n\n // Validate playbook categories\n $reportData = $this->validatePlaybookCategories($data, $reportData, $team);\n\n // Validate recipients\n $reportData['recipients'] = [\n 'users' => $this->validateAndGetUserIdsByTeam($team, $data['recipients'] ?? []),\n ];\n\n if (isset($data['jiminny_recipients'])) {\n // Validate Jiminny recipients\n $reportData['jiminny_recipients'] = [\n 'users' => $this->validateAndGetJiminnyUserIds((array) $data['jiminny_recipients']),\n ];\n }\n\n return $reportData;\n }\n\n private function validateDealValues(array $data, array $reportData): array\n {\n if (isset($data['min_deal_value'])) {\n $reportData['deal_value_min'] = (int) $data['min_deal_value'];\n\n if ($reportData['deal_value_min'] > 4294967295 || $reportData['deal_value_min'] < 0) {\n throw new InvalidArgumentException('Min deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_deal_value'])) {\n $reportData['deal_value_max'] = (int) $data['max_deal_value'];\n\n if ($reportData['deal_value_max'] > 4294967295 || $reportData['deal_value_max'] < 0) {\n throw new InvalidArgumentException('Max deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['min_deal_value'], $data['max_deal_value'])\n && $data['min_deal_value'] > $data['max_deal_value']\n ) {\n throw new InvalidArgumentException('Min deal value cannot be greater than max deal value');\n }\n\n return $reportData;\n }\n\n private function validateDateRange(array $data, array $reportData, string $frequency): array\n {\n // Set date range only for one_off frequency\n if ($frequency === 'one_off') {\n if (isset($data['start_date_period'])) {\n $reportData['from'] = $this->parseDate($data['start_date_period']);\n }\n\n if (isset($data['end_date_period'])) {\n $reportData['to'] = $this->parseDate($data['end_date_period']);\n }\n\n if (empty($reportData['from']) || empty($reportData['to'])) {\n throw new InvalidArgumentException(\n 'Start date and end date are required for one_off frequency'\n );\n }\n } else {\n $reportData['from'] = null;\n $reportData['to'] = null;\n }\n\n return $reportData;\n }\n\n private function validateCallDurations(array $data, array $reportData): array\n {\n // Convert call durations from minutes to seconds\n if (isset($data['min_call_duration'])) {\n $reportData['call_duration_min'] = (int) $data['min_call_duration'] * 60;\n\n if ($reportData['call_duration_min'] > 4294967295 || $reportData['call_duration_min'] < 0) {\n throw new InvalidArgumentException('Min call duration should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_call_duration'])) {\n $reportData['call_duration_max'] = (int) $data['max_call_duration'] * 60;\n\n if ($reportData['call_duration_max'] > 4294967295 || $reportData['call_duration_max'] < 0) {\n throw new InvalidArgumentException('Max call duration should be between 0 and 4294967295');\n }\n }\n\n return $reportData;\n }\n\n private function validateCallTypes(array $data, array $reportData): array\n {\n // Set call types\n $reportData['call_types'] = $data['call_type'] ?? [];\n if (empty($reportData['call_types'])) {\n $reportData['call_types'] = self::getCallTypes();\n }\n\n foreach ($reportData['call_types'] as $callType) {\n if (! in_array($callType, self::getCallTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Call type %s is invalid', $callType));\n }\n }\n\n return $reportData;\n }\n\n private function validateMediaTypes(array $data, array $reportData): array\n {\n // Set media types from input data\n $reportData['media_types'] = $data['media_types'] ?? [];\n\n if (empty($reportData['media_types'])) {\n throw new InvalidArgumentException('Media types are required');\n }\n\n foreach ($reportData['media_types'] as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n throw new InvalidArgumentException(sprintf('Media type %s is invalid', $mediaType));\n }\n }\n\n return $reportData;\n }\n\n private function validateDealStages(array $data, array $reportData, Team $team, string $reportType): array\n {\n // Validate and set deal stages\n if (isset($data['deal_stage_at_call'])) {\n $reportData['deal_at_call_stages'] =\n $this->validateAndGetDealStageIds($team, $data['deal_stage_at_call'], 'Deal stage at call');\n }\n\n if (isset($data['current_deal_stage'])) {\n $reportData['current_deal_stages'] =\n $this->validateAndGetDealStageIds($team, $data['current_deal_stage'], 'Current deal stage');\n }\n\n // Ensure current_deal_stage is not provided for loss_analysis report type\n if ($reportType === self::TYPE_LOSS_ANALYSIS && ! empty($data['current_deal_stage'])) {\n throw new InvalidArgumentException('Current deal stage is not applicable for Loss Analysis reports');\n }\n\n return $reportData;\n }\n\n // transform uuid to id\n private function validatePlaybookCategories(array $data, array $reportData, Team $team): array\n {\n $key = 'playbook_categories';\n\n if (isset($data[$key])) {\n $payloadIds = $data[$key];\n $ids = [];\n\n foreach ($payloadIds as $uuid) {\n $uuid = (string) $uuid;\n\n try {\n $playbookCategory = $this->playbookCategoryRepository->findByUuid($uuid);\n } catch (Throwable $throwable) {\n Log::error(__METHOD__ . ' ' . $throwable->getMessage());\n\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory) {\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory->hasPlaybook()) {\n throw new InvalidArgumentException(sprintf('Playbook category %s has no playbook', $uuid));\n }\n\n if ($playbookCategory->getPlaybook()->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Playbook category %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $ids[] = $playbookCategory->getId();\n }\n\n $reportData[$key] = $ids;\n }\n\n return $reportData;\n }\n\n private function validateReportStatus($status): bool\n {\n if (! in_array($status, [true, false], true)) {\n throw new InvalidArgumentException('Report status is invalid');\n }\n\n return $status;\n }\n\n private function validateReportType($type): string\n {\n if (! in_array($type, self::getTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Report type is invalid: %s', $type));\n }\n\n return $type;\n }\n\n private function validateFrequency($frequency): string\n {\n if (! in_array($frequency, self::getFrequencies(), true)) {\n throw new InvalidArgumentException('Frequency is invalid');\n }\n\n return $frequency;\n }\n\n private function validateAdditionalPromptInput(?string $additionalPromptInput): ?string\n {\n if ($additionalPromptInput && strlen($additionalPromptInput) > 5000) {\n throw new InvalidArgumentException('Additional Prompt Input should be less than 5000 characters');\n }\n\n return $additionalPromptInput;\n }\n\n private function validateCustomReportName(?string $customReportName): ?string\n {\n if ($customReportName === null || $customReportName === '') {\n return null;\n }\n\n if (strlen($customReportName) > 70) {\n throw new InvalidArgumentException('Custom report name should be less than 70 characters');\n }\n\n return $customReportName;\n }\n\n private function validateOrganization(?string $organizationUuid): Team\n {\n if (! $organizationUuid) {\n throw new InvalidArgumentException('Organization is required');\n }\n\n $team = $this->teamRepository->idOrUuid($organizationUuid);\n\n if (! $team) {\n throw new InvalidArgumentException('Organization not found');\n }\n\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n throw new InvalidArgumentException('Organization does not have the Automated Reports feature');\n }\n\n return $team;\n }\n\n private function validateAndGetGroupIds(Team $team, array $teamUuids): array\n {\n $groupIds = [];\n\n foreach ($teamUuids as $uuid) {\n $group = $this->groupRepository->findByUuid($uuid);\n\n if ($group === null || $group->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Group %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $groupIds[] = $group->getId();\n\n }\n\n return $groupIds;\n }\n\n private function validateAndGetDealStageIds(Team $team, array $stageUuids, string $propertyLabel): array\n {\n $stageIds = [];\n\n foreach ($stageUuids as $uuid) {\n $stage = $this->stageRepository->findByUuid($uuid);\n\n if ($stage === null || $stage->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Stage %s not found for team %s for %s', $uuid, $team->getUuid(), $propertyLabel)\n );\n }\n\n $stageIds[] = $stage->getId();\n }\n\n return $stageIds;\n }\n\n private function validateAndGetUserIds(array $userUuids, callable $teamCheck): array\n {\n if (empty($userUuids)) {\n return [];\n }\n\n $userIds = [];\n\n foreach ($userUuids as $uuid) {\n $user = $this->userRepository->findByUuid($uuid);\n\n if (! $user || ! $user->isStatusActive()) {\n throw new InvalidArgumentException(\n sprintf('User %s not found or is not active', $uuid)\n );\n }\n\n if (! $teamCheck($user)) {\n throw new InvalidArgumentException(\n sprintf('User %s does not belong to the allowed team(s)', $uuid)\n );\n }\n\n $userIds[] = $user->getId();\n }\n\n return $userIds;\n }\n\n private function validateAndGetUserIdsByTeam(Team $team, array $userUuids): array\n {\n return $this->validateAndGetUserIds($userUuids, fn ($user) => $user->getTeamId() === $team->getId());\n }\n\n private function validateAndGetJiminnyUserIds(array $userUuids): array\n {\n $allowedTeamIds = config('kiosk.teamIds', []);\n\n return $this->validateAndGetUserIds($userUuids, fn ($user) => in_array($user->getTeamId(), $allowedTeamIds, true));\n }\n\n private function parseDate(string $dateString): string\n {\n return date('Y-m-d H:i:s', strtotime($dateString));\n }\n\n private function generateReportResultViewUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.view', ['uuid' => $result->getUuid()]);\n }\n\n private function generateReportResultDownloadUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.download', ['uuid' => $result->getUuid()]);\n }\n\n private function getReportMediaRouteResource(AutomatedReportResult $result): string\n {\n if ($result->getMediaType() === self::MEDIA_TYPE_PDF) {\n return self::PDF_KEY;\n } elseif ($result->getMediaType() === self::MEDIA_TYPE_PODCAST) {\n return self::AUDIO_KEY;\n }\n\n throw new \\InvalidArgumentException('Unknown media type.');\n }\n\n public function getMediaPath(AutomatedReportResult $result): ?string\n {\n $url = match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => $result->getPdfUrl(),\n self::MEDIA_TYPE_PODCAST => $result->getPodcastAudioUrl(),\n default => null,\n };\n\n if ($url === null) {\n return null;\n }\n\n $path = parse_url(trim($url, '\"\\''), PHP_URL_PATH);\n\n return $path ?: null;\n }\n\n public function getFilenameSuffix(AutomatedReportResult $result): ?string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => 'Podcast',\n default => null,\n };\n }\n\n public function getMailSubjectSuffix(AutomatedReportResult $result): string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => 'report',\n self::MEDIA_TYPE_PODCAST => 'podcast',\n default => '',\n };\n }\n\n public function getMediaTypeMetadata(AutomatedReportResult $result): array\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => ['extension' => 'mp3', 'mime' => 'audio/mpeg'],\n self::MEDIA_TYPE_PDF => ['extension' => 'pdf', 'mime' => 'application/pdf'],\n default => ['extension' => null, 'mime' => null],\n };\n }\n\n public function deleteS3Files(AutomatedReportResult $result): void\n {\n $teamUuid = $result->getReport()->getTeam()->getUuid();\n $reportUuid = $result->getUuid();\n\n // delete all files for a report uuid no mather of pdf, podcast, or both\n // in case of both - the podcast files are linked to the pdf (parent) uuid\n // pdf and podcast date times should be close\n $path = sprintf('%s/%s/%s', $teamUuid, self::S3_DIR, $reportUuid);\n\n foreach (self::FILE_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted S3 file', [\n 'path' => $file,\n ]);\n }\n }\n\n foreach (self::FILE_PODCAST_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '_podcast.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted Podcast S3 file', [\n 'path' => $file,\n ]);\n }\n }\n }\n\n /**\n *\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): Collection\n {\n return $this->automatedReportsRepository->getTeamIdsWithReportsResults($teamId);\n }\n\n /**\n * Core delete logic for report results using a query\n *\n * @param Builder $query\n * @param array $logContext\n *\n * @return int\n */\n private function deleteReportResultsByQuery(Builder $query, array $logContext = []): int\n {\n $deletedCount = 0;\n\n if ($query->exists()) {\n Log::info(\n 'Run delete report results',\n array_merge(\n $logContext,\n [\n 'service' => 'AutomatedReportsService',\n ]\n )\n );\n\n $query->chunkById(50, function ($results) use (&$deletedCount, $logContext) {\n foreach ($results as $result) {\n $this->deleteReportResult($result);\n $deletedCount++;\n\n Log::info(\n 'Deleted a report result',\n array_merge(\n $logContext,\n [\n 'result_id' => $result->getId(),\n 'report_id' => $result->getReportId(),\n ]\n )\n );\n }\n });\n }\n\n return $deletedCount;\n }\n\n /**\n * Delete report results for a team by retention period\n *\n * @param Team $team\n * @param CarbonImmutable $retentionDate\n *\n * @return int Number of deleted report results\n */\n public function deleteReportsResultsInRetentionPeriod(Team $team, CarbonImmutable $retentionDate): int\n {\n $reportIds = $this->automatedReportsRepository->getReportIdsByTeam($team);\n\n if ($reportIds->isEmpty()) {\n return 0;\n }\n\n $query = $this->automatedReportsRepository\n ->getReportResultsQueryForRetention($team, $retentionDate);\n\n return $this->deleteReportResultsByQuery($query, [\n 'team_id' => $team->getId(),\n 'retention_date' => $retentionDate->toDateTimeString(),\n ]);\n }\n\n /**\n * Delete ALL report results for a specific automated report\n *\n * @param string $uuid\n *\n * @return int\n */\n public function deleteReportResults(string $uuid): int\n {\n $report = $this->getReport($uuid);\n\n $query = $this->automatedReportsRepository->getResultsByReportQuery($report);\n\n return $this->deleteReportResultsByQuery($query, [\n 'report_uuid' => $uuid,\n 'report_id' => $report->getId(),\n ]);\n }\n\n public function deleteReportResult(AutomatedReportResult $result): void\n {\n $this->deleteS3Files($result);\n\n $result->delete();\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getTeamReports(Team $team): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getReportsByTeam($team);\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getReportResults(AutomatedReport $report): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getResultsByReport($report);\n }\n\n public function deleteAllReportResults(AutomatedReport $report): void\n {\n $results = $this->getReportResults($report);\n\n /** @var AutomatedReportResult $result */\n foreach ($results as $result) {\n Log::info('Deleting result', [\n 'report' => $report->getId(),\n 'result' => $result->getId(),\n ]);\n\n $this->deleteReportResult($result);\n }\n }\n\n public function deleteAllData(Team $team): void\n {\n Log::info('Deleting automated report and results for team', [\n 'team' => $team->getId(),\n ]);\n\n $reports = $this->getTeamReports($team);\n\n /** @var AutomatedReport $report */\n foreach ($reports as $report) {\n Log::info('Deleting report', [\n 'team' => $team->getId(),\n 'report' => $report->getId(),\n ]);\n\n $this->deleteAllReportResults($report);\n\n $report->delete();\n }\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"bounds":{"left":0.50166225,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"bounds":{"left":0.5103058,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"bounds":{"left":0.5212766,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"bounds":{"left":0.5299202,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"bounds":{"left":0.53856385,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"bounds":{"left":0.54953456,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"bounds":{"left":0.56050533,"top":0.14844373,"width":0.024268618,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"bounds":{"left":0.58710104,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"bounds":{"left":0.5980718,"top":0.14844373,"width":0.029587766,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"bounds":{"left":0.6599069,"top":0.14844373,"width":0.02825798,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"18","depth":4,"bounds":{"left":0.63231385,"top":0.17318435,"width":0.009640957,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"14","depth":4,"bounds":{"left":0.64394945,"top":0.17318435,"width":0.009640957,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"2","depth":4,"bounds":{"left":0.6555851,"top":0.17318435,"width":0.007978723,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"4","depth":4,"bounds":{"left":0.6655585,"top":0.17318435,"width":0.007978723,"height":0.015163607},"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.67519945,"top":0.17158818,"width":0.00731383,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.6825133,"top":0.17158818,"width":0.006981383,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o\nJOIN activities a ON o.id = a.opportunity_id\nWHERE a.crm_configuration_id = 39\nAND a.actual_start_time > '2025-10-13'\nAND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM activities\nWHERE crm_configuration_id = 39 and user_id = 143\nand actual_start_time >= '2025-10-13'\nAND type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM opportunities WHERE account_id IN (178);\nselect * from activities where id IN (620137, 620187, 620188, 620189, 620230);\n\n# HS\nSELECT * FROM opportunities WHERE id IN (238);\nselect * from activities where id IN (477,2076);\n\nselect * from users;\n\nSELECT COUNT(*) FROM users;\nSELECT COUNT(*) FROM activities;\nSELECT COUNT(*) FROM opportunities;\n\nUPDATE activities\nSET\n actual_start_time = '2025-12-19 09:00:00',\n actual_end_time = '2025-12-19 10:30:00',\n scheduled_start_time = '2025-12-19 09:00:00',\n scheduled_end_time = '2025-12-19 10:30:00'\nWHERE id IN (407509,407375);\n\nselect * from partners;\n\nSELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id\nFROM activities\nWHERE user_id = 143\nAND actual_start_time >= '2025-10-13 00:00:00'\nAND actual_start_time <= '2026-01-13 23:59:59'\nORDER BY actual_start_time DESC;\n\nSELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;\nSELECT * FROM crm_layouts where crm_configuration_id = 39;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;\n# lead_id\n# account_id 177\n# contact_id 3969\n# opportunity_id\n# stage_id 203\n\nSELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;\n\nSELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'\nAND user_id = 143 and actual_start_time >= '2025-10-13';\n\nSELECT * FROM activities a\n# JOIN opportunities o ON a.opportunity_id = o.id\nWHERE a.crm_configuration_id = 39 AND a.type = 'conference'\nand status = 'completed' and recording_state = 'recorded'\nand a.actual_start_time >= '2025-10-13'\nAND a.user_id = 143\n;\n\nselect * from leads\nwhere crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707\n\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310);\nSELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198\nSELECT * FROM activities WHERE id IN (356001, 356008); # contacts:\n\nSELECT * FROM opportunities WHERE id IN (1707);\nSELECT * FROM stages where id IN (204, 198);\nSELECT * FROM opportunities WHERE account_id IN (178);\nSELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';\nSELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal\n\nSELECT * FROM activities where crm_configuration_id = 39\nAND opportunity_id IS NULL\nAND is_internal = false\nand status = 'completed' and recording_state = 'recorded'\nAND actual_start_time >= '2025-10-13'\nAND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)\n# AND lead_id IN (112, 109)\n;\n\nSELECT * FROM crm_profiles WHERE user_id = 143;\n\nselect * from inboxes; # 212\nselect * from users where id = 143; # 143\nselect * from inbox_email_batches where inbox_id = 212\nand updated_at >= '2026-01-28 00:00:00' order by id desc;\nselect * from inbox_emails where inbox_id = 212\nand batch_id = 95885 order by id desc;\nselect * from email_messages where origin_user_id = 143;\nselect * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';\nselect * from participants where activity_id = 620247;\n\nselect * from crm_profiles where user_id = 143;\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001\nselect * from transcription where activity_id = 356001; # 6943\nselect * from ai_prompts where transcription_id = 6943;\nSELECT * FROM activity_summary_logs where activity_id = 356001;\n\nSELECT * FROM social_accounts WHERE sociable_id = 143;\n\n# ************************************************************************************\nSELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;\n# 422515 softphone tr. 8100\n\nSELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;\n# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS\n\nselect * from ai_prompts where transcription_id IN (8100, 7670);\nselect * from activity_summary_logs where activity_id = 407509;\n\nselect * from sidekick_settings;\nselect * from default_activity_types;\n\nSELECT * FROM contacts WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\nSELECT * FROM leads WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\n\nSELECT * FROM activity_searches where user_id = 143;\nSELECT * FROM groups where team_id = 1;\n\nselect * from teams where id = 1;\nselect * from groups where team_id = 1; # 1150 - 7e75f8025c22\nselect id, name, group_id, status, deleted_at, email\nfrom users where team_id = 1 order by group_id desc ;\n\nselect * from activity_searches where id in (1977, 1978, 1979);\nselect * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);\nselect * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277\nselect * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879\n\nINSERT INTO `activity_search_filters`\n(`activity_search_id`, `filter`, `value`) VALUES\n(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')\n;\n\nselect * from crm_configurations where id = 39;\n\n\nselect sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id\nwhere u.team_id = 1;\nSELECT * FROM social_accounts WHERE sociable_id = 1635;\nSELECT * FROM users WHERE id = 1635;\n\nselect * from teams where id = 1;\nselect * from users where team_id = 1;\nselect * from team_features where team_id = 1;\nselect * from features;\n\nSELECT * FROM activity_searches where id = 1982; # 1981\nSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;\n\nSELECT * FROM automated_reports where id = 68;\nUPDATE automated_reports set playbook_categories = NULL where id = 68;\nSELECT * FROM automated_report_results where id = 275;\n\nSELECT * FROM automated_reports order by id desc;\nSELECT * FROM automated_report_results order by id desc;\nselect * from activity_searches where user_id = 143;\nselect * from ask_anything_prompts;\n\nSELECT * FROM groups WHERE id = 1439;\nSELECT * FROM users WHERE group_id = 1439;\n\nselect * from permissions; # 158\nselect * from roles;\nselect * from permission_role\n\nselect * from teams where id = 1;\nselect * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;\nselect * from groups where id = 28;\nselect * from playbooks where team_id = 1;\nselect * from playbooks where id = 179;\nselect * from playbook_categories where id = 1391;\nselect * from users where id = 143;\nselect * from crm_profiles where user_id = 143;\nselect * from activities where crm_configuration_id = 39 and type = 'conference'\nand crm_provider_id IS NOT NULL ORDER by id desc;\nselect * from activities where id = 422003; # 00UO400000pB6fpMAC\n\nSELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type\nFROM automated_report_results ar\nJOIN automated_reports a ON a.id = ar.report_id\nWHERE a.type = 'ask_jiminny'\nLIMIT 10;\n\nSELECT `automated_report_results`.* FROM `automated_report_results`\nINNER JOIN `automated_reports`\n ON `automated_report_results`.`report_id` = `automated_reports`.`id`\nWHERE `automated_report_results`.`generated_at` IS NOT NULL\n AND `automated_reports`.`team_id` = 1\n AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$.\"users\"')\n;\n\n\nselect * from teams where id = 3143;\nselect * from crm_configurations where id = 500;\nselect * from users where name = 'Integration Account'; # 1695\nSELECT * FROM social_accounts WHERE sociable_id = 1695;\n\nselect * from activities where crm_configuration_id = 39\nand recording_state = 'recorded' and duration > 60\nand status = 'completed' and actual_start_time >= '2025-12-01';\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;\n\nselect * from leads;","depth":4,"value":"SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o\nJOIN activities a ON o.id = a.opportunity_id\nWHERE a.crm_configuration_id = 39\nAND a.actual_start_time > '2025-10-13'\nAND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM activities\nWHERE crm_configuration_id = 39 and user_id = 143\nand actual_start_time >= '2025-10-13'\nAND type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM opportunities WHERE account_id IN (178);\nselect * from activities where id IN (620137, 620187, 620188, 620189, 620230);\n\n# HS\nSELECT * FROM opportunities WHERE id IN (238);\nselect * from activities where id IN (477,2076);\n\nselect * from users;\n\nSELECT COUNT(*) FROM users;\nSELECT COUNT(*) FROM activities;\nSELECT COUNT(*) FROM opportunities;\n\nUPDATE activities\nSET\n actual_start_time = '2025-12-19 09:00:00',\n actual_end_time = '2025-12-19 10:30:00',\n scheduled_start_time = '2025-12-19 09:00:00',\n scheduled_end_time = '2025-12-19 10:30:00'\nWHERE id IN (407509,407375);\n\nselect * from partners;\n\nSELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id\nFROM activities\nWHERE user_id = 143\nAND actual_start_time >= '2025-10-13 00:00:00'\nAND actual_start_time <= '2026-01-13 23:59:59'\nORDER BY actual_start_time DESC;\n\nSELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;\nSELECT * FROM crm_layouts where crm_configuration_id = 39;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;\n# lead_id\n# account_id 177\n# contact_id 3969\n# opportunity_id\n# stage_id 203\n\nSELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;\n\nSELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'\nAND user_id = 143 and actual_start_time >= '2025-10-13';\n\nSELECT * FROM activities a\n# JOIN opportunities o ON a.opportunity_id = o.id\nWHERE a.crm_configuration_id = 39 AND a.type = 'conference'\nand status = 'completed' and recording_state = 'recorded'\nand a.actual_start_time >= '2025-10-13'\nAND a.user_id = 143\n;\n\nselect * from leads\nwhere crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707\n\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310);\nSELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198\nSELECT * FROM activities WHERE id IN (356001, 356008); # contacts:\n\nSELECT * FROM opportunities WHERE id IN (1707);\nSELECT * FROM stages where id IN (204, 198);\nSELECT * FROM opportunities WHERE account_id IN (178);\nSELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';\nSELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal\n\nSELECT * FROM activities where crm_configuration_id = 39\nAND opportunity_id IS NULL\nAND is_internal = false\nand status = 'completed' and recording_state = 'recorded'\nAND actual_start_time >= '2025-10-13'\nAND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)\n# AND lead_id IN (112, 109)\n;\n\nSELECT * FROM crm_profiles WHERE user_id = 143;\n\nselect * from inboxes; # 212\nselect * from users where id = 143; # 143\nselect * from inbox_email_batches where inbox_id = 212\nand updated_at >= '2026-01-28 00:00:00' order by id desc;\nselect * from inbox_emails where inbox_id = 212\nand batch_id = 95885 order by id desc;\nselect * from email_messages where origin_user_id = 143;\nselect * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';\nselect * from participants where activity_id = 620247;\n\nselect * from crm_profiles where user_id = 143;\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001\nselect * from transcription where activity_id = 356001; # 6943\nselect * from ai_prompts where transcription_id = 6943;\nSELECT * FROM activity_summary_logs where activity_id = 356001;\n\nSELECT * FROM social_accounts WHERE sociable_id = 143;\n\n# ************************************************************************************\nSELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;\n# 422515 softphone tr. 8100\n\nSELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;\n# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS\n\nselect * from ai_prompts where transcription_id IN (8100, 7670);\nselect * from activity_summary_logs where activity_id = 407509;\n\nselect * from sidekick_settings;\nselect * from default_activity_types;\n\nSELECT * FROM contacts WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\nSELECT * FROM leads WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\n\nSELECT * FROM activity_searches where user_id = 143;\nSELECT * FROM groups where team_id = 1;\n\nselect * from teams where id = 1;\nselect * from groups where team_id = 1; # 1150 - 7e75f8025c22\nselect id, name, group_id, status, deleted_at, email\nfrom users where team_id = 1 order by group_id desc ;\n\nselect * from activity_searches where id in (1977, 1978, 1979);\nselect * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);\nselect * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277\nselect * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879\n\nINSERT INTO `activity_search_filters`\n(`activity_search_id`, `filter`, `value`) VALUES\n(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')\n;\n\nselect * from crm_configurations where id = 39;\n\n\nselect sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id\nwhere u.team_id = 1;\nSELECT * FROM social_accounts WHERE sociable_id = 1635;\nSELECT * FROM users WHERE id = 1635;\n\nselect * from teams where id = 1;\nselect * from users where team_id = 1;\nselect * from team_features where team_id = 1;\nselect * from features;\n\nSELECT * FROM activity_searches where id = 1982; # 1981\nSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;\n\nSELECT * FROM automated_reports where id = 68;\nUPDATE automated_reports set playbook_categories = NULL where id = 68;\nSELECT * FROM automated_report_results where id = 275;\n\nSELECT * FROM automated_reports order by id desc;\nSELECT * FROM automated_report_results order by id desc;\nselect * from activity_searches where user_id = 143;\nselect * from ask_anything_prompts;\n\nSELECT * FROM groups WHERE id = 1439;\nSELECT * FROM users WHERE group_id = 1439;\n\nselect * from permissions; # 158\nselect * from roles;\nselect * from permission_role\n\nselect * from teams where id = 1;\nselect * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;\nselect * from groups where id = 28;\nselect * from playbooks where team_id = 1;\nselect * from playbooks where id = 179;\nselect * from playbook_categories where id = 1391;\nselect * from users where id = 143;\nselect * from crm_profiles where user_id = 143;\nselect * from activities where crm_configuration_id = 39 and type = 'conference'\nand crm_provider_id IS NOT NULL ORDER by id desc;\nselect * from activities where id = 422003; # 00UO400000pB6fpMAC\n\nSELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type\nFROM automated_report_results ar\nJOIN automated_reports a ON a.id = ar.report_id\nWHERE a.type = 'ask_jiminny'\nLIMIT 10;\n\nSELECT `automated_report_results`.* FROM `automated_report_results`\nINNER JOIN `automated_reports`\n ON `automated_report_results`.`report_id` = `automated_reports`.`id`\nWHERE `automated_report_results`.`generated_at` IS NOT NULL\n AND `automated_reports`.`team_id` = 1\n AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$.\"users\"')\n;\n\n\nselect * from teams where id = 3143;\nselect * from crm_configurations where id = 500;\nselect * from users where name = 'Integration Account'; # 1695\nSELECT * FROM social_accounts WHERE sociable_id = 1695;\n\nselect * from activities where crm_configuration_id = 39\nand recording_state = 'recorded' and duration > 60\nand status = 'completed' and actual_start_time >= '2025-12-01';\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;\n\nselect * from leads;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"bounds":{"left":0.011968086,"top":0.047885075,"width":0.024268618,"height":0.024740623},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Cascade","depth":3,"bounds":{"left":0.6911569,"top":0.047885075,"width":0.026263298,"height":0.024740623},"role_description":"text"},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Project","depth":3,"bounds":{"left":0.0,"top":0.046288908,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Structure","depth":3,"bounds":{"left":0.0,"top":0.15722266,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Bookmarks","depth":3,"bounds":{"left":0.0,"top":0.13168396,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Welcome to SonarQube for IDE","depth":3,"bounds":{"left":0.0,"top":0.07182761,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Pull Requests","depth":3,"bounds":{"left":0.0,"top":0.10614525,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More","depth":3,"bounds":{"left":0.0,"top":0.18276137,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Problems","depth":3,"bounds":{"left":0.0,"top":0.95530725,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Terminal","depth":3,"bounds":{"left":0.0,"top":0.92976856,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"TODO","depth":3,"bounds":{"left":0.0,"top":0.802075,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Windsurf Console","depth":3,"bounds":{"left":0.0,"top":0.8276137,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"SonarQube for IDE","depth":3,"bounds":{"left":0.0,"top":0.9042298,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Services","depth":3,"bounds":{"left":0.0,"top":0.87869114,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Git","depth":3,"bounds":{"left":0.0,"top":0.85315245,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Notifications","depth":3,"bounds":{"left":0.9893617,"top":0.046288908,"width":0.010638297,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cascade","depth":3,"bounds":{"left":0.9893617,"top":0.14844373,"width":0.010638297,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Database","depth":3,"bounds":{"left":0.9893617,"top":0.09736632,"width":0.010638297,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AI Chat","depth":3,"bounds":{"left":0.9893617,"top":0.07182761,"width":0.010638297,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run","depth":3,"bounds":{"left":0.9893617,"top":0.12290503,"width":0.010638297,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More","depth":3,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Pushed 1 commit to origin/JY-18909-automated-reports-ask-jiminny // View pull request (today 16:29)","depth":4,"bounds":{"left":0.0033244682,"top":0.98164403,"width":0.19514628,"height":0.018355945},"role_description":"text"},{"role":"AXStaticText","text":"Hide processes (1)","depth":3,"role_description":"text"},{"role":"AXStaticText","text":"Windsurf Teams","depth":3,"bounds":{"left":0.88896275,"top":0.98164403,"width":0.04255319,"height":0.018355945},"help_text":"Windsurf","role_description":"text"},{"role":"AXStaticText","text":"892:20","depth":3,"bounds":{"left":0.93151593,"top":0.98164403,"width":0.01861702,"height":0.018355945},"help_text":"Go to Line","role_description":"text"},{"role":"AXStaticText","text":"Language Services Button","depth":3,"role_description":"text"},{"role":"AXStaticText","text":"UTF-8","depth":3,"bounds":{"left":0.95013297,"top":0.98164403,"width":0.01761968,"height":0.018355945},"help_text":"File Encoding: UTF-8","role_description":"text"},{"role":"AXStaticText","text":"Column selection mode","depth":3,"help_text":"Column selection mode","role_description":"text"},{"role":"AXStaticText","text":"4 spaces","depth":3,"bounds":{"left":0.97706115,"top":0.9848364,"width":0.016954787,"height":0.012769354},"role_description":"text"}]...
|
-6532606308203292909
|
1126710648141684156
|
idle
|
accessibility
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsRepositoryTest
Run 'AutomatedReportsRepositoryTest'
Debug 'AutomatedReportsRepositoryTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
102
3
34
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Kiosk\AutomatedReports;
use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Carbon\Exceptions\InvalidFormatException;
use DateTime;
use DateTimeInterface;
use DateTimeZone;
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcher;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Jiminny\Component\ActivitySearch\FilterDefinition\InputTypeEnum;
use Jiminny\Component\AskAnything\AskAnythingPromptService;
use Jiminny\Component\AskAnything\Dtos\AskAnythingPromptDto;
use Jiminny\Component\UrlGenerator\Webhook;
use Jiminny\Contracts\Repositories\PlaybookCategoryRepository;
use Jiminny\Contracts\Repositories\TeamRepository;
use Jiminny\Contracts\Repositories\UserRepository;
use Jiminny\Exceptions\ApplicationException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Exceptions\ModelNotFoundException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateReportJob;
use Jiminny\Models\Activity\Search;
use Jiminny\Models\AskAnything\AskAnythingPrompt;
use Jiminny\Models\AskAnything\AskAnythingPromptTarget;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Contracts\UserContract;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AskAnythingRepository;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Repositories\GroupRepository;
use Jiminny\Repositories\SearchRepository;
use Jiminny\Repositories\StageRepository;
use Throwable;
class AutomatedReportsService
{
public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';
public const string TYPE_ASK_JIMINNY = 'ask_jiminny';
/**
* Standard report types (used by kiosk for existing automated reports).
*/
// @TODO this will add filter, however if we need to control feature by FF we need conditional logic
public const array TYPES = [
['id' => 'exec_summary', 'name' => 'Exec Summary'],
['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],
['id' => 'product_feedback', 'name' => 'Product Feedback'],
['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],
// ['id' => 'questions', 'name' => 'Questions'],
// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],
];
public const array ALL_TYPES = [
...self::TYPES,
['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],
];
public const string FREQUENCY_DAILY = 'daily';
public const string FREQUENCY_WEEKLY = 'weekly';
public const string FREQUENCY_MONTHLY = 'monthly';
public const string FREQUENCY_QUARTERLY = 'quarterly';
public const string FREQUENCY_ONE_OFF = 'one_off';
/**
* Frequencies for standard (non-Ask Jiminny) reports.
*/
public const array FREQUENCIES = [
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
/**
* Frequencies for Ask Jiminny reports.
*/
public const array ASK_JIMINNY_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
];
public const string MEDIA_TYPE_PDF = 'pdf';
public const string MEDIA_TYPE_PODCAST = 'podcast';
public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];
public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];
public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];
public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];
public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];
public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];
public const int SENT_REPORT_AT_HOURS = 5;
public const string PDF_KEY = 'pdf';
public const string AUDIO_KEY = 'audio';
private const array ALL_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
private const string S3_DIR = 'reports';
private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];
private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];
public function __construct(
private readonly TeamRepository $teamRepository,
private readonly GroupRepository $groupRepository,
private readonly UserRepository $userRepository,
private readonly StageRepository $stageRepository,
private readonly DealStagesService $dealStagesService,
private readonly RecipientsService $recipientsService,
private readonly AutomatedReportsRepository $automatedReportsRepository,
private readonly Webhook $webhookService,
private readonly BusDispatcher $dispatcher,
private readonly ActivityTypeService $activityTypeService,
private readonly PlaybookCategoryRepository $playbookCategoryRepository,
private readonly AskAnythingPromptService $askAnythingPromptService,
private readonly SearchRepository $activitySearchRepository,
private readonly AskAnythingRepository $askAnythingRepository,
) {
}
public static function getTypes(): array
{
$types = self::TYPES;
return array_map(static function ($type) {
return $type['id'];
}, $types);
}
public static function getCallTypes(): array
{
return array_map(static function ($callType) {
return $callType['id'];
}, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);
}
public static function getFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::FREQUENCIES);
}
// front-facing structure
public function getReportEnabledFieldData(bool $value = false): array
{
return [
'id' => 'report_enabled',
'label' => '',
'inputType' => InputTypeEnum::TOGGLE,
'value' => $value,
];
}
// Organizations = Teams
public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array
{
$options = $this->getTeams();
if ($shortVersion) {
return [
'id' => 'organization',
'label' => 'Organization',
'options' => $options,
];
}
return [
'id' => 'organization',
'label' => 'Organization',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $options,
'value' => $value,
'dependencies' => [
'teams',
'deal_stage_at_call',
'current_deal_stage',
'recipients',
ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,
],
'dependsOn' => [],
];
}
// Teams = Groups
public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array
{
if ($shortVersion) {
return [
'id' => 'teams',
'label' => 'Team',
'options' => $options,
];
}
return [
'id' => 'teams',
'label' => 'Team',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => false,
'placeholder' => 'Select',
'options' => $options,
'value' => $value, // value should be an array of objects {id, name}
'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],
'dependsOn' => [],
];
}
public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array
{
$types = [];
if ($team instanceof Team) {
if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
$types = self::TYPES;
}
if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {
$types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];
}
} else {
$types = self::TYPES;
}
if ($shortVersion) {
return [
'id' => 'report_type',
'label' => 'Report Type',
'options' => $types,
];
}
return [
'id' => 'report_type',
'label' => 'Report Type',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $types,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getFrequencyFieldData(?string $value = null): array
{
return [
'id' => 'frequency',
'label' => 'Frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => self::FREQUENCIES,
'value' => $value,
'dependencies' => ['period'],
'dependsOn' => [],
];
}
public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array
{
return [
'id' => 'period',
'label' => 'Select one-off period',
'inputType' => InputTypeEnum::DATE_RANGE,
'required' => true,
'placeholder' => 'Select',
'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],
'queryParams' => [
'startDate' => 'start_date_period',
'endDate' => 'end_date_period',
],
'dependencies' => [],
'dependsOn' => ['frequency'],
];
}
public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array
{
return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);
}
public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);
}
public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);
}
public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'deal_value',
'label' => 'Deal Value',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_deal_value',
'max' => 'max_deal_value',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array
{
$value = [];
$conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;
$dialerOn && $value[] = self::CALL_TYPE_DIALER;
return [
'id' => 'call_type',
'label' => 'Call Type',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => [
self::CALL_TYPE_CONFERENCE,
self::CALL_TYPE_DIALER,
],
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getMediaTypeFieldData(?AutomatedReport $report = null): array
{
$value = [];
if ($report) {
$value = $this->transformMediaTypes($report);
}
return [
'id' => 'media_types',
'label' => 'Export as',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => self::MEDIA_TYPE_OBJECTS,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'call_duration',
'label' => 'Call Duration',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_call_duration',
'max' => 'max_call_duration',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getRecipientsFieldData(?Team $team = null, array $value = []): array
{
return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);
}
public function getJiminnyRecipientsFieldData(array $value = []): array
{
return $this->recipientsService->getJiminnyRecipientsFieldData($value);
}
public function getAdditionalPromptInputFieldData(?string $value = null): array
{
return [
'id' => 'additional_prompt_input',
'label' => 'Special requirements',
'inputType' => InputTypeEnum::TEXTAREA,
'required' => false,
'placeholder' => 'What should be the focus of the report?',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCustomReportNameFieldData(?string $value = null): array
{
return [
'id' => 'custom_name',
'label' => 'Custom report name',
'inputType' => InputTypeEnum::TEXT,
'required' => false,
'placeholder' => 'Enter custom name',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
// data providers
public function getTeams(): array
{
$teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);
$teamData = [];
foreach ($teams as $team) {
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
continue;
}
$teamData[] = $this->transformTeam($team);
}
return $teamData;
}
public function getTeamGroups(string $teamUuid): array
{
$data = [];
$team = $this->getTeam($teamUuid);
if ($team !== null) {
$groups = $team->groups()->get();
foreach ($groups as $group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
];
}
}
return $data;
}
public function getTeamsGroupsOptions(array $filterTeamUuids = []): array
{
$data = [];
$teams = $this->getTeams();
foreach ($teams as $team) {
if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {
continue;
}
$data[] = [
'label' => $team['name'],
'groups' => $this->getTeamGroups($team['id']),
];
}
return $data;
}
public function getTeam(string $teamUuid): ?Team
{
return $this->teamRepository->idOrUuid($teamUuid);
}
public function getTeamById(int $teamId): ?Team
{
return $this->teamRepository->find($teamId);
}
public function getGroupsUuids(AutomatedReport $report): array
{
$uuids = [];
$reportGroups = $report->getGroups();
foreach ($reportGroups as $groupId) {
if ($group = $this->groupRepository->find($groupId)) {
$uuids[] = $group->getUuid();
}
}
return $uuids;
}
public function getPlaybookCategoriesUuids(AutomatedReport $report): array
{
$uuids = [];
$playbookCategories = $report->getPlaybookCategories();
foreach ($playbookCategories as $id) {
if ($category = $this->playbookCategoryRepository->find($id)) {
$uuids[] = $category->getUuid();
}
}
return $uuids;
}
public function getDealAtCallStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getDealAtCallStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getCurrentDealStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getCurrentDealStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getRecipients());
}
public function getJiminnyUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function extractUserUuids(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => $user->getUuid())
->values()
->all();
}
// get mail data
public function getRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getRecipients());
}
/**
* @return array<UserContract>
*/
public function getRecipientUserObjects(AutomatedReport $report): array
{
$userIds = $report->getRecipients()['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->values()
->all();
}
private function getJiminnyRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function buildRecipientUsers(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => [
'email' => $user->getEmailAddress(),
'name' => $user->getName(),
'timezone' => $user->getTimezone()->getName(),
])
->values()
->all();
}
public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array
{
if ($report->isAskJiminnyReport()) {
$recipients = $this->resolveAskJiminnyRecipients($report);
} else {
$recipients = $this->getRecipientUsers($report);
if ($includeJiminny) {
$recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));
}
}
$emails = [];
return array_values(array_filter(
$recipients,
static function ($recipient) use (&$emails) {
if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {
return false;
}
$emails[] = $recipient['email'];
return true;
}
));
}
private function resolveAskJiminnyRecipients(AutomatedReport $report): array
{
$recipients = [];
$creator = $report->getCreator();
if ($creator !== null) {
$recipients[] = [
'email' => $creator->getEmailAddress(),
'name' => $creator->getName(),
'timezone' => $creator->getTimezone()->getName(),
];
}
return array_merge(
$recipients,
$this->buildRecipientUsers($report->getRecipients()),
$this->getGroupRecipientUsers($report),
);
}
private function getGroupRecipientUsers(AutomatedReport $report): array
{
$users = [];
foreach ($report->getGroups() as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group === null) {
continue;
}
foreach ($group->getMembers() as $member) {
$users[] = [
'email' => $member->getEmailAddress(),
'name' => $member->getName(),
'timezone' => $member->getTimezone()->getName(),
];
}
}
return $users;
}
public function getReportTypeName(AutomatedReportResult $report): string
{
$type = $report->getReport()->getType();
$getType = $this->transformReportType($type);
return $getType['name'];
}
public function getReportPeriodName(AutomatedReportResult $report): string
{
$from = $report->getFromDate();
$to = $report->getToDate();
$frequency = $report->getReport()->getFrequency();
if ($from === null || $to === null) {
if (! $report->getReport()->isAskJiminnyReport()) {
$invalidPeriod = $from === null ? 'from' : 'to';
throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);
}
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
}
return $this->formatReportPeriodName($frequency, $from, $to);
}
private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string
{
$fromYear = $from->format('Y');
$toYear = $to->format('Y');
$differentYears = $fromYear !== $toYear;
switch ($frequency) {
case self::FREQUENCY_DAILY:
return $from->format('j M Y');
case self::FREQUENCY_QUARTERLY:
// 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ
$startMonth = $from->format('M');
$endMonth = $to->copy()->subMonth();
$endMonthName = $endMonth->format('M');
$endMonthYear = $endMonth->format('Y');
if ($differentYears) {
return "{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}";
}
return "{$startMonth} - {$endMonthName} {$toYear}";
case self::FREQUENCY_MONTHLY:
// 'May 2025' - monthly reports are always within the same year
return $from->format('M Y');
case self::FREQUENCY_WEEKLY:
// '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ
$startDay = $from->format('j');
$endDay = $to->format('j');
$startMonth = $from->format('M');
$endMonth = $to->format('M');
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
if ($startMonth !== $endMonth) {
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
}
return "{$startDay} - {$endDay} {$endMonth} {$toYear}";
case self::FREQUENCY_ONE_OFF:
// '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ
$startDay = $from->format('j');
$startMonth = $from->format('M');
$endDay = $to->format('j');
$endMonth = $to->format('M');
// If same month and year, use a format like '2-31 May 2025'
if ($startMonth === $endMonth && ! $differentYears) {
return "{$startDay} - {$endDay} {$startMonth} {$toYear}";
}
// If different years, include both years
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
// Same year but different months
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
default:
// Default format for unknown frequencies
return $from->format('j M Y') . ' - ' . $to->format('j M Y');
}
}
public function getReportTeamsName(AutomatedReportResult $report): string
{
$groups = $report->getGroups();
if (empty($groups)) {
return 'All';
}
// Get group names from repository
$groupNames = [];
foreach ($groups as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group) {
$groupNames[] = $group->getName();
}
}
if (count($groupNames) === 1) {
// Single team format
$teamsName = $groupNames[0];
} else {
// Multiple teams format
$teamsName = implode(', ', $groupNames);
}
return $teamsName;
}
public function getReportFileName(AutomatedReportResult $report): string
{
$customName = $report->getReport()->getCustomName();
$periodName = $this->getReportPeriodName($report);
$filenameSuffix = $this->getFilenameSuffix($report);
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$customName} - {$periodName}");
}
$baseName = $this->getReportTypeName($report);
if ($filenameSuffix) {
$baseName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}");
}
public function getReportFileNameWithExtension(AutomatedReportResult $result): string
{
$extension = $this->getMediaTypeMetadata($result)['extension'];
return $this->getReportFileName($result) . '.' . $extension;
}
public function sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool
{
$recipients = array_map('intval', $report->getRecipients()['users'] ?? []);
return in_array($user->getId(), $recipients);
}
public function transformReportResults(Collection $automatedReportResults): array
{
$data = [];
foreach ($automatedReportResults as $automatedReportResult) {
/** @var AutomatedReportResult $automatedReportResult */
$report = $automatedReportResult->getReport();
$createdBy = $report->getCreator();
$creator = [
'id' => $createdBy?->getUuid(),
'name' => $createdBy?->getName(),
'email' => $createdBy?->getEmailAddress(),
'photoUrl' => $createdBy?->getPhotoUrl(),
];
$data[] = [
'id' => $automatedReportResult->getUuid(),
'name' => $automatedReportResult->getName(),
'frequency' => $this->transformFrequency($report->getFrequency()),
'recipients' => $this->buildRecipients($report),
'report_type' => $this->transformReportType($report->getType()),
'media_type' => $automatedReportResult->getMediaType(),
'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),
'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),
'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),
'creator' => $creator,
];
}
return $data;
}
private function buildRecipients(AutomatedReport $report): array
{
$creatorUuid = $report->getCreator()?->getUuid();
$recipients = array_values(array_filter(
$this->transformRecipients($report->getRecipients()),
static fn (array $recipient): bool => $recipient['id'] !== $creatorUuid,
));
if (! $report->isAskJiminnyReport()) {
return $recipients;
}
return [
...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),
...$recipients,
];
}
public function hasCallTypeConference(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);
}
public function hasCallTypeDialer(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);
}
// transformers
private function transformTeam(Team $team): array
{
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
return [];
}
return [
'id' => $team->getUuid(),
'name' => $team->getName(),
];
}
private function transformReportFullView(AutomatedReport $report): array
{
$base = $this->transformReportBase($report);
return $report->getType() === self::TYPE_ASK_JIMINNY
? $base + $this->transformAskJiminnyFields($report)
: $base + $this->transformStandardReportFields($report);
}
private function transformReportBase(AutomatedReport $report): array
{
return [
'id' => $report->getUuid(),
'organization' => $this->transformOrganization(team: $report->getTeam()),
'report_type' => $this->transformReportType($report->getType()),
'frequency' => $this->transformFrequency($report->getFrequency()),
];
}
private function transformStandardReportFields(AutomatedReport $report): array
{
$team = $report->getTeam();
return [
'report_enabled' => $report->getStatus(),
'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),
'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),
'deal_value_min' => $report->getDealValueMin(),
'deal_value_max' => $report->getDealValueMax(),
'call_types' => $this->transformCallType($report->getCallTypes()),
'media_types' => $this->transformMediaTypes($report),
'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),
'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),
'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),
'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),
'recipients' => $this->transformRecipients($report->getRecipients()),
'created_by' => $this->transformCreator($report->getCreator()),
'additional_prompt_input' => $report->getAdditionalPromptInput(),
'custom_name' => $report->getCustomName(),
'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),
'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),
'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),
];
}
private function transformAskJiminnyFields(AutomatedReport $report): array
{
$team = $report->getTeam();
$creatorId = $report->getAttribute('created_by');
$explicitUserIds = array_values(array_filter(
$report->getRecipients()['users'] ?? [],
static fn ($id) => $id !== $creatorId
));
return [
'report_name' => $report->getCustomName(),
'enabled' => $report->getStatus(),
'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),
'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),
'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),
'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),
];
}
private function transformOrganization(?Team $team): array
{
return [
'id' => $team?->getUuid(),
'name' => $team?->getName(),
];
}
private function transformReportType(string $type): array
{
foreach (self::ALL_TYPES as $typeItem) {
if ($typeItem['id'] === $type) {
return $typeItem;
}
}
return [];
}
private function transformCallType(array $types): array
{
$result = [];
$callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];
foreach ($types as $type) {
foreach ($callTypes as $callTypeItem) {
if ($callTypeItem['id'] === $type) {
$result[] = $callTypeItem;
break;
}
}
}
return $result;
}
private function transformMediaTypes(AutomatedReport $report): array
{
$values = [];
foreach ($report->getMediaTypes() as $mediaType) {
if (! in_array($mediaType, self::MEDIA_TYPES, true)) {
continue;
}
$values[] = match ($mediaType) {
self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,
self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,
};
}
return $values;
}
private function transformFrequency(string $frequency): array
{
foreach (self::ALL_FREQUENCIES as $frequencyItem) {
if ($frequencyItem['id'] === $frequency) {
return $frequencyItem;
}
}
return [];
}
public function transformDurationToMinutes(?int $duration): ?int
{
if (! $duration) {
return null;
}
return (int) ($duration / 60);
}
private function transformGroups(?Team $team, array $groupsIds): array
{
if (empty($groupsIds) || ! $team) {
return [];
}
$data = [];
foreach ($groupsIds as $groupId) {
$group = $team->groups()->where('id', $groupId)->first();
if ($group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
'photoUrl' => $group->getPhotoUrl(),
];
}
}
return $data;
}
private function transformStages(?Team $team, array $stagesIds): array
{
if (empty($stagesIds) || ! $team) {
return [];
}
$data = [];
foreach ($stagesIds as $stageId) {
$stage = $team->stages()->where('id', $stageId)->first();
if ($stage) {
$data[] = [
'id' => $stage->getUuid(),
'name' => $stage->getName(),
];
}
}
return $data;
}
private function transformRecipients(array $recipients): array
{
$users = [];
foreach ($recipients['users'] ?? [] as $userId) {
$users[] = $this->transformUser($userId);
}
return $users;
}
private function transformCreator(?User $user): ?array
{
if ($user === null) {
return null;
}
return $this->transformUser($user->getId());
}
private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array
{
if ($prompt === null) {
return null;
}
return [
'id' => $prompt->getUuid(),
'name' => $prompt->getTitle(),
];
}
private function transformSafeSearch(?Search $search): ?array
{
if ($search === null) {
return null;
}
return [
'id' => $search->getUuid(),
'name' => $search->getName(),
];
}
private function transformUser(int $userId): array
{
/* @var ?User $user */
$user = $this->userRepository->find($userId);
return [
'id' => $user?->getUuid(),
'name' => $user?->getName(),
'email' => $user?->getEmailAddress(),
'photoUrl' => $user?->getPhotoUrl(),
];
}
public function create(array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$validatedData['created_by'] = auth()->id();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
public function update(string $uuid, array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$report = $this->automatedReportsRepository->findByUuid($uuid);
if (! $report) {
throw new InvalidArgumentException('Report not found');
}
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
/**
* Create an Ask Jiminny report.
*/
public function createAskJiminnyReport(array $data, User $creator): array
{
$validatedData = $this->validateAskJiminnyReportData($data, $creator);
$validatedData['created_by'] = $creator->getId();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
return $this->transformReportFullView($automatedReport);
}
/**
* Update an Ask Jiminny report.
*/
public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array
{
if (! $report->isAskJiminnyReport()) {
throw new InvalidArgumentException('Report is not an Ask Jiminny report');
}
$validatedData = $this->validateAskJiminnyReportData($data, $user);
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
return $this->transformReportFullView($automatedReport);
}
public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array
{
$this->automatedReportsRepository->update($report, ['status' => $status]);
return $this->transformReportFullView($report->fresh());
}
/**
* Validate and transform data for Ask Jiminny reports.
*/
private function validateAskJiminnyReportData(array $data, User $user): array
{
// Validate name
$name = trim($data['report_name'] ?? '');
if (empty($name)) {
throw new InvalidArgumentException('Report name is required');
}
if (mb_strlen($name) > 50) {
throw new InvalidArgumentException('Report name must be 50 characters or less');
}
// Validate frequency (only daily, weekly, monthly for Ask Jiminny)
$frequency = $data['frequency'] ?? null;
$askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];
if (! in_array($frequency, $askJiminnyFrequencies, true)) {
throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');
}
// Validate expiration date
$expiresAt = $data['expires_on'] ?? null;
if (empty($expiresAt)) {
throw new InvalidArgumentException('Expiration date is required');
}
try {
$expiresAtDate = Carbon::parse($expiresAt);
} catch (InvalidFormatException $e) {
throw new InvalidArgumentException('Expiration date format is invalid');
}
$maxExpiration = Carbon::now()->addYear()->endOfDay();
if ($expiresAtDate->gt($maxExpiration)) {
throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');
}
if ($expiresAtDate->isPast()) {
throw new InvalidArgumentException('Expiration date cannot be in the past');
}
// Validate saved search
$activitySearchId = $data['saved_search'] ?? null;
if (empty($activitySearchId)) {
throw new InvalidArgumentException('Saved search is required');
}
$savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);
if (! $savedSearch) {
throw new InvalidArgumentException('Saved search not found or does not belong to you');
}
// Validate saved prompt
$askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;
if (empty($askAnythingPromptId)) {
throw new InvalidArgumentException('Ask Jiminny prompt is required');
}
$prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);
if (! $prompt) {
throw new InvalidArgumentException('Ask Jiminny prompt not found');
}
// Validate status
$status = $data['enabled'] ?? false;
$recipientUserIds = [$user->getId()];
if (! empty($data['share_users'])) {
$sharedUserIds = $this->validateAndGetUserIdsByTeam(
$user->team,
(array) $data['share_users']
);
$recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);
}
$sharedGroupIds = [];
if (! empty($data['share_teams'])) {
$sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);
}
$recipientUserIds = array_values(array_unique($recipientUserIds));
return [
'team_id' => $user->getTeamId(),
'type' => self::TYPE_ASK_JIMINNY,
'status' => (bool) $status,
'frequency' => $frequency,
'custom_name' => $name,
'activity_search_id' => $savedSearch->getId(),
'ask_anything_prompt_id' => $prompt->getId(),
'expires_at' => $expiresAtDate->toDateString(),
'media_types' => [self::MEDIA_TYPE_PDF],
'call_types' => [],
'recipients' => ['users' => $recipientUserIds],
'groups' => $sharedGroupIds,
];
}
public static function getAskJiminnyFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::ASK_JIMINNY_FREQUENCIES);
}
public function getAskJiminnyReportFilters(User $user): array
{
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
return [
[
'id' => 'prompt',
'label' => 'Prompt',
'options' => $prompts,
],
[
'id' => 'saved_search',
'label' => 'Saved Search',
'options' => $savedSearches,
],
];
}
public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array
{
$team = $user->getTeam();
$userTimezone = $user->getTimezone();
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
$teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [
'id' => $group->getUuid(),
'name' => $group->getName(),
])->values()->all();
$shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];
$sharedTeamsValue = [];
$sharedUsersValue = [];
if ($report) {
$sharedTeamsValue = $this->transformGroups($team, $report->getGroups());
$recipientUserIds = $report->getRecipients()['users'] ?? [];
$creatorId = $report->getAttribute('created_by');
$sharedUserIds = array_values(array_filter(
$recipientUserIds,
static fn ($id) => $id !== $creatorId
));
$sharedUsersValue = collect($sharedUserIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (User $u) => [
'id' => $u->getUuid(),
'name' => $u->getName(),
])
->values()
->all();
}
return [
'fields' => [
[
'id' => 'enabled',
'inputType' => InputTypeEnum::TOGGLE,
'label' => '',
'value' => $report?->getStatus() ?? false,
],
[
'id' => 'report_name',
'inputType' => InputTypeEnum::TEXT,
'label' => 'Name',
'placeholder' => 'Enter name',
'required' => true,
'validation' => ['maxLength' => 50],
'value' => $report?->getCustomName() ?? '',
],
[
'id' => 'frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'label' => 'Frequency',
'required' => true,
'placeholder' => 'Select',
'options' => self::ASK_JIMINNY_FREQUENCIES,
'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,
],
[
'id' => 'expires_on',
'inputType' => InputTypeEnum::DATE,
'label' => 'Expires on',
'required' => true,
'placeholder' => 'Select',
'validation' => [
'minDate' => now($userTimezone)->toDateString(),
'maxDate' => n...
|
NULL
|
|
66792
|
NULL
|
0
|
2026-04-21T15:04:31.422625+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776783871422_m1.jpg...
|
PhpStorm
|
faVsco.js – AutomatedReportsService.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsRepositoryTest
Run 'AutomatedReportsRepositoryTest'
Debug 'AutomatedReportsRepositoryTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
102
3
34
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Kiosk\AutomatedReports;
use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Carbon\Exceptions\InvalidFormatException;
use DateTime;
use DateTimeInterface;
use DateTimeZone;
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcher;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Jiminny\Component\ActivitySearch\FilterDefinition\InputTypeEnum;
use Jiminny\Component\AskAnything\AskAnythingPromptService;
use Jiminny\Component\AskAnything\Dtos\AskAnythingPromptDto;
use Jiminny\Component\UrlGenerator\Webhook;
use Jiminny\Contracts\Repositories\PlaybookCategoryRepository;
use Jiminny\Contracts\Repositories\TeamRepository;
use Jiminny\Contracts\Repositories\UserRepository;
use Jiminny\Exceptions\ApplicationException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Exceptions\ModelNotFoundException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateReportJob;
use Jiminny\Models\Activity\Search;
use Jiminny\Models\AskAnything\AskAnythingPrompt;
use Jiminny\Models\AskAnything\AskAnythingPromptTarget;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Contracts\UserContract;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AskAnythingRepository;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Repositories\GroupRepository;
use Jiminny\Repositories\SearchRepository;
use Jiminny\Repositories\StageRepository;
use Throwable;
class AutomatedReportsService
{
public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';
public const string TYPE_ASK_JIMINNY = 'ask_jiminny';
/**
* Standard report types (used by kiosk for existing automated reports).
*/
// @TODO this will add filter, however if we need to control feature by FF we need conditional logic
public const array TYPES = [
['id' => 'exec_summary', 'name' => 'Exec Summary'],
['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],
['id' => 'product_feedback', 'name' => 'Product Feedback'],
['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],
// ['id' => 'questions', 'name' => 'Questions'],
// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],
];
public const array ALL_TYPES = [
...self::TYPES,
['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],
];
public const string FREQUENCY_DAILY = 'daily';
public const string FREQUENCY_WEEKLY = 'weekly';
public const string FREQUENCY_MONTHLY = 'monthly';
public const string FREQUENCY_QUARTERLY = 'quarterly';
public const string FREQUENCY_ONE_OFF = 'one_off';
/**
* Frequencies for standard (non-Ask Jiminny) reports.
*/
public const array FREQUENCIES = [
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
/**
* Frequencies for Ask Jiminny reports.
*/
public const array ASK_JIMINNY_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
];
public const string MEDIA_TYPE_PDF = 'pdf';
public const string MEDIA_TYPE_PODCAST = 'podcast';
public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];
public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];
public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];
public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];
public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];
public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];
public const int SENT_REPORT_AT_HOURS = 5;
public const string PDF_KEY = 'pdf';
public const string AUDIO_KEY = 'audio';
private const array ALL_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
private const string S3_DIR = 'reports';
private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];
private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];
public function __construct(
private readonly TeamRepository $teamRepository,
private readonly GroupRepository $groupRepository,
private readonly UserRepository $userRepository,
private readonly StageRepository $stageRepository,
private readonly DealStagesService $dealStagesService,
private readonly RecipientsService $recipientsService,
private readonly AutomatedReportsRepository $automatedReportsRepository,
private readonly Webhook $webhookService,
private readonly BusDispatcher $dispatcher,
private readonly ActivityTypeService $activityTypeService,
private readonly PlaybookCategoryRepository $playbookCategoryRepository,
private readonly AskAnythingPromptService $askAnythingPromptService,
private readonly SearchRepository $activitySearchRepository,
private readonly AskAnythingRepository $askAnythingRepository,
) {
}
public static function getTypes(): array
{
$types = self::TYPES;
return array_map(static function ($type) {
return $type['id'];
}, $types);
}
public static function getCallTypes(): array
{
return array_map(static function ($callType) {
return $callType['id'];
}, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);
}
public static function getFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::FREQUENCIES);
}
// front-facing structure
public function getReportEnabledFieldData(bool $value = false): array
{
return [
'id' => 'report_enabled',
'label' => '',
'inputType' => InputTypeEnum::TOGGLE,
'value' => $value,
];
}
// Organizations = Teams
public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array
{
$options = $this->getTeams();
if ($shortVersion) {
return [
'id' => 'organization',
'label' => 'Organization',
'options' => $options,
];
}
return [
'id' => 'organization',
'label' => 'Organization',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $options,
'value' => $value,
'dependencies' => [
'teams',
'deal_stage_at_call',
'current_deal_stage',
'recipients',
ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,
],
'dependsOn' => [],
];
}
// Teams = Groups
public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array
{
if ($shortVersion) {
return [
'id' => 'teams',
'label' => 'Team',
'options' => $options,
];
}
return [
'id' => 'teams',
'label' => 'Team',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => false,
'placeholder' => 'Select',
'options' => $options,
'value' => $value, // value should be an array of objects {id, name}
'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],
'dependsOn' => [],
];
}
public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array
{
$types = [];
if ($team instanceof Team) {
if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
$types = self::TYPES;
}
if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {
$types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];
}
} else {
$types = self::TYPES;
}
if ($shortVersion) {
return [
'id' => 'report_type',
'label' => 'Report Type',
'options' => $types,
];
}
return [
'id' => 'report_type',
'label' => 'Report Type',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $types,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getFrequencyFieldData(?string $value = null): array
{
return [
'id' => 'frequency',
'label' => 'Frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => self::FREQUENCIES,
'value' => $value,
'dependencies' => ['period'],
'dependsOn' => [],
];
}
public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array
{
return [
'id' => 'period',
'label' => 'Select one-off period',
'inputType' => InputTypeEnum::DATE_RANGE,
'required' => true,
'placeholder' => 'Select',
'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],
'queryParams' => [
'startDate' => 'start_date_period',
'endDate' => 'end_date_period',
],
'dependencies' => [],
'dependsOn' => ['frequency'],
];
}
public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array
{
return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);
}
public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);
}
public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);
}
public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'deal_value',
'label' => 'Deal Value',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_deal_value',
'max' => 'max_deal_value',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array
{
$value = [];
$conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;
$dialerOn && $value[] = self::CALL_TYPE_DIALER;
return [
'id' => 'call_type',
'label' => 'Call Type',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => [
self::CALL_TYPE_CONFERENCE,
self::CALL_TYPE_DIALER,
],
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getMediaTypeFieldData(?AutomatedReport $report = null): array
{
$value = [];
if ($report) {
$value = $this->transformMediaTypes($report);
}
return [
'id' => 'media_types',
'label' => 'Export as',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => self::MEDIA_TYPE_OBJECTS,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'call_duration',
'label' => 'Call Duration',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_call_duration',
'max' => 'max_call_duration',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getRecipientsFieldData(?Team $team = null, array $value = []): array
{
return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);
}
public function getJiminnyRecipientsFieldData(array $value = []): array
{
return $this->recipientsService->getJiminnyRecipientsFieldData($value);
}
public function getAdditionalPromptInputFieldData(?string $value = null): array
{
return [
'id' => 'additional_prompt_input',
'label' => 'Special requirements',
'inputType' => InputTypeEnum::TEXTAREA,
'required' => false,
'placeholder' => 'What should be the focus of the report?',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCustomReportNameFieldData(?string $value = null): array
{
return [
'id' => 'custom_name',
'label' => 'Custom report name',
'inputType' => InputTypeEnum::TEXT,
'required' => false,
'placeholder' => 'Enter custom name',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
// data providers
public function getTeams(): array
{
$teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);
$teamData = [];
foreach ($teams as $team) {
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
continue;
}
$teamData[] = $this->transformTeam($team);
}
return $teamData;
}
public function getTeamGroups(string $teamUuid): array
{
$data = [];
$team = $this->getTeam($teamUuid);
if ($team !== null) {
$groups = $team->groups()->get();
foreach ($groups as $group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
];
}
}
return $data;
}
public function getTeamsGroupsOptions(array $filterTeamUuids = []): array
{
$data = [];
$teams = $this->getTeams();
foreach ($teams as $team) {
if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {
continue;
}
$data[] = [
'label' => $team['name'],
'groups' => $this->getTeamGroups($team['id']),
];
}
return $data;
}
public function getTeam(string $teamUuid): ?Team
{
return $this->teamRepository->idOrUuid($teamUuid);
}
public function getTeamById(int $teamId): ?Team
{
return $this->teamRepository->find($teamId);
}
public function getGroupsUuids(AutomatedReport $report): array
{
$uuids = [];
$reportGroups = $report->getGroups();
foreach ($reportGroups as $groupId) {
if ($group = $this->groupRepository->find($groupId)) {
$uuids[] = $group->getUuid();
}
}
return $uuids;
}
public function getPlaybookCategoriesUuids(AutomatedReport $report): array
{
$uuids = [];
$playbookCategories = $report->getPlaybookCategories();
foreach ($playbookCategories as $id) {
if ($category = $this->playbookCategoryRepository->find($id)) {
$uuids[] = $category->getUuid();
}
}
return $uuids;
}
public function getDealAtCallStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getDealAtCallStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getCurrentDealStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getCurrentDealStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getRecipients());
}
public function getJiminnyUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function extractUserUuids(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => $user->getUuid())
->values()
->all();
}
// get mail data
public function getRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getRecipients());
}
/**
* @return array<UserContract>
*/
public function getRecipientUserObjects(AutomatedReport $report): array
{
$userIds = $report->getRecipients()['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->values()
->all();
}
private function getJiminnyRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function buildRecipientUsers(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => [
'email' => $user->getEmailAddress(),
'name' => $user->getName(),
'timezone' => $user->getTimezone()->getName(),
])
->values()
->all();
}
public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array
{
if ($report->isAskJiminnyReport()) {
$recipients = $this->resolveAskJiminnyRecipients($report);
} else {
$recipients = $this->getRecipientUsers($report);
if ($includeJiminny) {
$recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));
}
}
$emails = [];
return array_values(array_filter(
$recipients,
static function ($recipient) use (&$emails) {
if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {
return false;
}
$emails[] = $recipient['email'];
return true;
}
));
}
private function resolveAskJiminnyRecipients(AutomatedReport $report): array
{
$recipients = [];
$creator = $report->getCreator();
if ($creator !== null) {
$recipients[] = [
'email' => $creator->getEmailAddress(),
'name' => $creator->getName(),
'timezone' => $creator->getTimezone()->getName(),
];
}
return array_merge(
$recipients,
$this->buildRecipientUsers($report->getRecipients()),
$this->getGroupRecipientUsers($report),
);
}
private function getGroupRecipientUsers(AutomatedReport $report): array
{
$users = [];
foreach ($report->getGroups() as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group === null) {
continue;
}
foreach ($group->getMembers() as $member) {
$users[] = [
'email' => $member->getEmailAddress(),
'name' => $member->getName(),
'timezone' => $member->getTimezone()->getName(),
];
}
}
return $users;
}
public function getReportTypeName(AutomatedReportResult $report): string
{
$type = $report->getReport()->getType();
$getType = $this->transformReportType($type);
return $getType['name'];
}
public function getReportPeriodName(AutomatedReportResult $report): string
{
$from = $report->getFromDate();
$to = $report->getToDate();
$frequency = $report->getReport()->getFrequency();
if ($from === null || $to === null) {
if (! $report->getReport()->isAskJiminnyReport()) {
$invalidPeriod = $from === null ? 'from' : 'to';
throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);
}
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
}
return $this->formatReportPeriodName($frequency, $from, $to);
}
private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string
{
$fromYear = $from->format('Y');
$toYear = $to->format('Y');
$differentYears = $fromYear !== $toYear;
switch ($frequency) {
case self::FREQUENCY_DAILY:
return $from->format('j M Y');
case self::FREQUENCY_QUARTERLY:
// 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ
$startMonth = $from->format('M');
$endMonth = $to->copy()->subMonth();
$endMonthName = $endMonth->format('M');
$endMonthYear = $endMonth->format('Y');
if ($differentYears) {
return "{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}";
}
return "{$startMonth} - {$endMonthName} {$toYear}";
case self::FREQUENCY_MONTHLY:
// 'May 2025' - monthly reports are always within the same year
return $from->format('M Y');
case self::FREQUENCY_WEEKLY:
// '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ
$startDay = $from->format('j');
$endDay = $to->format('j');
$startMonth = $from->format('M');
$endMonth = $to->format('M');
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
if ($startMonth !== $endMonth) {
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
}
return "{$startDay} - {$endDay} {$endMonth} {$toYear}";
case self::FREQUENCY_ONE_OFF:
// '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ
$startDay = $from->format('j');
$startMonth = $from->format('M');
$endDay = $to->format('j');
$endMonth = $to->format('M');
// If same month and year, use a format like '2-31 May 2025'
if ($startMonth === $endMonth && ! $differentYears) {
return "{$startDay} - {$endDay} {$startMonth} {$toYear}";
}
// If different years, include both years
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
// Same year but different months
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
default:
// Default format for unknown frequencies
return $from->format('j M Y') . ' - ' . $to->format('j M Y');
}
}
public function getReportTeamsName(AutomatedReportResult $report): string
{
$groups = $report->getGroups();
if (empty($groups)) {
return 'All';
}
// Get group names from repository
$groupNames = [];
foreach ($groups as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group) {
$groupNames[] = $group->getName();
}
}
if (count($groupNames) === 1) {
// Single team format
$teamsName = $groupNames[0];
} else {
// Multiple teams format
$teamsName = implode(', ', $groupNames);
}
return $teamsName;
}
public function getReportFileName(AutomatedReportResult $report): string
{
$customName = $report->getReport()->getCustomName();
$periodName = $this->getReportPeriodName($report);
$filenameSuffix = $this->getFilenameSuffix($report);
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$customName} - {$periodName}");
}
$baseName = $this->getReportTypeName($report);
if ($filenameSuffix) {
$baseName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}");
}
public function getReportFileNameWithExtension(AutomatedReportResult $result): string
{
$extension = $this->getMediaTypeMetadata($result)['extension'];
return $this->getReportFileName($result) . '.' . $extension;
}
public function sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool
{
$recipients = array_map('intval', $report->getRecipients()['users'] ?? []);
return in_array($user->getId(), $recipients);
}
public function transformReportResults(Collection $automatedReportResults): array
{
$data = [];
foreach ($automatedReportResults as $automatedReportResult) {
/** @var AutomatedReportResult $automatedReportResult */
$report = $automatedReportResult->getReport();
$createdBy = $report->getCreator();
$creator = [
'id' => $createdBy?->getUuid(),
'name' => $createdBy?->getName(),
'email' => $createdBy?->getEmailAddress(),
'photoUrl' => $createdBy?->getPhotoUrl(),
];
$data[] = [
'id' => $automatedReportResult->getUuid(),
'name' => $automatedReportResult->getName(),
'frequency' => $this->transformFrequency($report->getFrequency()),
'recipients' => $this->buildRecipients($report),
'report_type' => $this->transformReportType($report->getType()),
'media_type' => $automatedReportResult->getMediaType(),
'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),
'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),
'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),
'creator' => $creator,
];
}
return $data;
}
private function buildRecipients(AutomatedReport $report): array
{
$creatorUuid = $report->getCreator()?->getUuid();
$recipients = array_values(array_filter(
$this->transformRecipients($report->getRecipients()),
static fn (array $recipient): bool => $recipient['id'] !== $creatorUuid,
));
if (! $report->isAskJiminnyReport()) {
return $recipients;
}
return [
...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),
...$recipients,
];
}
public function hasCallTypeConference(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);
}
public function hasCallTypeDialer(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);
}
// transformers
private function transformTeam(Team $team): array
{
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
return [];
}
return [
'id' => $team->getUuid(),
'name' => $team->getName(),
];
}
private function transformReportFullView(AutomatedReport $report): array
{
$base = $this->transformReportBase($report);
return $report->getType() === self::TYPE_ASK_JIMINNY
? $base + $this->transformAskJiminnyFields($report)
: $base + $this->transformStandardReportFields($report);
}
private function transformReportBase(AutomatedReport $report): array
{
return [
'id' => $report->getUuid(),
'organization' => $this->transformOrganization(team: $report->getTeam()),
'report_type' => $this->transformReportType($report->getType()),
'frequency' => $this->transformFrequency($report->getFrequency()),
];
}
private function transformStandardReportFields(AutomatedReport $report): array
{
$team = $report->getTeam();
return [
'report_enabled' => $report->getStatus(),
'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),
'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),
'deal_value_min' => $report->getDealValueMin(),
'deal_value_max' => $report->getDealValueMax(),
'call_types' => $this->transformCallType($report->getCallTypes()),
'media_types' => $this->transformMediaTypes($report),
'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),
'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),
'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),
'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),
'recipients' => $this->transformRecipients($report->getRecipients()),
'created_by' => $this->transformCreator($report->getCreator()),
'additional_prompt_input' => $report->getAdditionalPromptInput(),
'custom_name' => $report->getCustomName(),
'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),
'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),
'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),
];
}
private function transformAskJiminnyFields(AutomatedReport $report): array
{
$team = $report->getTeam();
$creatorId = $report->getAttribute('created_by');
$explicitUserIds = array_values(array_filter(
$report->getRecipients()['users'] ?? [],
static fn ($id) => $id !== $creatorId
));
return [
'report_name' => $report->getCustomName(),
'enabled' => $report->getStatus(),
'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),
'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),
'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),
'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),
];
}
private function transformOrganization(?Team $team): array
{
return [
'id' => $team?->getUuid(),
'name' => $team?->getName(),
];
}
private function transformReportType(string $type): array
{
foreach (self::ALL_TYPES as $typeItem) {
if ($typeItem['id'] === $type) {
return $typeItem;
}
}
return [];
}
private function transformCallType(array $types): array
{
$result = [];
$callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];
foreach ($types as $type) {
foreach ($callTypes as $callTypeItem) {
if ($callTypeItem['id'] === $type) {
$result[] = $callTypeItem;
break;
}
}
}
return $result;
}
private function transformMediaTypes(AutomatedReport $report): array
{
$values = [];
foreach ($report->getMediaTypes() as $mediaType) {
if (! in_array($mediaType, self::MEDIA_TYPES, true)) {
continue;
}
$values[] = match ($mediaType) {
self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,
self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,
};
}
return $values;
}
private function transformFrequency(string $frequency): array
{
foreach (self::ALL_FREQUENCIES as $frequencyItem) {
if ($frequencyItem['id'] === $frequency) {
return $frequencyItem;
}
}
return [];
}
public function transformDurationToMinutes(?int $duration): ?int
{
if (! $duration) {
return null;
}
return (int) ($duration / 60);
}
private function transformGroups(?Team $team, array $groupsIds): array
{
if (empty($groupsIds) || ! $team) {
return [];
}
$data = [];
foreach ($groupsIds as $groupId) {
$group = $team->groups()->where('id', $groupId)->first();
if ($group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
'photoUrl' => $group->getPhotoUrl(),
];
}
}
return $data;
}
private function transformStages(?Team $team, array $stagesIds): array
{
if (empty($stagesIds) || ! $team) {
return [];
}
$data = [];
foreach ($stagesIds as $stageId) {
$stage = $team->stages()->where('id', $stageId)->first();
if ($stage) {
$data[] = [
'id' => $stage->getUuid(),
'name' => $stage->getName(),
];
}
}
return $data;
}
private function transformRecipients(array $recipients): array
{
$users = [];
foreach ($recipients['users'] ?? [] as $userId) {
$users[] = $this->transformUser($userId);
}
return $users;
}
private function transformCreator(?User $user): ?array
{
if ($user === null) {
return null;
}
return $this->transformUser($user->getId());
}
private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array
{
if ($prompt === null) {
return null;
}
return [
'id' => $prompt->getUuid(),
'name' => $prompt->getTitle(),
];
}
private function transformSafeSearch(?Search $search): ?array
{
if ($search === null) {
return null;
}
return [
'id' => $search->getUuid(),
'name' => $search->getName(),
];
}
private function transformUser(int $userId): array
{
/* @var ?User $user */
$user = $this->userRepository->find($userId);
return [
'id' => $user?->getUuid(),
'name' => $user?->getName(),
'email' => $user?->getEmailAddress(),
'photoUrl' => $user?->getPhotoUrl(),
];
}
public function create(array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$validatedData['created_by'] = auth()->id();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
public function update(string $uuid, array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$report = $this->automatedReportsRepository->findByUuid($uuid);
if (! $report) {
throw new InvalidArgumentException('Report not found');
}
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
/**
* Create an Ask Jiminny report.
*/
public function createAskJiminnyReport(array $data, User $creator): array
{
$validatedData = $this->validateAskJiminnyReportData($data, $creator);
$validatedData['created_by'] = $creator->getId();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
return $this->transformReportFullView($automatedReport);
}
/**
* Update an Ask Jiminny report.
*/
public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array
{
if (! $report->isAskJiminnyReport()) {
throw new InvalidArgumentException('Report is not an Ask Jiminny report');
}
$validatedData = $this->validateAskJiminnyReportData($data, $user);
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
return $this->transformReportFullView($automatedReport);
}
public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array
{
$this->automatedReportsRepository->update($report, ['status' => $status]);
return $this->transformReportFullView($report->fresh());
}
/**
* Validate and transform data for Ask Jiminny reports.
*/
private function validateAskJiminnyReportData(array $data, User $user): array
{
// Validate name
$name = trim($data['report_name'] ?? '');
if (empty($name)) {
throw new InvalidArgumentException('Report name is required');
}
if (mb_strlen($name) > 50) {
throw new InvalidArgumentException('Report name must be 50 characters or less');
}
// Validate frequency (only daily, weekly, monthly for Ask Jiminny)
$frequency = $data['frequency'] ?? null;
$askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];
if (! in_array($frequency, $askJiminnyFrequencies, true)) {
throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');
}
// Validate expiration date
$expiresAt = $data['expires_on'] ?? null;
if (empty($expiresAt)) {
throw new InvalidArgumentException('Expiration date is required');
}
try {
$expiresAtDate = Carbon::parse($expiresAt);
} catch (InvalidFormatException $e) {
throw new InvalidArgumentException('Expiration date format is invalid');
}
$maxExpiration = Carbon::now()->addYear()->endOfDay();
if ($expiresAtDate->gt($maxExpiration)) {
throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');
}
if ($expiresAtDate->isPast()) {
throw new InvalidArgumentException('Expiration date cannot be in the past');
}
// Validate saved search
$activitySearchId = $data['saved_search'] ?? null;
if (empty($activitySearchId)) {
throw new InvalidArgumentException('Saved search is required');
}
$savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);
if (! $savedSearch) {
throw new InvalidArgumentException('Saved search not found or does not belong to you');
}
// Validate saved prompt
$askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;
if (empty($askAnythingPromptId)) {
throw new InvalidArgumentException('Ask Jiminny prompt is required');
}
$prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);
if (! $prompt) {
throw new InvalidArgumentException('Ask Jiminny prompt not found');
}
// Validate status
$status = $data['enabled'] ?? false;
$recipientUserIds = [$user->getId()];
if (! empty($data['share_users'])) {
$sharedUserIds = $this->validateAndGetUserIdsByTeam(
$user->team,
(array) $data['share_users']
);
$recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);
}
$sharedGroupIds = [];
if (! empty($data['share_teams'])) {
$sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);
}
$recipientUserIds = array_values(array_unique($recipientUserIds));
return [
'team_id' => $user->getTeamId(),
'type' => self::TYPE_ASK_JIMINNY,
'status' => (bool) $status,
'frequency' => $frequency,
'custom_name' => $name,
'activity_search_id' => $savedSearch->getId(),
'ask_anything_prompt_id' => $prompt->getId(),
'expires_at' => $expiresAtDate->toDateString(),
'media_types' => [self::MEDIA_TYPE_PDF],
'call_types' => [],
'recipients' => ['users' => $recipientUserIds],
'groups' => $sharedGroupIds,
];
}
public static function getAskJiminnyFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::ASK_JIMINNY_FREQUENCIES);
}
public function getAskJiminnyReportFilters(User $user): array
{
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
return [
[
'id' => 'prompt',
'label' => 'Prompt',
'options' => $prompts,
],
[
'id' => 'saved_search',
'label' => 'Saved Search',
'options' => $savedSearches,
],
];
}
public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array
{
$team = $user->getTeam();
$userTimezone = $user->getTimezone();
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
$teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [
'id' => $group->getUuid(),
'name' => $group->getName(),
])->values()->all();
$shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];
$sharedTeamsValue = [];
$sharedUsersValue = [];
if ($report) {
$sharedTeamsValue = $this->transformGroups($team, $report->getGroups());
$recipientUserIds = $report->getRecipients()['users'] ?? [];
$creatorId = $report->getAttribute('created_by');
$sharedUserIds = array_values(array_filter(
$recipientUserIds,
static fn ($id) => $id !== $creatorId
));
$sharedUsersValue = collect($sharedUserIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (User $u) => [
'id' => $u->getUuid(),
'name' => $u->getName(),
])
->values()
->all();
}
return [
'fields' => [
[
'id' => 'enabled',
'inputType' => InputTypeEnum::TOGGLE,
'label' => '',
'value' => $report?->getStatus() ?? false,
],
[
'id' => 'report_name',
'inputType' => InputTypeEnum::TEXT,
'label' => 'Name',
'placeholder' => 'Enter name',
'required' => true,
'validation' => ['maxLength' => 50],
'value' => $report?->getCustomName() ?? '',
],
[
'id' => 'frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'label' => 'Frequency',
'required' => true,
'placeholder' => 'Select',
'options' => self::ASK_JIMINNY_FREQUENCIES,
'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,
],
[
'id' => 'expires_on',
'inputType' => InputTypeEnum::DATE,
'label' => 'Expires on',
'required' => true,
'placeholder' => 'Select',
'validation' => [
'minDate' => now($userTimezone)->toDateString(),
'maxDate' => n...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"#11894 on JY-18909-automated-reports-ask-jiminny, menu","depth":5,"help_text":"Pull request #11894 exists for current branch JY-18909-automated-reports-ask-jiminny","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AutomatedReportsRepositoryTest","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AutomatedReportsRepositoryTest'","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AutomatedReportsRepositoryTest'","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"102","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.025,"height":0.02111111},"role_description":"text"},{"role":"AXStaticText","text":"3","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.016666668,"height":0.02111111},"role_description":"text"},{"role":"AXStaticText","text":"34","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.021527778,"height":0.02111111},"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.025555555},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.014583333,"height":0.025555555},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Kiosk\\AutomatedReports;\n\nuse Carbon\\CarbonImmutable;\nuse Carbon\\CarbonInterface;\nuse Carbon\\Exceptions\\InvalidFormatException;\nuse DateTime;\nuse DateTimeInterface;\nuse DateTimeZone;\nuse Illuminate\\Contracts\\Bus\\Dispatcher as BusDispatcher;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Support\\Facades\\Log;\nuse Illuminate\\Support\\Facades\\Storage;\nuse Jiminny\\Component\\ActivitySearch\\FilterDefinition\\InputTypeEnum;\nuse Jiminny\\Component\\AskAnything\\AskAnythingPromptService;\nuse Jiminny\\Component\\AskAnything\\Dtos\\AskAnythingPromptDto;\nuse Jiminny\\Component\\UrlGenerator\\Webhook;\nuse Jiminny\\Contracts\\Repositories\\PlaybookCategoryRepository;\nuse Jiminny\\Contracts\\Repositories\\TeamRepository;\nuse Jiminny\\Contracts\\Repositories\\UserRepository;\nuse Jiminny\\Exceptions\\ApplicationException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Exceptions\\ModelNotFoundException;\nuse Jiminny\\Jobs\\AutomatedReports\\RequestGenerateReportJob;\nuse Jiminny\\Models\\Activity\\Search;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPrompt;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPromptTarget;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Contracts\\UserContract;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Repositories\\AskAnythingRepository;\nuse Jiminny\\Repositories\\AutomatedReportsRepository;\nuse Jiminny\\Repositories\\GroupRepository;\nuse Jiminny\\Repositories\\SearchRepository;\nuse Jiminny\\Repositories\\StageRepository;\nuse Throwable;\n\nclass AutomatedReportsService\n{\n public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';\n public const string TYPE_ASK_JIMINNY = 'ask_jiminny';\n\n /**\n * Standard report types (used by kiosk for existing automated reports).\n */\n // @TODO this will add filter, however if we need to control feature by FF we need conditional logic\n public const array TYPES = [\n ['id' => 'exec_summary', 'name' => 'Exec Summary'],\n ['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],\n ['id' => 'product_feedback', 'name' => 'Product Feedback'],\n ['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],\n// ['id' => 'questions', 'name' => 'Questions'],\n// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],\n ];\n\n public const array ALL_TYPES = [\n ...self::TYPES,\n ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],\n ];\n\n public const string FREQUENCY_DAILY = 'daily';\n public const string FREQUENCY_WEEKLY = 'weekly';\n public const string FREQUENCY_MONTHLY = 'monthly';\n public const string FREQUENCY_QUARTERLY = 'quarterly';\n public const string FREQUENCY_ONE_OFF = 'one_off';\n\n /**\n * Frequencies for standard (non-Ask Jiminny) reports.\n */\n public const array FREQUENCIES = [\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n\n /**\n * Frequencies for Ask Jiminny reports.\n */\n public const array ASK_JIMINNY_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ];\n\n public const string MEDIA_TYPE_PDF = 'pdf';\n public const string MEDIA_TYPE_PODCAST = 'podcast';\n public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];\n public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];\n public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];\n public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];\n\n public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];\n public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];\n public const int SENT_REPORT_AT_HOURS = 5;\n public const string PDF_KEY = 'pdf';\n public const string AUDIO_KEY = 'audio';\n\n private const array ALL_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n private const string S3_DIR = 'reports';\n private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];\n private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];\n\n public function __construct(\n private readonly TeamRepository $teamRepository,\n private readonly GroupRepository $groupRepository,\n private readonly UserRepository $userRepository,\n private readonly StageRepository $stageRepository,\n private readonly DealStagesService $dealStagesService,\n private readonly RecipientsService $recipientsService,\n private readonly AutomatedReportsRepository $automatedReportsRepository,\n private readonly Webhook $webhookService,\n private readonly BusDispatcher $dispatcher,\n private readonly ActivityTypeService $activityTypeService,\n private readonly PlaybookCategoryRepository $playbookCategoryRepository,\n private readonly AskAnythingPromptService $askAnythingPromptService,\n private readonly SearchRepository $activitySearchRepository,\n private readonly AskAnythingRepository $askAnythingRepository,\n ) {\n }\n\n public static function getTypes(): array\n {\n $types = self::TYPES;\n\n return array_map(static function ($type) {\n return $type['id'];\n }, $types);\n }\n\n public static function getCallTypes(): array\n {\n return array_map(static function ($callType) {\n return $callType['id'];\n }, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);\n }\n\n public static function getFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::FREQUENCIES);\n }\n\n // front-facing structure\n public function getReportEnabledFieldData(bool $value = false): array\n {\n return [\n 'id' => 'report_enabled',\n 'label' => '',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'value' => $value,\n ];\n }\n\n // Organizations = Teams\n public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array\n {\n $options = $this->getTeams();\n\n if ($shortVersion) {\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value,\n 'dependencies' => [\n 'teams',\n 'deal_stage_at_call',\n 'current_deal_stage',\n 'recipients',\n ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,\n ],\n 'dependsOn' => [],\n ];\n }\n\n // Teams = Groups\n public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array\n {\n if ($shortVersion) {\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value, // value should be an array of objects {id, name}\n 'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],\n 'dependsOn' => [],\n ];\n }\n\n public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array\n {\n $types = [];\n if ($team instanceof Team) {\n if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n $types = self::TYPES;\n }\n if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {\n $types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];\n }\n } else {\n $types = self::TYPES;\n }\n\n if ($shortVersion) {\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'options' => $types,\n ];\n }\n\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $types,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getFrequencyFieldData(?string $value = null): array\n {\n return [\n 'id' => 'frequency',\n 'label' => 'Frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::FREQUENCIES,\n 'value' => $value,\n 'dependencies' => ['period'],\n 'dependsOn' => [],\n ];\n }\n\n public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array\n {\n return [\n 'id' => 'period',\n 'label' => 'Select one-off period',\n 'inputType' => InputTypeEnum::DATE_RANGE,\n 'required' => true,\n 'placeholder' => 'Select',\n 'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],\n 'queryParams' => [\n 'startDate' => 'start_date_period',\n 'endDate' => 'end_date_period',\n ],\n 'dependencies' => [],\n 'dependsOn' => ['frequency'],\n ];\n }\n\n public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array\n {\n return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);\n }\n\n public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);\n }\n\n public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);\n }\n\n public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'deal_value',\n 'label' => 'Deal Value',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_deal_value',\n 'max' => 'max_deal_value',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array\n {\n $value = [];\n $conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;\n $dialerOn && $value[] = self::CALL_TYPE_DIALER;\n\n return [\n 'id' => 'call_type',\n 'label' => 'Call Type',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => [\n self::CALL_TYPE_CONFERENCE,\n self::CALL_TYPE_DIALER,\n ],\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getMediaTypeFieldData(?AutomatedReport $report = null): array\n {\n $value = [];\n\n if ($report) {\n $value = $this->transformMediaTypes($report);\n }\n\n return [\n 'id' => 'media_types',\n 'label' => 'Export as',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => self::MEDIA_TYPE_OBJECTS,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'call_duration',\n 'label' => 'Call Duration',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_call_duration',\n 'max' => 'max_call_duration',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getRecipientsFieldData(?Team $team = null, array $value = []): array\n {\n return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);\n }\n\n public function getJiminnyRecipientsFieldData(array $value = []): array\n {\n return $this->recipientsService->getJiminnyRecipientsFieldData($value);\n }\n\n public function getAdditionalPromptInputFieldData(?string $value = null): array\n {\n return [\n 'id' => 'additional_prompt_input',\n 'label' => 'Special requirements',\n 'inputType' => InputTypeEnum::TEXTAREA,\n 'required' => false,\n 'placeholder' => 'What should be the focus of the report?',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCustomReportNameFieldData(?string $value = null): array\n {\n return [\n 'id' => 'custom_name',\n 'label' => 'Custom report name',\n 'inputType' => InputTypeEnum::TEXT,\n 'required' => false,\n 'placeholder' => 'Enter custom name',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n // data providers\n public function getTeams(): array\n {\n $teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);\n\n $teamData = [];\n foreach ($teams as $team) {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n continue;\n }\n\n $teamData[] = $this->transformTeam($team);\n }\n\n return $teamData;\n }\n\n public function getTeamGroups(string $teamUuid): array\n {\n $data = [];\n $team = $this->getTeam($teamUuid);\n\n if ($team !== null) {\n $groups = $team->groups()->get();\n\n foreach ($groups as $group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n public function getTeamsGroupsOptions(array $filterTeamUuids = []): array\n {\n $data = [];\n $teams = $this->getTeams();\n\n foreach ($teams as $team) {\n if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {\n continue;\n }\n\n $data[] = [\n 'label' => $team['name'],\n 'groups' => $this->getTeamGroups($team['id']),\n ];\n }\n\n return $data;\n }\n\n public function getTeam(string $teamUuid): ?Team\n {\n return $this->teamRepository->idOrUuid($teamUuid);\n }\n\n public function getTeamById(int $teamId): ?Team\n {\n return $this->teamRepository->find($teamId);\n }\n\n public function getGroupsUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportGroups = $report->getGroups();\n foreach ($reportGroups as $groupId) {\n if ($group = $this->groupRepository->find($groupId)) {\n $uuids[] = $group->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getPlaybookCategoriesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $playbookCategories = $report->getPlaybookCategories();\n foreach ($playbookCategories as $id) {\n if ($category = $this->playbookCategoryRepository->find($id)) {\n $uuids[] = $category->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getDealAtCallStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getDealAtCallStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getCurrentDealStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getCurrentDealStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getRecipients());\n }\n\n public function getJiminnyUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function extractUserUuids(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => $user->getUuid())\n ->values()\n ->all();\n }\n\n // get mail data\n public function getRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getRecipients());\n }\n\n /**\n * @return array<UserContract>\n */\n public function getRecipientUserObjects(AutomatedReport $report): array\n {\n $userIds = $report->getRecipients()['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->values()\n ->all();\n }\n\n private function getJiminnyRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function buildRecipientUsers(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => [\n 'email' => $user->getEmailAddress(),\n 'name' => $user->getName(),\n 'timezone' => $user->getTimezone()->getName(),\n ])\n ->values()\n ->all();\n }\n\n public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array\n {\n if ($report->isAskJiminnyReport()) {\n $recipients = $this->resolveAskJiminnyRecipients($report);\n } else {\n $recipients = $this->getRecipientUsers($report);\n if ($includeJiminny) {\n $recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));\n }\n }\n\n $emails = [];\n\n return array_values(array_filter(\n $recipients,\n static function ($recipient) use (&$emails) {\n if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {\n return false;\n }\n $emails[] = $recipient['email'];\n\n return true;\n }\n ));\n }\n\n private function resolveAskJiminnyRecipients(AutomatedReport $report): array\n {\n $recipients = [];\n\n $creator = $report->getCreator();\n if ($creator !== null) {\n $recipients[] = [\n 'email' => $creator->getEmailAddress(),\n 'name' => $creator->getName(),\n 'timezone' => $creator->getTimezone()->getName(),\n ];\n }\n\n return array_merge(\n $recipients,\n $this->buildRecipientUsers($report->getRecipients()),\n $this->getGroupRecipientUsers($report),\n );\n }\n\n private function getGroupRecipientUsers(AutomatedReport $report): array\n {\n $users = [];\n foreach ($report->getGroups() as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group === null) {\n continue;\n }\n foreach ($group->getMembers() as $member) {\n $users[] = [\n 'email' => $member->getEmailAddress(),\n 'name' => $member->getName(),\n 'timezone' => $member->getTimezone()->getName(),\n ];\n }\n }\n\n return $users;\n }\n\n public function getReportTypeName(AutomatedReportResult $report): string\n {\n $type = $report->getReport()->getType();\n\n $getType = $this->transformReportType($type);\n\n return $getType['name'];\n }\n\n public function getReportPeriodName(AutomatedReportResult $report): string\n {\n $from = $report->getFromDate();\n $to = $report->getToDate();\n $frequency = $report->getReport()->getFrequency();\n\n if ($from === null || $to === null) {\n if (! $report->getReport()->isAskJiminnyReport()) {\n $invalidPeriod = $from === null ? 'from' : 'to';\n\n throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);\n }\n\n $period = $this->calculateFromAndToDatePeriod($frequency);\n $from = $period['fromDate'];\n $to = $period['toDate'];\n }\n\n return $this->formatReportPeriodName($frequency, $from, $to);\n }\n\n private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string\n {\n $fromYear = $from->format('Y');\n $toYear = $to->format('Y');\n $differentYears = $fromYear !== $toYear;\n\n switch ($frequency) {\n case self::FREQUENCY_DAILY:\n return $from->format('j M Y');\n\n case self::FREQUENCY_QUARTERLY:\n // 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ\n $startMonth = $from->format('M');\n $endMonth = $to->copy()->subMonth();\n $endMonthName = $endMonth->format('M');\n $endMonthYear = $endMonth->format('Y');\n\n if ($differentYears) {\n return \"{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}\";\n }\n\n return \"{$startMonth} - {$endMonthName} {$toYear}\";\n\n case self::FREQUENCY_MONTHLY:\n // 'May 2025' - monthly reports are always within the same year\n return $from->format('M Y');\n\n case self::FREQUENCY_WEEKLY:\n // '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ\n $startDay = $from->format('j');\n $endDay = $to->format('j');\n $startMonth = $from->format('M');\n $endMonth = $to->format('M');\n\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n if ($startMonth !== $endMonth) {\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n return \"{$startDay} - {$endDay} {$endMonth} {$toYear}\";\n\n case self::FREQUENCY_ONE_OFF:\n // '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ\n $startDay = $from->format('j');\n $startMonth = $from->format('M');\n $endDay = $to->format('j');\n $endMonth = $to->format('M');\n\n // If same month and year, use a format like '2-31 May 2025'\n if ($startMonth === $endMonth && ! $differentYears) {\n return \"{$startDay} - {$endDay} {$startMonth} {$toYear}\";\n }\n\n // If different years, include both years\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n // Same year but different months\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n\n default:\n // Default format for unknown frequencies\n return $from->format('j M Y') . ' - ' . $to->format('j M Y');\n }\n }\n\n public function getReportTeamsName(AutomatedReportResult $report): string\n {\n $groups = $report->getGroups();\n\n if (empty($groups)) {\n return 'All';\n }\n\n // Get group names from repository\n $groupNames = [];\n foreach ($groups as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group) {\n $groupNames[] = $group->getName();\n }\n }\n\n if (count($groupNames) === 1) {\n // Single team format\n $teamsName = $groupNames[0];\n } else {\n // Multiple teams format\n $teamsName = implode(', ', $groupNames);\n }\n\n return $teamsName;\n }\n\n public function getReportFileName(AutomatedReportResult $report): string\n {\n $customName = $report->getReport()->getCustomName();\n $periodName = $this->getReportPeriodName($report);\n $filenameSuffix = $this->getFilenameSuffix($report);\n\n if ($customName) {\n if ($filenameSuffix) {\n $customName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$customName} - {$periodName}\");\n }\n\n $baseName = $this->getReportTypeName($report);\n\n if ($filenameSuffix) {\n $baseName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}\");\n }\n\n public function getReportFileNameWithExtension(AutomatedReportResult $result): string\n {\n $extension = $this->getMediaTypeMetadata($result)['extension'];\n\n return $this->getReportFileName($result) . '.' . $extension;\n }\n\n public function sanitizeFileName(string $fileName): string\n {\n return str_replace(['/', '\\\\'], '-', $fileName);\n }\n\n public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool\n {\n $recipients = array_map('intval', $report->getRecipients()['users'] ?? []);\n\n return in_array($user->getId(), $recipients);\n }\n\n public function transformReportResults(Collection $automatedReportResults): array\n {\n $data = [];\n foreach ($automatedReportResults as $automatedReportResult) {\n /** @var AutomatedReportResult $automatedReportResult */\n\n $report = $automatedReportResult->getReport();\n\n $createdBy = $report->getCreator();\n $creator = [\n 'id' => $createdBy?->getUuid(),\n 'name' => $createdBy?->getName(),\n 'email' => $createdBy?->getEmailAddress(),\n 'photoUrl' => $createdBy?->getPhotoUrl(),\n ];\n\n $data[] = [\n 'id' => $automatedReportResult->getUuid(),\n 'name' => $automatedReportResult->getName(),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n 'recipients' => $this->buildRecipients($report),\n 'report_type' => $this->transformReportType($report->getType()),\n 'media_type' => $automatedReportResult->getMediaType(),\n 'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),\n 'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),\n 'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),\n 'creator' => $creator,\n ];\n }\n\n return $data;\n }\n\n private function buildRecipients(AutomatedReport $report): array\n {\n $creatorUuid = $report->getCreator()?->getUuid();\n\n $recipients = array_values(array_filter(\n $this->transformRecipients($report->getRecipients()),\n static fn (array $recipient): bool => $recipient['id'] !== $creatorUuid,\n ));\n\n if (! $report->isAskJiminnyReport()) {\n return $recipients;\n }\n\n return [\n ...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),\n ...$recipients,\n ];\n }\n\n public function hasCallTypeConference(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);\n }\n\n public function hasCallTypeDialer(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);\n }\n\n // transformers\n private function transformTeam(Team $team): array\n {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n return [];\n }\n\n return [\n 'id' => $team->getUuid(),\n 'name' => $team->getName(),\n ];\n }\n\n private function transformReportFullView(AutomatedReport $report): array\n {\n $base = $this->transformReportBase($report);\n\n return $report->getType() === self::TYPE_ASK_JIMINNY\n ? $base + $this->transformAskJiminnyFields($report)\n : $base + $this->transformStandardReportFields($report);\n }\n\n private function transformReportBase(AutomatedReport $report): array\n {\n return [\n 'id' => $report->getUuid(),\n 'organization' => $this->transformOrganization(team: $report->getTeam()),\n 'report_type' => $this->transformReportType($report->getType()),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n ];\n }\n\n private function transformStandardReportFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n\n return [\n 'report_enabled' => $report->getStatus(),\n 'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),\n 'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),\n 'deal_value_min' => $report->getDealValueMin(),\n 'deal_value_max' => $report->getDealValueMax(),\n 'call_types' => $this->transformCallType($report->getCallTypes()),\n 'media_types' => $this->transformMediaTypes($report),\n 'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),\n 'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),\n 'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),\n 'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),\n 'recipients' => $this->transformRecipients($report->getRecipients()),\n 'created_by' => $this->transformCreator($report->getCreator()),\n 'additional_prompt_input' => $report->getAdditionalPromptInput(),\n 'custom_name' => $report->getCustomName(),\n 'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),\n 'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),\n 'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),\n ];\n }\n\n private function transformAskJiminnyFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n $creatorId = $report->getAttribute('created_by');\n $explicitUserIds = array_values(array_filter(\n $report->getRecipients()['users'] ?? [],\n static fn ($id) => $id !== $creatorId\n ));\n\n return [\n 'report_name' => $report->getCustomName(),\n 'enabled' => $report->getStatus(),\n 'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),\n 'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),\n 'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),\n 'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),\n ];\n }\n\n private function transformOrganization(?Team $team): array\n {\n return [\n 'id' => $team?->getUuid(),\n 'name' => $team?->getName(),\n ];\n }\n\n private function transformReportType(string $type): array\n {\n foreach (self::ALL_TYPES as $typeItem) {\n if ($typeItem['id'] === $type) {\n return $typeItem;\n }\n }\n\n return [];\n }\n\n private function transformCallType(array $types): array\n {\n $result = [];\n $callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];\n\n foreach ($types as $type) {\n foreach ($callTypes as $callTypeItem) {\n if ($callTypeItem['id'] === $type) {\n $result[] = $callTypeItem;\n\n break;\n }\n }\n }\n\n return $result;\n }\n\n private function transformMediaTypes(AutomatedReport $report): array\n {\n $values = [];\n\n foreach ($report->getMediaTypes() as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n continue;\n }\n\n $values[] = match ($mediaType) {\n self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,\n self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,\n };\n }\n\n return $values;\n }\n\n private function transformFrequency(string $frequency): array\n {\n foreach (self::ALL_FREQUENCIES as $frequencyItem) {\n if ($frequencyItem['id'] === $frequency) {\n return $frequencyItem;\n }\n }\n\n return [];\n }\n\n public function transformDurationToMinutes(?int $duration): ?int\n {\n if (! $duration) {\n return null;\n }\n\n return (int) ($duration / 60);\n }\n\n private function transformGroups(?Team $team, array $groupsIds): array\n {\n if (empty($groupsIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($groupsIds as $groupId) {\n $group = $team->groups()->where('id', $groupId)->first();\n\n if ($group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n 'photoUrl' => $group->getPhotoUrl(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformStages(?Team $team, array $stagesIds): array\n {\n if (empty($stagesIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($stagesIds as $stageId) {\n $stage = $team->stages()->where('id', $stageId)->first();\n\n if ($stage) {\n $data[] = [\n 'id' => $stage->getUuid(),\n 'name' => $stage->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformRecipients(array $recipients): array\n {\n $users = [];\n foreach ($recipients['users'] ?? [] as $userId) {\n $users[] = $this->transformUser($userId);\n }\n\n return $users;\n }\n\n private function transformCreator(?User $user): ?array\n {\n if ($user === null) {\n return null;\n }\n\n return $this->transformUser($user->getId());\n }\n\n private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array\n {\n if ($prompt === null) {\n return null;\n }\n\n return [\n 'id' => $prompt->getUuid(),\n 'name' => $prompt->getTitle(),\n ];\n }\n\n private function transformSafeSearch(?Search $search): ?array\n {\n if ($search === null) {\n return null;\n }\n\n return [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ];\n }\n\n private function transformUser(int $userId): array\n {\n /* @var ?User $user */\n $user = $this->userRepository->find($userId);\n\n return [\n 'id' => $user?->getUuid(),\n 'name' => $user?->getName(),\n 'email' => $user?->getEmailAddress(),\n 'photoUrl' => $user?->getPhotoUrl(),\n ];\n }\n\n public function create(array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $validatedData['created_by'] = auth()->id();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function update(string $uuid, array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $report = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $report) {\n throw new InvalidArgumentException('Report not found');\n }\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Create an Ask Jiminny report.\n */\n public function createAskJiminnyReport(array $data, User $creator): array\n {\n $validatedData = $this->validateAskJiminnyReportData($data, $creator);\n $validatedData['created_by'] = $creator->getId();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Update an Ask Jiminny report.\n */\n public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array\n {\n if (! $report->isAskJiminnyReport()) {\n throw new InvalidArgumentException('Report is not an Ask Jiminny report');\n }\n\n $validatedData = $this->validateAskJiminnyReportData($data, $user);\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array\n {\n $this->automatedReportsRepository->update($report, ['status' => $status]);\n\n return $this->transformReportFullView($report->fresh());\n }\n\n /**\n * Validate and transform data for Ask Jiminny reports.\n */\n private function validateAskJiminnyReportData(array $data, User $user): array\n {\n // Validate name\n $name = trim($data['report_name'] ?? '');\n if (empty($name)) {\n throw new InvalidArgumentException('Report name is required');\n }\n if (mb_strlen($name) > 50) {\n throw new InvalidArgumentException('Report name must be 50 characters or less');\n }\n\n // Validate frequency (only daily, weekly, monthly for Ask Jiminny)\n $frequency = $data['frequency'] ?? null;\n $askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];\n if (! in_array($frequency, $askJiminnyFrequencies, true)) {\n throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');\n }\n\n // Validate expiration date\n $expiresAt = $data['expires_on'] ?? null;\n if (empty($expiresAt)) {\n throw new InvalidArgumentException('Expiration date is required');\n }\n\n try {\n $expiresAtDate = Carbon::parse($expiresAt);\n } catch (InvalidFormatException $e) {\n throw new InvalidArgumentException('Expiration date format is invalid');\n }\n $maxExpiration = Carbon::now()->addYear()->endOfDay();\n if ($expiresAtDate->gt($maxExpiration)) {\n throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');\n }\n if ($expiresAtDate->isPast()) {\n throw new InvalidArgumentException('Expiration date cannot be in the past');\n }\n\n // Validate saved search\n $activitySearchId = $data['saved_search'] ?? null;\n if (empty($activitySearchId)) {\n throw new InvalidArgumentException('Saved search is required');\n }\n $savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);\n if (! $savedSearch) {\n throw new InvalidArgumentException('Saved search not found or does not belong to you');\n }\n\n // Validate saved prompt\n $askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;\n if (empty($askAnythingPromptId)) {\n throw new InvalidArgumentException('Ask Jiminny prompt is required');\n }\n $prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);\n if (! $prompt) {\n throw new InvalidArgumentException('Ask Jiminny prompt not found');\n }\n\n // Validate status\n $status = $data['enabled'] ?? false;\n\n $recipientUserIds = [$user->getId()];\n\n if (! empty($data['share_users'])) {\n $sharedUserIds = $this->validateAndGetUserIdsByTeam(\n $user->team,\n (array) $data['share_users']\n );\n $recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);\n }\n\n $sharedGroupIds = [];\n if (! empty($data['share_teams'])) {\n $sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);\n }\n\n $recipientUserIds = array_values(array_unique($recipientUserIds));\n\n return [\n 'team_id' => $user->getTeamId(),\n 'type' => self::TYPE_ASK_JIMINNY,\n 'status' => (bool) $status,\n 'frequency' => $frequency,\n 'custom_name' => $name,\n 'activity_search_id' => $savedSearch->getId(),\n 'ask_anything_prompt_id' => $prompt->getId(),\n 'expires_at' => $expiresAtDate->toDateString(),\n 'media_types' => [self::MEDIA_TYPE_PDF],\n 'call_types' => [],\n 'recipients' => ['users' => $recipientUserIds],\n 'groups' => $sharedGroupIds,\n ];\n }\n\n public static function getAskJiminnyFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::ASK_JIMINNY_FREQUENCIES);\n }\n\n public function getAskJiminnyReportFilters(User $user): array\n {\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n return [\n [\n 'id' => 'prompt',\n 'label' => 'Prompt',\n 'options' => $prompts,\n ],\n [\n 'id' => 'saved_search',\n 'label' => 'Saved Search',\n 'options' => $savedSearches,\n ],\n ];\n }\n\n public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array\n {\n $team = $user->getTeam();\n $userTimezone = $user->getTimezone();\n\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n $teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ])->values()->all();\n\n $shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];\n\n $sharedTeamsValue = [];\n $sharedUsersValue = [];\n if ($report) {\n $sharedTeamsValue = $this->transformGroups($team, $report->getGroups());\n\n $recipientUserIds = $report->getRecipients()['users'] ?? [];\n $creatorId = $report->getAttribute('created_by');\n $sharedUserIds = array_values(array_filter(\n $recipientUserIds,\n static fn ($id) => $id !== $creatorId\n ));\n $sharedUsersValue = collect($sharedUserIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (User $u) => [\n 'id' => $u->getUuid(),\n 'name' => $u->getName(),\n ])\n ->values()\n ->all();\n }\n\n return [\n 'fields' => [\n [\n 'id' => 'enabled',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'label' => '',\n 'value' => $report?->getStatus() ?? false,\n ],\n [\n 'id' => 'report_name',\n 'inputType' => InputTypeEnum::TEXT,\n 'label' => 'Name',\n 'placeholder' => 'Enter name',\n 'required' => true,\n 'validation' => ['maxLength' => 50],\n 'value' => $report?->getCustomName() ?? '',\n ],\n [\n 'id' => 'frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Frequency',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::ASK_JIMINNY_FREQUENCIES,\n 'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,\n ],\n [\n 'id' => 'expires_on',\n 'inputType' => InputTypeEnum::DATE,\n 'label' => 'Expires on',\n 'required' => true,\n 'placeholder' => 'Select',\n 'validation' => [\n 'minDate' => now($userTimezone)->toDateString(),\n 'maxDate' => now($userTimezone)->addYear()->toDateString(),\n ],\n 'value' => $report?->getExpiresAt()?->toDateString(),\n ],\n [\n 'id' => 'share_teams',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team',\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $teamGroups,\n 'value' => $sharedTeamsValue,\n ],\n [\n 'id' => 'share_users',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team member',\n 'required' => false,\n 'placeholder' => 'Select',\n 'groupLabelKey' => 'label',\n 'groupValuesKey' => 'users',\n 'optionLabelKey' => 'name',\n 'optionValueKey' => 'id',\n 'options' => $shareUsers,\n 'value' => $sharedUsersValue,\n ],\n [\n 'id' => 'saved_search',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Saved search',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $savedSearches,\n 'value' => $report && $report->getSavedSearch() ? [\n 'id' => $report->getSavedSearch()->getUuid(),\n 'name' => $report->getSavedSearch()->getName(),\n ] : null,\n ],\n [\n 'id' => 'ask_jiminny_prompt',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Ask Jiminny prompt',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $prompts,\n 'value' => $report && $report->getAskAnythingPrompt() ? [\n 'id' => $report->getAskAnythingPrompt()->getUuid(),\n 'name' => $report->getAskAnythingPrompt()->getTitle(),\n ] : null,\n ],\n ],\n ];\n }\n\n private function updateResultNames(AutomatedReport $automatedReport): void\n {\n $results = $this->automatedReportsRepository->getResultsByReport($automatedReport);\n\n foreach ($results as $result) {\n $result->update(['name' => $this->getReportFileName($result)]);\n }\n }\n\n public function updateStatus(string $uuid, array $data): array\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $automatedReport->update([\n 'status' => $status,\n ]);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n private function generateOneOffReport(AutomatedReport $automatedReport): void\n {\n // the scheduler handles all the other frequency types\n if ($automatedReport->getStatus() === false || $automatedReport->getFrequency() !== self::FREQUENCY_ONE_OFF) {\n return;\n }\n\n $this->dispatcher->dispatch(new RequestGenerateReportJob($automatedReport->getUuid()));\n }\n\n public function getReport(string $uuid): AutomatedReport\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n return $automatedReport;\n }\n\n public function get(string $uuid): array\n {\n $automatedReport = $this->getReport($uuid);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function list(string $sortColumn = 'created_at', string $sortDirection = 'desc'): array\n {\n $results = [];\n $collection = $this->automatedReportsRepository->getAllStandardReports($sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function listAskJiminnyReports(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): array {\n $results = [];\n $collection = $this->automatedReportsRepository->getAskJiminnyReportsByUser($user, $sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function delete(string $uuid): void\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $automatedReport->delete();\n }\n\n public function createReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n return $this->automatedReportsRepository->createResult(\n array_merge(\n [\n 'report_id' => $automatedReport->getId(),\n 'status' => AutomatedReportResult::STATUS_DEFAULT,\n ],\n $data\n )\n );\n }\n\n public function getOrCreateReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n $existing = $this->automatedReportsRepository->findLatestDefaultOrFailedResult($automatedReport);\n\n if ($existing !== null) {\n $existing->update(['status' => AutomatedReportResult::STATUS_DEFAULT]);\n\n return $existing;\n }\n\n return $this->createReportResult($automatedReport, $data);\n }\n\n public function getReportResult(string $resultUuid): AutomatedReportResult\n {\n $report = $this->automatedReportsRepository->findResultByUuid($resultUuid);\n\n if (! $report) {\n throw new ModelNotFoundException('Report Result not found');\n }\n\n return $report;\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return $this->automatedReportsRepository->findChildResult($result, $type);\n }\n\n // prophet API calls\n /**\n * @throws ApplicationException\n */\n public function getGenerateReportPayload(AutomatedReport $automatedReport, string $reportResultUuid): array\n {\n $period = $this->calculateFromAndToDate($automatedReport);\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n return [\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResultUuid,\n 'report_type' => $automatedReport->getType(),\n 'media_types' => $automatedReport->getMediaTypes(),\n 'from_date' => $fromDate->startOfDay()->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->endOfDay()->format(DateTimeInterface::RFC3339),\n 'group_ids' => $automatedReport->getGroups(),\n 'call_deal_stage' => $automatedReport->getDealAtCallStages(),\n 'current_deal_stage' => $automatedReport->getCurrentDealStages(),\n 'deal_min_value' => $automatedReport->getDealValueMin(),\n 'deal_max_value' => $automatedReport->getDealValueMax(),\n 'call_types' => $automatedReport->getCallTypes(),\n 'call_duration_min_seconds' => $automatedReport->getCallDurationMin(),\n 'call_duration_max_seconds' => $automatedReport->getCallDurationMax(),\n 'special_requirements' => $automatedReport->getAdditionalPromptInput(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->formatReportPeriodName(\n $automatedReport->getFrequency(),\n $fromDate,\n $toDate,\n ),\n 'playbook_categories' => $automatedReport->getPlaybookCategories(),\n 'custom_name' => $automatedReport->getCustomName(),\n ];\n }\n\n // $inputPayload - FE payload structure\n public function getActivitiesCountPayload(array $inputPayload): array\n {\n // Use validateAndTransformData to validate and normalize input\n $validatedData = $this->validateAndTransformData($inputPayload);\n $period = $this->calculateFromAndToDatePeriod(\n $validatedData['frequency'],\n Carbon::parse($validatedData['from']),\n Carbon::parse($validatedData['to']),\n );\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n // Create payload similar to getGenerateReportPayload\n return [\n 'team_id' => $validatedData['team_id'],\n 'group_ids' => $validatedData['groups'] ?? [],\n 'report_type' => $validatedData['type'],\n 'from_date' => $fromDate->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->format(DateTimeInterface::RFC3339),\n 'call_deal_stage' => $validatedData['deal_at_call_stages'] ?? [],\n 'current_deal_stage' => $validatedData['current_deal_stages'] ?? [],\n 'deal_min_value' => $validatedData['deal_value_min'] ?? null,\n 'deal_max_value' => $validatedData['deal_value_max'] ?? null,\n 'call_types' => $validatedData['call_types'],\n 'call_duration_min_seconds' => $validatedData['call_duration_min'] ?? null,\n 'call_duration_max_seconds' => $validatedData['call_duration_max'] ?? null,\n 'special_requirements' => $validatedData['additional_prompt_input'] ?? null,\n 'playbook_categories' => $validatedData['playbook_categories'] ?? [],\n 'request_id' => null,\n 'callback_url' => null,\n ];\n }\n\n public function shouldSendReport(array $users, ?CarbonInterface $generatedAt = null): bool\n {\n if (empty($users)) {\n return false;\n }\n\n $earliestTz = collect($users)\n ->mapWithKeys(function (array $user) {\n $tz = new DateTimeZone($user['timezone']);\n $nowUtc = new DateTime('now', new DateTimeZone('UTC'));\n $offset = $tz->getOffset($nowUtc);\n\n return [$user['timezone'] => $offset];\n })\n ->sortDesc()\n ->keys()\n ->first();\n\n $now = Carbon::now($earliestTz);\n $isScheduledTime = (int) $now->format('H') === self::SENT_REPORT_AT_HOURS;\n\n if ($isScheduledTime) {\n return true;\n }\n\n return $this->hasPassedScheduledTime($generatedAt, $earliestTz);\n }\n\n public function hasPassedScheduledTime(?CarbonInterface $generatedAt, string $timezone): bool\n {\n if ($generatedAt === null) {\n return false;\n }\n\n $now = Carbon::now($timezone);\n $scheduledTime = $now->copy()->setTime(self::SENT_REPORT_AT_HOURS, 0, 0);\n\n if ($now->hour < self::SENT_REPORT_AT_HOURS) {\n $scheduledTime = $scheduledTime->subDay();\n }\n\n $scheduledTimeUtc = $scheduledTime->copy()->utc();\n $generatedAtUtc = $generatedAt->copy()->utc();\n $nowUtc = $now->copy()->utc();\n\n return $generatedAtUtc->lt($scheduledTimeUtc) && $nowUtc->gt($scheduledTimeUtc);\n }\n\n public function calculateFromAndToDatePeriod(\n string $frequency,\n ?Carbon $fromDate = null,\n ?Carbon $toDate = null\n ): array {\n if ($frequency === self::FREQUENCY_ONE_OFF) {\n return [\n 'fromDate' => $fromDate,\n 'toDate' => $toDate,\n ];\n }\n\n $now = Carbon::now();\n\n return match ($frequency) {\n self::FREQUENCY_DAILY => [\n 'fromDate' => $now->copy()->subDay()->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_WEEKLY => [\n 'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_MONTHLY => [\n 'fromDate' => $now->copy()->subMonths(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_QUARTERLY => [\n 'fromDate' => $now->copy()->subMonths(3)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n default => throw new InvalidArgumentException(\"Unsupported frequency: {$frequency}\"),\n };\n }\n\n private function calculateFromAndToDate(AutomatedReport $automatedReport): array\n {\n return $this->calculateFromAndToDatePeriod(\n $automatedReport->getFrequency(),\n $automatedReport->getFrom(),\n $automatedReport->getTo()\n );\n }\n\n public function getAskJiminnyGenerateReportPayload(\n AutomatedReport $automatedReport,\n AutomatedReportResult $reportResult,\n array $activityIds,\n ): array {\n return [\n 'user_question' => $automatedReport->getAskAnythingPrompt()?->getContent(),\n 'call_ids' => array_map('strval', $activityIds),\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResult->getUuid(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->getReportPeriodName($reportResult),\n 'report_name' => $automatedReport->getCustomName(),\n ];\n }\n\n private function getCallbackUrl(): string\n {\n return $this->webhookService->route('jiminny.webhook.reports.ready');\n }\n\n /**\n * Validate and transform payload data for automated reports\n *\n * @param array $data\n *\n * @throws InvalidArgumentException\n *\n * @return array\n */\n private function validateAndTransformData(array $data): array\n {\n // Validate organization (team) and check feature\n $team = $this->validateOrganization($data['organization'] ?? null);\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $type = $this->validateReportType($data['report_type'] ?? null);\n $frequency = $this->validateFrequency($data['frequency'] ?? null);\n $additionalPromptInput = $this->validateAdditionalPromptInput(\n $data['additional_prompt_input'] ?? null\n );\n $customReportName = $this->validateCustomReportName($data['custom_name'] ?? null);\n\n // Prepare data for the database\n $reportData = [\n 'team_id' => $team->getId(),\n 'type' => $type,\n 'status' => $status,\n 'frequency' => $frequency,\n 'additional_prompt_input' => $additionalPromptInput,\n 'custom_name' => $customReportName,\n ];\n\n // Validate deal values\n $reportData = $this->validateDealValues($data, $reportData);\n\n // Validate date range\n $reportData = $this->validateDateRange($data, $reportData, $frequency);\n\n // Validate call durations\n $reportData = $this->validateCallDurations($data, $reportData);\n\n // Validate call types\n $reportData = $this->validateCallTypes($data, $reportData);\n\n // Validate media types\n $reportData = $this->validateMediaTypes($data, $reportData);\n\n // Validate groups\n if (isset($data['teams'])) {\n $reportData['groups'] = $this->validateAndGetGroupIds($team, $data['teams']);\n }\n\n // Validate deal stages\n $reportData = $this->validateDealStages($data, $reportData, $team, $type);\n\n // Validate playbook categories\n $reportData = $this->validatePlaybookCategories($data, $reportData, $team);\n\n // Validate recipients\n $reportData['recipients'] = [\n 'users' => $this->validateAndGetUserIdsByTeam($team, $data['recipients'] ?? []),\n ];\n\n if (isset($data['jiminny_recipients'])) {\n // Validate Jiminny recipients\n $reportData['jiminny_recipients'] = [\n 'users' => $this->validateAndGetJiminnyUserIds((array) $data['jiminny_recipients']),\n ];\n }\n\n return $reportData;\n }\n\n private function validateDealValues(array $data, array $reportData): array\n {\n if (isset($data['min_deal_value'])) {\n $reportData['deal_value_min'] = (int) $data['min_deal_value'];\n\n if ($reportData['deal_value_min'] > 4294967295 || $reportData['deal_value_min'] < 0) {\n throw new InvalidArgumentException('Min deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_deal_value'])) {\n $reportData['deal_value_max'] = (int) $data['max_deal_value'];\n\n if ($reportData['deal_value_max'] > 4294967295 || $reportData['deal_value_max'] < 0) {\n throw new InvalidArgumentException('Max deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['min_deal_value'], $data['max_deal_value'])\n && $data['min_deal_value'] > $data['max_deal_value']\n ) {\n throw new InvalidArgumentException('Min deal value cannot be greater than max deal value');\n }\n\n return $reportData;\n }\n\n private function validateDateRange(array $data, array $reportData, string $frequency): array\n {\n // Set date range only for one_off frequency\n if ($frequency === 'one_off') {\n if (isset($data['start_date_period'])) {\n $reportData['from'] = $this->parseDate($data['start_date_period']);\n }\n\n if (isset($data['end_date_period'])) {\n $reportData['to'] = $this->parseDate($data['end_date_period']);\n }\n\n if (empty($reportData['from']) || empty($reportData['to'])) {\n throw new InvalidArgumentException(\n 'Start date and end date are required for one_off frequency'\n );\n }\n } else {\n $reportData['from'] = null;\n $reportData['to'] = null;\n }\n\n return $reportData;\n }\n\n private function validateCallDurations(array $data, array $reportData): array\n {\n // Convert call durations from minutes to seconds\n if (isset($data['min_call_duration'])) {\n $reportData['call_duration_min'] = (int) $data['min_call_duration'] * 60;\n\n if ($reportData['call_duration_min'] > 4294967295 || $reportData['call_duration_min'] < 0) {\n throw new InvalidArgumentException('Min call duration should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_call_duration'])) {\n $reportData['call_duration_max'] = (int) $data['max_call_duration'] * 60;\n\n if ($reportData['call_duration_max'] > 4294967295 || $reportData['call_duration_max'] < 0) {\n throw new InvalidArgumentException('Max call duration should be between 0 and 4294967295');\n }\n }\n\n return $reportData;\n }\n\n private function validateCallTypes(array $data, array $reportData): array\n {\n // Set call types\n $reportData['call_types'] = $data['call_type'] ?? [];\n if (empty($reportData['call_types'])) {\n $reportData['call_types'] = self::getCallTypes();\n }\n\n foreach ($reportData['call_types'] as $callType) {\n if (! in_array($callType, self::getCallTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Call type %s is invalid', $callType));\n }\n }\n\n return $reportData;\n }\n\n private function validateMediaTypes(array $data, array $reportData): array\n {\n // Set media types from input data\n $reportData['media_types'] = $data['media_types'] ?? [];\n\n if (empty($reportData['media_types'])) {\n throw new InvalidArgumentException('Media types are required');\n }\n\n foreach ($reportData['media_types'] as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n throw new InvalidArgumentException(sprintf('Media type %s is invalid', $mediaType));\n }\n }\n\n return $reportData;\n }\n\n private function validateDealStages(array $data, array $reportData, Team $team, string $reportType): array\n {\n // Validate and set deal stages\n if (isset($data['deal_stage_at_call'])) {\n $reportData['deal_at_call_stages'] =\n $this->validateAndGetDealStageIds($team, $data['deal_stage_at_call'], 'Deal stage at call');\n }\n\n if (isset($data['current_deal_stage'])) {\n $reportData['current_deal_stages'] =\n $this->validateAndGetDealStageIds($team, $data['current_deal_stage'], 'Current deal stage');\n }\n\n // Ensure current_deal_stage is not provided for loss_analysis report type\n if ($reportType === self::TYPE_LOSS_ANALYSIS && ! empty($data['current_deal_stage'])) {\n throw new InvalidArgumentException('Current deal stage is not applicable for Loss Analysis reports');\n }\n\n return $reportData;\n }\n\n // transform uuid to id\n private function validatePlaybookCategories(array $data, array $reportData, Team $team): array\n {\n $key = 'playbook_categories';\n\n if (isset($data[$key])) {\n $payloadIds = $data[$key];\n $ids = [];\n\n foreach ($payloadIds as $uuid) {\n $uuid = (string) $uuid;\n\n try {\n $playbookCategory = $this->playbookCategoryRepository->findByUuid($uuid);\n } catch (Throwable $throwable) {\n Log::error(__METHOD__ . ' ' . $throwable->getMessage());\n\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory) {\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory->hasPlaybook()) {\n throw new InvalidArgumentException(sprintf('Playbook category %s has no playbook', $uuid));\n }\n\n if ($playbookCategory->getPlaybook()->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Playbook category %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $ids[] = $playbookCategory->getId();\n }\n\n $reportData[$key] = $ids;\n }\n\n return $reportData;\n }\n\n private function validateReportStatus($status): bool\n {\n if (! in_array($status, [true, false], true)) {\n throw new InvalidArgumentException('Report status is invalid');\n }\n\n return $status;\n }\n\n private function validateReportType($type): string\n {\n if (! in_array($type, self::getTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Report type is invalid: %s', $type));\n }\n\n return $type;\n }\n\n private function validateFrequency($frequency): string\n {\n if (! in_array($frequency, self::getFrequencies(), true)) {\n throw new InvalidArgumentException('Frequency is invalid');\n }\n\n return $frequency;\n }\n\n private function validateAdditionalPromptInput(?string $additionalPromptInput): ?string\n {\n if ($additionalPromptInput && strlen($additionalPromptInput) > 5000) {\n throw new InvalidArgumentException('Additional Prompt Input should be less than 5000 characters');\n }\n\n return $additionalPromptInput;\n }\n\n private function validateCustomReportName(?string $customReportName): ?string\n {\n if ($customReportName === null || $customReportName === '') {\n return null;\n }\n\n if (strlen($customReportName) > 70) {\n throw new InvalidArgumentException('Custom report name should be less than 70 characters');\n }\n\n return $customReportName;\n }\n\n private function validateOrganization(?string $organizationUuid): Team\n {\n if (! $organizationUuid) {\n throw new InvalidArgumentException('Organization is required');\n }\n\n $team = $this->teamRepository->idOrUuid($organizationUuid);\n\n if (! $team) {\n throw new InvalidArgumentException('Organization not found');\n }\n\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n throw new InvalidArgumentException('Organization does not have the Automated Reports feature');\n }\n\n return $team;\n }\n\n private function validateAndGetGroupIds(Team $team, array $teamUuids): array\n {\n $groupIds = [];\n\n foreach ($teamUuids as $uuid) {\n $group = $this->groupRepository->findByUuid($uuid);\n\n if ($group === null || $group->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Group %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $groupIds[] = $group->getId();\n\n }\n\n return $groupIds;\n }\n\n private function validateAndGetDealStageIds(Team $team, array $stageUuids, string $propertyLabel): array\n {\n $stageIds = [];\n\n foreach ($stageUuids as $uuid) {\n $stage = $this->stageRepository->findByUuid($uuid);\n\n if ($stage === null || $stage->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Stage %s not found for team %s for %s', $uuid, $team->getUuid(), $propertyLabel)\n );\n }\n\n $stageIds[] = $stage->getId();\n }\n\n return $stageIds;\n }\n\n private function validateAndGetUserIds(array $userUuids, callable $teamCheck): array\n {\n if (empty($userUuids)) {\n return [];\n }\n\n $userIds = [];\n\n foreach ($userUuids as $uuid) {\n $user = $this->userRepository->findByUuid($uuid);\n\n if (! $user || ! $user->isStatusActive()) {\n throw new InvalidArgumentException(\n sprintf('User %s not found or is not active', $uuid)\n );\n }\n\n if (! $teamCheck($user)) {\n throw new InvalidArgumentException(\n sprintf('User %s does not belong to the allowed team(s)', $uuid)\n );\n }\n\n $userIds[] = $user->getId();\n }\n\n return $userIds;\n }\n\n private function validateAndGetUserIdsByTeam(Team $team, array $userUuids): array\n {\n return $this->validateAndGetUserIds($userUuids, fn ($user) => $user->getTeamId() === $team->getId());\n }\n\n private function validateAndGetJiminnyUserIds(array $userUuids): array\n {\n $allowedTeamIds = config('kiosk.teamIds', []);\n\n return $this->validateAndGetUserIds($userUuids, fn ($user) => in_array($user->getTeamId(), $allowedTeamIds, true));\n }\n\n private function parseDate(string $dateString): string\n {\n return date('Y-m-d H:i:s', strtotime($dateString));\n }\n\n private function generateReportResultViewUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.view', ['uuid' => $result->getUuid()]);\n }\n\n private function generateReportResultDownloadUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.download', ['uuid' => $result->getUuid()]);\n }\n\n private function getReportMediaRouteResource(AutomatedReportResult $result): string\n {\n if ($result->getMediaType() === self::MEDIA_TYPE_PDF) {\n return self::PDF_KEY;\n } elseif ($result->getMediaType() === self::MEDIA_TYPE_PODCAST) {\n return self::AUDIO_KEY;\n }\n\n throw new \\InvalidArgumentException('Unknown media type.');\n }\n\n public function getMediaPath(AutomatedReportResult $result): ?string\n {\n $url = match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => $result->getPdfUrl(),\n self::MEDIA_TYPE_PODCAST => $result->getPodcastAudioUrl(),\n default => null,\n };\n\n if ($url === null) {\n return null;\n }\n\n $path = parse_url(trim($url, '\"\\''), PHP_URL_PATH);\n\n return $path ?: null;\n }\n\n public function getFilenameSuffix(AutomatedReportResult $result): ?string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => 'Podcast',\n default => null,\n };\n }\n\n public function getMailSubjectSuffix(AutomatedReportResult $result): string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => 'report',\n self::MEDIA_TYPE_PODCAST => 'podcast',\n default => '',\n };\n }\n\n public function getMediaTypeMetadata(AutomatedReportResult $result): array\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => ['extension' => 'mp3', 'mime' => 'audio/mpeg'],\n self::MEDIA_TYPE_PDF => ['extension' => 'pdf', 'mime' => 'application/pdf'],\n default => ['extension' => null, 'mime' => null],\n };\n }\n\n public function deleteS3Files(AutomatedReportResult $result): void\n {\n $teamUuid = $result->getReport()->getTeam()->getUuid();\n $reportUuid = $result->getUuid();\n\n // delete all files for a report uuid no mather of pdf, podcast, or both\n // in case of both - the podcast files are linked to the pdf (parent) uuid\n // pdf and podcast date times should be close\n $path = sprintf('%s/%s/%s', $teamUuid, self::S3_DIR, $reportUuid);\n\n foreach (self::FILE_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted S3 file', [\n 'path' => $file,\n ]);\n }\n }\n\n foreach (self::FILE_PODCAST_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '_podcast.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted Podcast S3 file', [\n 'path' => $file,\n ]);\n }\n }\n }\n\n /**\n *\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): Collection\n {\n return $this->automatedReportsRepository->getTeamIdsWithReportsResults($teamId);\n }\n\n /**\n * Core delete logic for report results using a query\n *\n * @param Builder $query\n * @param array $logContext\n *\n * @return int\n */\n private function deleteReportResultsByQuery(Builder $query, array $logContext = []): int\n {\n $deletedCount = 0;\n\n if ($query->exists()) {\n Log::info(\n 'Run delete report results',\n array_merge(\n $logContext,\n [\n 'service' => 'AutomatedReportsService',\n ]\n )\n );\n\n $query->chunkById(50, function ($results) use (&$deletedCount, $logContext) {\n foreach ($results as $result) {\n $this->deleteReportResult($result);\n $deletedCount++;\n\n Log::info(\n 'Deleted a report result',\n array_merge(\n $logContext,\n [\n 'result_id' => $result->getId(),\n 'report_id' => $result->getReportId(),\n ]\n )\n );\n }\n });\n }\n\n return $deletedCount;\n }\n\n /**\n * Delete report results for a team by retention period\n *\n * @param Team $team\n * @param CarbonImmutable $retentionDate\n *\n * @return int Number of deleted report results\n */\n public function deleteReportsResultsInRetentionPeriod(Team $team, CarbonImmutable $retentionDate): int\n {\n $reportIds = $this->automatedReportsRepository->getReportIdsByTeam($team);\n\n if ($reportIds->isEmpty()) {\n return 0;\n }\n\n $query = $this->automatedReportsRepository\n ->getReportResultsQueryForRetention($team, $retentionDate);\n\n return $this->deleteReportResultsByQuery($query, [\n 'team_id' => $team->getId(),\n 'retention_date' => $retentionDate->toDateTimeString(),\n ]);\n }\n\n /**\n * Delete ALL report results for a specific automated report\n *\n * @param string $uuid\n *\n * @return int\n */\n public function deleteReportResults(string $uuid): int\n {\n $report = $this->getReport($uuid);\n\n $query = $this->automatedReportsRepository->getResultsByReportQuery($report);\n\n return $this->deleteReportResultsByQuery($query, [\n 'report_uuid' => $uuid,\n 'report_id' => $report->getId(),\n ]);\n }\n\n public function deleteReportResult(AutomatedReportResult $result): void\n {\n $this->deleteS3Files($result);\n\n $result->delete();\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getTeamReports(Team $team): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getReportsByTeam($team);\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getReportResults(AutomatedReport $report): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getResultsByReport($report);\n }\n\n public function deleteAllReportResults(AutomatedReport $report): void\n {\n $results = $this->getReportResults($report);\n\n /** @var AutomatedReportResult $result */\n foreach ($results as $result) {\n Log::info('Deleting result', [\n 'report' => $report->getId(),\n 'result' => $result->getId(),\n ]);\n\n $this->deleteReportResult($result);\n }\n }\n\n public function deleteAllData(Team $team): void\n {\n Log::info('Deleting automated report and results for team', [\n 'team' => $team->getId(),\n ]);\n\n $reports = $this->getTeamReports($team);\n\n /** @var AutomatedReport $report */\n foreach ($reports as $report) {\n Log::info('Deleting report', [\n 'team' => $team->getId(),\n 'report' => $report->getId(),\n ]);\n\n $this->deleteAllReportResults($report);\n\n $report->delete();\n }\n }\n}","depth":4,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Kiosk\\AutomatedReports;\n\nuse Carbon\\CarbonImmutable;\nuse Carbon\\CarbonInterface;\nuse Carbon\\Exceptions\\InvalidFormatException;\nuse DateTime;\nuse DateTimeInterface;\nuse DateTimeZone;\nuse Illuminate\\Contracts\\Bus\\Dispatcher as BusDispatcher;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Support\\Facades\\Log;\nuse Illuminate\\Support\\Facades\\Storage;\nuse Jiminny\\Component\\ActivitySearch\\FilterDefinition\\InputTypeEnum;\nuse Jiminny\\Component\\AskAnything\\AskAnythingPromptService;\nuse Jiminny\\Component\\AskAnything\\Dtos\\AskAnythingPromptDto;\nuse Jiminny\\Component\\UrlGenerator\\Webhook;\nuse Jiminny\\Contracts\\Repositories\\PlaybookCategoryRepository;\nuse Jiminny\\Contracts\\Repositories\\TeamRepository;\nuse Jiminny\\Contracts\\Repositories\\UserRepository;\nuse Jiminny\\Exceptions\\ApplicationException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Exceptions\\ModelNotFoundException;\nuse Jiminny\\Jobs\\AutomatedReports\\RequestGenerateReportJob;\nuse Jiminny\\Models\\Activity\\Search;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPrompt;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPromptTarget;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Contracts\\UserContract;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Repositories\\AskAnythingRepository;\nuse Jiminny\\Repositories\\AutomatedReportsRepository;\nuse Jiminny\\Repositories\\GroupRepository;\nuse Jiminny\\Repositories\\SearchRepository;\nuse Jiminny\\Repositories\\StageRepository;\nuse Throwable;\n\nclass AutomatedReportsService\n{\n public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';\n public const string TYPE_ASK_JIMINNY = 'ask_jiminny';\n\n /**\n * Standard report types (used by kiosk for existing automated reports).\n */\n // @TODO this will add filter, however if we need to control feature by FF we need conditional logic\n public const array TYPES = [\n ['id' => 'exec_summary', 'name' => 'Exec Summary'],\n ['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],\n ['id' => 'product_feedback', 'name' => 'Product Feedback'],\n ['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],\n// ['id' => 'questions', 'name' => 'Questions'],\n// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],\n ];\n\n public const array ALL_TYPES = [\n ...self::TYPES,\n ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],\n ];\n\n public const string FREQUENCY_DAILY = 'daily';\n public const string FREQUENCY_WEEKLY = 'weekly';\n public const string FREQUENCY_MONTHLY = 'monthly';\n public const string FREQUENCY_QUARTERLY = 'quarterly';\n public const string FREQUENCY_ONE_OFF = 'one_off';\n\n /**\n * Frequencies for standard (non-Ask Jiminny) reports.\n */\n public const array FREQUENCIES = [\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n\n /**\n * Frequencies for Ask Jiminny reports.\n */\n public const array ASK_JIMINNY_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ];\n\n public const string MEDIA_TYPE_PDF = 'pdf';\n public const string MEDIA_TYPE_PODCAST = 'podcast';\n public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];\n public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];\n public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];\n public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];\n\n public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];\n public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];\n public const int SENT_REPORT_AT_HOURS = 5;\n public const string PDF_KEY = 'pdf';\n public const string AUDIO_KEY = 'audio';\n\n private const array ALL_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n private const string S3_DIR = 'reports';\n private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];\n private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];\n\n public function __construct(\n private readonly TeamRepository $teamRepository,\n private readonly GroupRepository $groupRepository,\n private readonly UserRepository $userRepository,\n private readonly StageRepository $stageRepository,\n private readonly DealStagesService $dealStagesService,\n private readonly RecipientsService $recipientsService,\n private readonly AutomatedReportsRepository $automatedReportsRepository,\n private readonly Webhook $webhookService,\n private readonly BusDispatcher $dispatcher,\n private readonly ActivityTypeService $activityTypeService,\n private readonly PlaybookCategoryRepository $playbookCategoryRepository,\n private readonly AskAnythingPromptService $askAnythingPromptService,\n private readonly SearchRepository $activitySearchRepository,\n private readonly AskAnythingRepository $askAnythingRepository,\n ) {\n }\n\n public static function getTypes(): array\n {\n $types = self::TYPES;\n\n return array_map(static function ($type) {\n return $type['id'];\n }, $types);\n }\n\n public static function getCallTypes(): array\n {\n return array_map(static function ($callType) {\n return $callType['id'];\n }, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);\n }\n\n public static function getFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::FREQUENCIES);\n }\n\n // front-facing structure\n public function getReportEnabledFieldData(bool $value = false): array\n {\n return [\n 'id' => 'report_enabled',\n 'label' => '',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'value' => $value,\n ];\n }\n\n // Organizations = Teams\n public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array\n {\n $options = $this->getTeams();\n\n if ($shortVersion) {\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value,\n 'dependencies' => [\n 'teams',\n 'deal_stage_at_call',\n 'current_deal_stage',\n 'recipients',\n ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,\n ],\n 'dependsOn' => [],\n ];\n }\n\n // Teams = Groups\n public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array\n {\n if ($shortVersion) {\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value, // value should be an array of objects {id, name}\n 'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],\n 'dependsOn' => [],\n ];\n }\n\n public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array\n {\n $types = [];\n if ($team instanceof Team) {\n if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n $types = self::TYPES;\n }\n if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {\n $types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];\n }\n } else {\n $types = self::TYPES;\n }\n\n if ($shortVersion) {\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'options' => $types,\n ];\n }\n\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $types,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getFrequencyFieldData(?string $value = null): array\n {\n return [\n 'id' => 'frequency',\n 'label' => 'Frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::FREQUENCIES,\n 'value' => $value,\n 'dependencies' => ['period'],\n 'dependsOn' => [],\n ];\n }\n\n public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array\n {\n return [\n 'id' => 'period',\n 'label' => 'Select one-off period',\n 'inputType' => InputTypeEnum::DATE_RANGE,\n 'required' => true,\n 'placeholder' => 'Select',\n 'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],\n 'queryParams' => [\n 'startDate' => 'start_date_period',\n 'endDate' => 'end_date_period',\n ],\n 'dependencies' => [],\n 'dependsOn' => ['frequency'],\n ];\n }\n\n public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array\n {\n return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);\n }\n\n public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);\n }\n\n public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);\n }\n\n public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'deal_value',\n 'label' => 'Deal Value',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_deal_value',\n 'max' => 'max_deal_value',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array\n {\n $value = [];\n $conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;\n $dialerOn && $value[] = self::CALL_TYPE_DIALER;\n\n return [\n 'id' => 'call_type',\n 'label' => 'Call Type',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => [\n self::CALL_TYPE_CONFERENCE,\n self::CALL_TYPE_DIALER,\n ],\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getMediaTypeFieldData(?AutomatedReport $report = null): array\n {\n $value = [];\n\n if ($report) {\n $value = $this->transformMediaTypes($report);\n }\n\n return [\n 'id' => 'media_types',\n 'label' => 'Export as',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => self::MEDIA_TYPE_OBJECTS,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'call_duration',\n 'label' => 'Call Duration',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_call_duration',\n 'max' => 'max_call_duration',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getRecipientsFieldData(?Team $team = null, array $value = []): array\n {\n return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);\n }\n\n public function getJiminnyRecipientsFieldData(array $value = []): array\n {\n return $this->recipientsService->getJiminnyRecipientsFieldData($value);\n }\n\n public function getAdditionalPromptInputFieldData(?string $value = null): array\n {\n return [\n 'id' => 'additional_prompt_input',\n 'label' => 'Special requirements',\n 'inputType' => InputTypeEnum::TEXTAREA,\n 'required' => false,\n 'placeholder' => 'What should be the focus of the report?',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCustomReportNameFieldData(?string $value = null): array\n {\n return [\n 'id' => 'custom_name',\n 'label' => 'Custom report name',\n 'inputType' => InputTypeEnum::TEXT,\n 'required' => false,\n 'placeholder' => 'Enter custom name',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n // data providers\n public function getTeams(): array\n {\n $teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);\n\n $teamData = [];\n foreach ($teams as $team) {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n continue;\n }\n\n $teamData[] = $this->transformTeam($team);\n }\n\n return $teamData;\n }\n\n public function getTeamGroups(string $teamUuid): array\n {\n $data = [];\n $team = $this->getTeam($teamUuid);\n\n if ($team !== null) {\n $groups = $team->groups()->get();\n\n foreach ($groups as $group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n public function getTeamsGroupsOptions(array $filterTeamUuids = []): array\n {\n $data = [];\n $teams = $this->getTeams();\n\n foreach ($teams as $team) {\n if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {\n continue;\n }\n\n $data[] = [\n 'label' => $team['name'],\n 'groups' => $this->getTeamGroups($team['id']),\n ];\n }\n\n return $data;\n }\n\n public function getTeam(string $teamUuid): ?Team\n {\n return $this->teamRepository->idOrUuid($teamUuid);\n }\n\n public function getTeamById(int $teamId): ?Team\n {\n return $this->teamRepository->find($teamId);\n }\n\n public function getGroupsUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportGroups = $report->getGroups();\n foreach ($reportGroups as $groupId) {\n if ($group = $this->groupRepository->find($groupId)) {\n $uuids[] = $group->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getPlaybookCategoriesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $playbookCategories = $report->getPlaybookCategories();\n foreach ($playbookCategories as $id) {\n if ($category = $this->playbookCategoryRepository->find($id)) {\n $uuids[] = $category->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getDealAtCallStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getDealAtCallStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getCurrentDealStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getCurrentDealStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getRecipients());\n }\n\n public function getJiminnyUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function extractUserUuids(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => $user->getUuid())\n ->values()\n ->all();\n }\n\n // get mail data\n public function getRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getRecipients());\n }\n\n /**\n * @return array<UserContract>\n */\n public function getRecipientUserObjects(AutomatedReport $report): array\n {\n $userIds = $report->getRecipients()['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->values()\n ->all();\n }\n\n private function getJiminnyRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function buildRecipientUsers(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => [\n 'email' => $user->getEmailAddress(),\n 'name' => $user->getName(),\n 'timezone' => $user->getTimezone()->getName(),\n ])\n ->values()\n ->all();\n }\n\n public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array\n {\n if ($report->isAskJiminnyReport()) {\n $recipients = $this->resolveAskJiminnyRecipients($report);\n } else {\n $recipients = $this->getRecipientUsers($report);\n if ($includeJiminny) {\n $recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));\n }\n }\n\n $emails = [];\n\n return array_values(array_filter(\n $recipients,\n static function ($recipient) use (&$emails) {\n if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {\n return false;\n }\n $emails[] = $recipient['email'];\n\n return true;\n }\n ));\n }\n\n private function resolveAskJiminnyRecipients(AutomatedReport $report): array\n {\n $recipients = [];\n\n $creator = $report->getCreator();\n if ($creator !== null) {\n $recipients[] = [\n 'email' => $creator->getEmailAddress(),\n 'name' => $creator->getName(),\n 'timezone' => $creator->getTimezone()->getName(),\n ];\n }\n\n return array_merge(\n $recipients,\n $this->buildRecipientUsers($report->getRecipients()),\n $this->getGroupRecipientUsers($report),\n );\n }\n\n private function getGroupRecipientUsers(AutomatedReport $report): array\n {\n $users = [];\n foreach ($report->getGroups() as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group === null) {\n continue;\n }\n foreach ($group->getMembers() as $member) {\n $users[] = [\n 'email' => $member->getEmailAddress(),\n 'name' => $member->getName(),\n 'timezone' => $member->getTimezone()->getName(),\n ];\n }\n }\n\n return $users;\n }\n\n public function getReportTypeName(AutomatedReportResult $report): string\n {\n $type = $report->getReport()->getType();\n\n $getType = $this->transformReportType($type);\n\n return $getType['name'];\n }\n\n public function getReportPeriodName(AutomatedReportResult $report): string\n {\n $from = $report->getFromDate();\n $to = $report->getToDate();\n $frequency = $report->getReport()->getFrequency();\n\n if ($from === null || $to === null) {\n if (! $report->getReport()->isAskJiminnyReport()) {\n $invalidPeriod = $from === null ? 'from' : 'to';\n\n throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);\n }\n\n $period = $this->calculateFromAndToDatePeriod($frequency);\n $from = $period['fromDate'];\n $to = $period['toDate'];\n }\n\n return $this->formatReportPeriodName($frequency, $from, $to);\n }\n\n private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string\n {\n $fromYear = $from->format('Y');\n $toYear = $to->format('Y');\n $differentYears = $fromYear !== $toYear;\n\n switch ($frequency) {\n case self::FREQUENCY_DAILY:\n return $from->format('j M Y');\n\n case self::FREQUENCY_QUARTERLY:\n // 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ\n $startMonth = $from->format('M');\n $endMonth = $to->copy()->subMonth();\n $endMonthName = $endMonth->format('M');\n $endMonthYear = $endMonth->format('Y');\n\n if ($differentYears) {\n return \"{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}\";\n }\n\n return \"{$startMonth} - {$endMonthName} {$toYear}\";\n\n case self::FREQUENCY_MONTHLY:\n // 'May 2025' - monthly reports are always within the same year\n return $from->format('M Y');\n\n case self::FREQUENCY_WEEKLY:\n // '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ\n $startDay = $from->format('j');\n $endDay = $to->format('j');\n $startMonth = $from->format('M');\n $endMonth = $to->format('M');\n\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n if ($startMonth !== $endMonth) {\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n return \"{$startDay} - {$endDay} {$endMonth} {$toYear}\";\n\n case self::FREQUENCY_ONE_OFF:\n // '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ\n $startDay = $from->format('j');\n $startMonth = $from->format('M');\n $endDay = $to->format('j');\n $endMonth = $to->format('M');\n\n // If same month and year, use a format like '2-31 May 2025'\n if ($startMonth === $endMonth && ! $differentYears) {\n return \"{$startDay} - {$endDay} {$startMonth} {$toYear}\";\n }\n\n // If different years, include both years\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n // Same year but different months\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n\n default:\n // Default format for unknown frequencies\n return $from->format('j M Y') . ' - ' . $to->format('j M Y');\n }\n }\n\n public function getReportTeamsName(AutomatedReportResult $report): string\n {\n $groups = $report->getGroups();\n\n if (empty($groups)) {\n return 'All';\n }\n\n // Get group names from repository\n $groupNames = [];\n foreach ($groups as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group) {\n $groupNames[] = $group->getName();\n }\n }\n\n if (count($groupNames) === 1) {\n // Single team format\n $teamsName = $groupNames[0];\n } else {\n // Multiple teams format\n $teamsName = implode(', ', $groupNames);\n }\n\n return $teamsName;\n }\n\n public function getReportFileName(AutomatedReportResult $report): string\n {\n $customName = $report->getReport()->getCustomName();\n $periodName = $this->getReportPeriodName($report);\n $filenameSuffix = $this->getFilenameSuffix($report);\n\n if ($customName) {\n if ($filenameSuffix) {\n $customName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$customName} - {$periodName}\");\n }\n\n $baseName = $this->getReportTypeName($report);\n\n if ($filenameSuffix) {\n $baseName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}\");\n }\n\n public function getReportFileNameWithExtension(AutomatedReportResult $result): string\n {\n $extension = $this->getMediaTypeMetadata($result)['extension'];\n\n return $this->getReportFileName($result) . '.' . $extension;\n }\n\n public function sanitizeFileName(string $fileName): string\n {\n return str_replace(['/', '\\\\'], '-', $fileName);\n }\n\n public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool\n {\n $recipients = array_map('intval', $report->getRecipients()['users'] ?? []);\n\n return in_array($user->getId(), $recipients);\n }\n\n public function transformReportResults(Collection $automatedReportResults): array\n {\n $data = [];\n foreach ($automatedReportResults as $automatedReportResult) {\n /** @var AutomatedReportResult $automatedReportResult */\n\n $report = $automatedReportResult->getReport();\n\n $createdBy = $report->getCreator();\n $creator = [\n 'id' => $createdBy?->getUuid(),\n 'name' => $createdBy?->getName(),\n 'email' => $createdBy?->getEmailAddress(),\n 'photoUrl' => $createdBy?->getPhotoUrl(),\n ];\n\n $data[] = [\n 'id' => $automatedReportResult->getUuid(),\n 'name' => $automatedReportResult->getName(),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n 'recipients' => $this->buildRecipients($report),\n 'report_type' => $this->transformReportType($report->getType()),\n 'media_type' => $automatedReportResult->getMediaType(),\n 'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),\n 'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),\n 'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),\n 'creator' => $creator,\n ];\n }\n\n return $data;\n }\n\n private function buildRecipients(AutomatedReport $report): array\n {\n $creatorUuid = $report->getCreator()?->getUuid();\n\n $recipients = array_values(array_filter(\n $this->transformRecipients($report->getRecipients()),\n static fn (array $recipient): bool => $recipient['id'] !== $creatorUuid,\n ));\n\n if (! $report->isAskJiminnyReport()) {\n return $recipients;\n }\n\n return [\n ...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),\n ...$recipients,\n ];\n }\n\n public function hasCallTypeConference(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);\n }\n\n public function hasCallTypeDialer(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);\n }\n\n // transformers\n private function transformTeam(Team $team): array\n {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n return [];\n }\n\n return [\n 'id' => $team->getUuid(),\n 'name' => $team->getName(),\n ];\n }\n\n private function transformReportFullView(AutomatedReport $report): array\n {\n $base = $this->transformReportBase($report);\n\n return $report->getType() === self::TYPE_ASK_JIMINNY\n ? $base + $this->transformAskJiminnyFields($report)\n : $base + $this->transformStandardReportFields($report);\n }\n\n private function transformReportBase(AutomatedReport $report): array\n {\n return [\n 'id' => $report->getUuid(),\n 'organization' => $this->transformOrganization(team: $report->getTeam()),\n 'report_type' => $this->transformReportType($report->getType()),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n ];\n }\n\n private function transformStandardReportFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n\n return [\n 'report_enabled' => $report->getStatus(),\n 'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),\n 'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),\n 'deal_value_min' => $report->getDealValueMin(),\n 'deal_value_max' => $report->getDealValueMax(),\n 'call_types' => $this->transformCallType($report->getCallTypes()),\n 'media_types' => $this->transformMediaTypes($report),\n 'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),\n 'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),\n 'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),\n 'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),\n 'recipients' => $this->transformRecipients($report->getRecipients()),\n 'created_by' => $this->transformCreator($report->getCreator()),\n 'additional_prompt_input' => $report->getAdditionalPromptInput(),\n 'custom_name' => $report->getCustomName(),\n 'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),\n 'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),\n 'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),\n ];\n }\n\n private function transformAskJiminnyFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n $creatorId = $report->getAttribute('created_by');\n $explicitUserIds = array_values(array_filter(\n $report->getRecipients()['users'] ?? [],\n static fn ($id) => $id !== $creatorId\n ));\n\n return [\n 'report_name' => $report->getCustomName(),\n 'enabled' => $report->getStatus(),\n 'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),\n 'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),\n 'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),\n 'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),\n ];\n }\n\n private function transformOrganization(?Team $team): array\n {\n return [\n 'id' => $team?->getUuid(),\n 'name' => $team?->getName(),\n ];\n }\n\n private function transformReportType(string $type): array\n {\n foreach (self::ALL_TYPES as $typeItem) {\n if ($typeItem['id'] === $type) {\n return $typeItem;\n }\n }\n\n return [];\n }\n\n private function transformCallType(array $types): array\n {\n $result = [];\n $callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];\n\n foreach ($types as $type) {\n foreach ($callTypes as $callTypeItem) {\n if ($callTypeItem['id'] === $type) {\n $result[] = $callTypeItem;\n\n break;\n }\n }\n }\n\n return $result;\n }\n\n private function transformMediaTypes(AutomatedReport $report): array\n {\n $values = [];\n\n foreach ($report->getMediaTypes() as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n continue;\n }\n\n $values[] = match ($mediaType) {\n self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,\n self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,\n };\n }\n\n return $values;\n }\n\n private function transformFrequency(string $frequency): array\n {\n foreach (self::ALL_FREQUENCIES as $frequencyItem) {\n if ($frequencyItem['id'] === $frequency) {\n return $frequencyItem;\n }\n }\n\n return [];\n }\n\n public function transformDurationToMinutes(?int $duration): ?int\n {\n if (! $duration) {\n return null;\n }\n\n return (int) ($duration / 60);\n }\n\n private function transformGroups(?Team $team, array $groupsIds): array\n {\n if (empty($groupsIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($groupsIds as $groupId) {\n $group = $team->groups()->where('id', $groupId)->first();\n\n if ($group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n 'photoUrl' => $group->getPhotoUrl(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformStages(?Team $team, array $stagesIds): array\n {\n if (empty($stagesIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($stagesIds as $stageId) {\n $stage = $team->stages()->where('id', $stageId)->first();\n\n if ($stage) {\n $data[] = [\n 'id' => $stage->getUuid(),\n 'name' => $stage->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformRecipients(array $recipients): array\n {\n $users = [];\n foreach ($recipients['users'] ?? [] as $userId) {\n $users[] = $this->transformUser($userId);\n }\n\n return $users;\n }\n\n private function transformCreator(?User $user): ?array\n {\n if ($user === null) {\n return null;\n }\n\n return $this->transformUser($user->getId());\n }\n\n private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array\n {\n if ($prompt === null) {\n return null;\n }\n\n return [\n 'id' => $prompt->getUuid(),\n 'name' => $prompt->getTitle(),\n ];\n }\n\n private function transformSafeSearch(?Search $search): ?array\n {\n if ($search === null) {\n return null;\n }\n\n return [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ];\n }\n\n private function transformUser(int $userId): array\n {\n /* @var ?User $user */\n $user = $this->userRepository->find($userId);\n\n return [\n 'id' => $user?->getUuid(),\n 'name' => $user?->getName(),\n 'email' => $user?->getEmailAddress(),\n 'photoUrl' => $user?->getPhotoUrl(),\n ];\n }\n\n public function create(array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $validatedData['created_by'] = auth()->id();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function update(string $uuid, array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $report = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $report) {\n throw new InvalidArgumentException('Report not found');\n }\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Create an Ask Jiminny report.\n */\n public function createAskJiminnyReport(array $data, User $creator): array\n {\n $validatedData = $this->validateAskJiminnyReportData($data, $creator);\n $validatedData['created_by'] = $creator->getId();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Update an Ask Jiminny report.\n */\n public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array\n {\n if (! $report->isAskJiminnyReport()) {\n throw new InvalidArgumentException('Report is not an Ask Jiminny report');\n }\n\n $validatedData = $this->validateAskJiminnyReportData($data, $user);\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array\n {\n $this->automatedReportsRepository->update($report, ['status' => $status]);\n\n return $this->transformReportFullView($report->fresh());\n }\n\n /**\n * Validate and transform data for Ask Jiminny reports.\n */\n private function validateAskJiminnyReportData(array $data, User $user): array\n {\n // Validate name\n $name = trim($data['report_name'] ?? '');\n if (empty($name)) {\n throw new InvalidArgumentException('Report name is required');\n }\n if (mb_strlen($name) > 50) {\n throw new InvalidArgumentException('Report name must be 50 characters or less');\n }\n\n // Validate frequency (only daily, weekly, monthly for Ask Jiminny)\n $frequency = $data['frequency'] ?? null;\n $askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];\n if (! in_array($frequency, $askJiminnyFrequencies, true)) {\n throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');\n }\n\n // Validate expiration date\n $expiresAt = $data['expires_on'] ?? null;\n if (empty($expiresAt)) {\n throw new InvalidArgumentException('Expiration date is required');\n }\n\n try {\n $expiresAtDate = Carbon::parse($expiresAt);\n } catch (InvalidFormatException $e) {\n throw new InvalidArgumentException('Expiration date format is invalid');\n }\n $maxExpiration = Carbon::now()->addYear()->endOfDay();\n if ($expiresAtDate->gt($maxExpiration)) {\n throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');\n }\n if ($expiresAtDate->isPast()) {\n throw new InvalidArgumentException('Expiration date cannot be in the past');\n }\n\n // Validate saved search\n $activitySearchId = $data['saved_search'] ?? null;\n if (empty($activitySearchId)) {\n throw new InvalidArgumentException('Saved search is required');\n }\n $savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);\n if (! $savedSearch) {\n throw new InvalidArgumentException('Saved search not found or does not belong to you');\n }\n\n // Validate saved prompt\n $askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;\n if (empty($askAnythingPromptId)) {\n throw new InvalidArgumentException('Ask Jiminny prompt is required');\n }\n $prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);\n if (! $prompt) {\n throw new InvalidArgumentException('Ask Jiminny prompt not found');\n }\n\n // Validate status\n $status = $data['enabled'] ?? false;\n\n $recipientUserIds = [$user->getId()];\n\n if (! empty($data['share_users'])) {\n $sharedUserIds = $this->validateAndGetUserIdsByTeam(\n $user->team,\n (array) $data['share_users']\n );\n $recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);\n }\n\n $sharedGroupIds = [];\n if (! empty($data['share_teams'])) {\n $sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);\n }\n\n $recipientUserIds = array_values(array_unique($recipientUserIds));\n\n return [\n 'team_id' => $user->getTeamId(),\n 'type' => self::TYPE_ASK_JIMINNY,\n 'status' => (bool) $status,\n 'frequency' => $frequency,\n 'custom_name' => $name,\n 'activity_search_id' => $savedSearch->getId(),\n 'ask_anything_prompt_id' => $prompt->getId(),\n 'expires_at' => $expiresAtDate->toDateString(),\n 'media_types' => [self::MEDIA_TYPE_PDF],\n 'call_types' => [],\n 'recipients' => ['users' => $recipientUserIds],\n 'groups' => $sharedGroupIds,\n ];\n }\n\n public static function getAskJiminnyFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::ASK_JIMINNY_FREQUENCIES);\n }\n\n public function getAskJiminnyReportFilters(User $user): array\n {\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n return [\n [\n 'id' => 'prompt',\n 'label' => 'Prompt',\n 'options' => $prompts,\n ],\n [\n 'id' => 'saved_search',\n 'label' => 'Saved Search',\n 'options' => $savedSearches,\n ],\n ];\n }\n\n public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array\n {\n $team = $user->getTeam();\n $userTimezone = $user->getTimezone();\n\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n $teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ])->values()->all();\n\n $shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];\n\n $sharedTeamsValue = [];\n $sharedUsersValue = [];\n if ($report) {\n $sharedTeamsValue = $this->transformGroups($team, $report->getGroups());\n\n $recipientUserIds = $report->getRecipients()['users'] ?? [];\n $creatorId = $report->getAttribute('created_by');\n $sharedUserIds = array_values(array_filter(\n $recipientUserIds,\n static fn ($id) => $id !== $creatorId\n ));\n $sharedUsersValue = collect($sharedUserIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (User $u) => [\n 'id' => $u->getUuid(),\n 'name' => $u->getName(),\n ])\n ->values()\n ->all();\n }\n\n return [\n 'fields' => [\n [\n 'id' => 'enabled',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'label' => '',\n 'value' => $report?->getStatus() ?? false,\n ],\n [\n 'id' => 'report_name',\n 'inputType' => InputTypeEnum::TEXT,\n 'label' => 'Name',\n 'placeholder' => 'Enter name',\n 'required' => true,\n 'validation' => ['maxLength' => 50],\n 'value' => $report?->getCustomName() ?? '',\n ],\n [\n 'id' => 'frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Frequency',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::ASK_JIMINNY_FREQUENCIES,\n 'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,\n ],\n [\n 'id' => 'expires_on',\n 'inputType' => InputTypeEnum::DATE,\n 'label' => 'Expires on',\n 'required' => true,\n 'placeholder' => 'Select',\n 'validation' => [\n 'minDate' => now($userTimezone)->toDateString(),\n 'maxDate' => now($userTimezone)->addYear()->toDateString(),\n ],\n 'value' => $report?->getExpiresAt()?->toDateString(),\n ],\n [\n 'id' => 'share_teams',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team',\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $teamGroups,\n 'value' => $sharedTeamsValue,\n ],\n [\n 'id' => 'share_users',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team member',\n 'required' => false,\n 'placeholder' => 'Select',\n 'groupLabelKey' => 'label',\n 'groupValuesKey' => 'users',\n 'optionLabelKey' => 'name',\n 'optionValueKey' => 'id',\n 'options' => $shareUsers,\n 'value' => $sharedUsersValue,\n ],\n [\n 'id' => 'saved_search',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Saved search',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $savedSearches,\n 'value' => $report && $report->getSavedSearch() ? [\n 'id' => $report->getSavedSearch()->getUuid(),\n 'name' => $report->getSavedSearch()->getName(),\n ] : null,\n ],\n [\n 'id' => 'ask_jiminny_prompt',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Ask Jiminny prompt',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $prompts,\n 'value' => $report && $report->getAskAnythingPrompt() ? [\n 'id' => $report->getAskAnythingPrompt()->getUuid(),\n 'name' => $report->getAskAnythingPrompt()->getTitle(),\n ] : null,\n ],\n ],\n ];\n }\n\n private function updateResultNames(AutomatedReport $automatedReport): void\n {\n $results = $this->automatedReportsRepository->getResultsByReport($automatedReport);\n\n foreach ($results as $result) {\n $result->update(['name' => $this->getReportFileName($result)]);\n }\n }\n\n public function updateStatus(string $uuid, array $data): array\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $automatedReport->update([\n 'status' => $status,\n ]);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n private function generateOneOffReport(AutomatedReport $automatedReport): void\n {\n // the scheduler handles all the other frequency types\n if ($automatedReport->getStatus() === false || $automatedReport->getFrequency() !== self::FREQUENCY_ONE_OFF) {\n return;\n }\n\n $this->dispatcher->dispatch(new RequestGenerateReportJob($automatedReport->getUuid()));\n }\n\n public function getReport(string $uuid): AutomatedReport\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n return $automatedReport;\n }\n\n public function get(string $uuid): array\n {\n $automatedReport = $this->getReport($uuid);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function list(string $sortColumn = 'created_at', string $sortDirection = 'desc'): array\n {\n $results = [];\n $collection = $this->automatedReportsRepository->getAllStandardReports($sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function listAskJiminnyReports(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): array {\n $results = [];\n $collection = $this->automatedReportsRepository->getAskJiminnyReportsByUser($user, $sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function delete(string $uuid): void\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $automatedReport->delete();\n }\n\n public function createReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n return $this->automatedReportsRepository->createResult(\n array_merge(\n [\n 'report_id' => $automatedReport->getId(),\n 'status' => AutomatedReportResult::STATUS_DEFAULT,\n ],\n $data\n )\n );\n }\n\n public function getOrCreateReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n $existing = $this->automatedReportsRepository->findLatestDefaultOrFailedResult($automatedReport);\n\n if ($existing !== null) {\n $existing->update(['status' => AutomatedReportResult::STATUS_DEFAULT]);\n\n return $existing;\n }\n\n return $this->createReportResult($automatedReport, $data);\n }\n\n public function getReportResult(string $resultUuid): AutomatedReportResult\n {\n $report = $this->automatedReportsRepository->findResultByUuid($resultUuid);\n\n if (! $report) {\n throw new ModelNotFoundException('Report Result not found');\n }\n\n return $report;\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return $this->automatedReportsRepository->findChildResult($result, $type);\n }\n\n // prophet API calls\n /**\n * @throws ApplicationException\n */\n public function getGenerateReportPayload(AutomatedReport $automatedReport, string $reportResultUuid): array\n {\n $period = $this->calculateFromAndToDate($automatedReport);\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n return [\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResultUuid,\n 'report_type' => $automatedReport->getType(),\n 'media_types' => $automatedReport->getMediaTypes(),\n 'from_date' => $fromDate->startOfDay()->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->endOfDay()->format(DateTimeInterface::RFC3339),\n 'group_ids' => $automatedReport->getGroups(),\n 'call_deal_stage' => $automatedReport->getDealAtCallStages(),\n 'current_deal_stage' => $automatedReport->getCurrentDealStages(),\n 'deal_min_value' => $automatedReport->getDealValueMin(),\n 'deal_max_value' => $automatedReport->getDealValueMax(),\n 'call_types' => $automatedReport->getCallTypes(),\n 'call_duration_min_seconds' => $automatedReport->getCallDurationMin(),\n 'call_duration_max_seconds' => $automatedReport->getCallDurationMax(),\n 'special_requirements' => $automatedReport->getAdditionalPromptInput(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->formatReportPeriodName(\n $automatedReport->getFrequency(),\n $fromDate,\n $toDate,\n ),\n 'playbook_categories' => $automatedReport->getPlaybookCategories(),\n 'custom_name' => $automatedReport->getCustomName(),\n ];\n }\n\n // $inputPayload - FE payload structure\n public function getActivitiesCountPayload(array $inputPayload): array\n {\n // Use validateAndTransformData to validate and normalize input\n $validatedData = $this->validateAndTransformData($inputPayload);\n $period = $this->calculateFromAndToDatePeriod(\n $validatedData['frequency'],\n Carbon::parse($validatedData['from']),\n Carbon::parse($validatedData['to']),\n );\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n // Create payload similar to getGenerateReportPayload\n return [\n 'team_id' => $validatedData['team_id'],\n 'group_ids' => $validatedData['groups'] ?? [],\n 'report_type' => $validatedData['type'],\n 'from_date' => $fromDate->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->format(DateTimeInterface::RFC3339),\n 'call_deal_stage' => $validatedData['deal_at_call_stages'] ?? [],\n 'current_deal_stage' => $validatedData['current_deal_stages'] ?? [],\n 'deal_min_value' => $validatedData['deal_value_min'] ?? null,\n 'deal_max_value' => $validatedData['deal_value_max'] ?? null,\n 'call_types' => $validatedData['call_types'],\n 'call_duration_min_seconds' => $validatedData['call_duration_min'] ?? null,\n 'call_duration_max_seconds' => $validatedData['call_duration_max'] ?? null,\n 'special_requirements' => $validatedData['additional_prompt_input'] ?? null,\n 'playbook_categories' => $validatedData['playbook_categories'] ?? [],\n 'request_id' => null,\n 'callback_url' => null,\n ];\n }\n\n public function shouldSendReport(array $users, ?CarbonInterface $generatedAt = null): bool\n {\n if (empty($users)) {\n return false;\n }\n\n $earliestTz = collect($users)\n ->mapWithKeys(function (array $user) {\n $tz = new DateTimeZone($user['timezone']);\n $nowUtc = new DateTime('now', new DateTimeZone('UTC'));\n $offset = $tz->getOffset($nowUtc);\n\n return [$user['timezone'] => $offset];\n })\n ->sortDesc()\n ->keys()\n ->first();\n\n $now = Carbon::now($earliestTz);\n $isScheduledTime = (int) $now->format('H') === self::SENT_REPORT_AT_HOURS;\n\n if ($isScheduledTime) {\n return true;\n }\n\n return $this->hasPassedScheduledTime($generatedAt, $earliestTz);\n }\n\n public function hasPassedScheduledTime(?CarbonInterface $generatedAt, string $timezone): bool\n {\n if ($generatedAt === null) {\n return false;\n }\n\n $now = Carbon::now($timezone);\n $scheduledTime = $now->copy()->setTime(self::SENT_REPORT_AT_HOURS, 0, 0);\n\n if ($now->hour < self::SENT_REPORT_AT_HOURS) {\n $scheduledTime = $scheduledTime->subDay();\n }\n\n $scheduledTimeUtc = $scheduledTime->copy()->utc();\n $generatedAtUtc = $generatedAt->copy()->utc();\n $nowUtc = $now->copy()->utc();\n\n return $generatedAtUtc->lt($scheduledTimeUtc) && $nowUtc->gt($scheduledTimeUtc);\n }\n\n public function calculateFromAndToDatePeriod(\n string $frequency,\n ?Carbon $fromDate = null,\n ?Carbon $toDate = null\n ): array {\n if ($frequency === self::FREQUENCY_ONE_OFF) {\n return [\n 'fromDate' => $fromDate,\n 'toDate' => $toDate,\n ];\n }\n\n $now = Carbon::now();\n\n return match ($frequency) {\n self::FREQUENCY_DAILY => [\n 'fromDate' => $now->copy()->subDay()->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_WEEKLY => [\n 'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_MONTHLY => [\n 'fromDate' => $now->copy()->subMonths(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_QUARTERLY => [\n 'fromDate' => $now->copy()->subMonths(3)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n default => throw new InvalidArgumentException(\"Unsupported frequency: {$frequency}\"),\n };\n }\n\n private function calculateFromAndToDate(AutomatedReport $automatedReport): array\n {\n return $this->calculateFromAndToDatePeriod(\n $automatedReport->getFrequency(),\n $automatedReport->getFrom(),\n $automatedReport->getTo()\n );\n }\n\n public function getAskJiminnyGenerateReportPayload(\n AutomatedReport $automatedReport,\n AutomatedReportResult $reportResult,\n array $activityIds,\n ): array {\n return [\n 'user_question' => $automatedReport->getAskAnythingPrompt()?->getContent(),\n 'call_ids' => array_map('strval', $activityIds),\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResult->getUuid(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->getReportPeriodName($reportResult),\n 'report_name' => $automatedReport->getCustomName(),\n ];\n }\n\n private function getCallbackUrl(): string\n {\n return $this->webhookService->route('jiminny.webhook.reports.ready');\n }\n\n /**\n * Validate and transform payload data for automated reports\n *\n * @param array $data\n *\n * @throws InvalidArgumentException\n *\n * @return array\n */\n private function validateAndTransformData(array $data): array\n {\n // Validate organization (team) and check feature\n $team = $this->validateOrganization($data['organization'] ?? null);\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $type = $this->validateReportType($data['report_type'] ?? null);\n $frequency = $this->validateFrequency($data['frequency'] ?? null);\n $additionalPromptInput = $this->validateAdditionalPromptInput(\n $data['additional_prompt_input'] ?? null\n );\n $customReportName = $this->validateCustomReportName($data['custom_name'] ?? null);\n\n // Prepare data for the database\n $reportData = [\n 'team_id' => $team->getId(),\n 'type' => $type,\n 'status' => $status,\n 'frequency' => $frequency,\n 'additional_prompt_input' => $additionalPromptInput,\n 'custom_name' => $customReportName,\n ];\n\n // Validate deal values\n $reportData = $this->validateDealValues($data, $reportData);\n\n // Validate date range\n $reportData = $this->validateDateRange($data, $reportData, $frequency);\n\n // Validate call durations\n $reportData = $this->validateCallDurations($data, $reportData);\n\n // Validate call types\n $reportData = $this->validateCallTypes($data, $reportData);\n\n // Validate media types\n $reportData = $this->validateMediaTypes($data, $reportData);\n\n // Validate groups\n if (isset($data['teams'])) {\n $reportData['groups'] = $this->validateAndGetGroupIds($team, $data['teams']);\n }\n\n // Validate deal stages\n $reportData = $this->validateDealStages($data, $reportData, $team, $type);\n\n // Validate playbook categories\n $reportData = $this->validatePlaybookCategories($data, $reportData, $team);\n\n // Validate recipients\n $reportData['recipients'] = [\n 'users' => $this->validateAndGetUserIdsByTeam($team, $data['recipients'] ?? []),\n ];\n\n if (isset($data['jiminny_recipients'])) {\n // Validate Jiminny recipients\n $reportData['jiminny_recipients'] = [\n 'users' => $this->validateAndGetJiminnyUserIds((array) $data['jiminny_recipients']),\n ];\n }\n\n return $reportData;\n }\n\n private function validateDealValues(array $data, array $reportData): array\n {\n if (isset($data['min_deal_value'])) {\n $reportData['deal_value_min'] = (int) $data['min_deal_value'];\n\n if ($reportData['deal_value_min'] > 4294967295 || $reportData['deal_value_min'] < 0) {\n throw new InvalidArgumentException('Min deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_deal_value'])) {\n $reportData['deal_value_max'] = (int) $data['max_deal_value'];\n\n if ($reportData['deal_value_max'] > 4294967295 || $reportData['deal_value_max'] < 0) {\n throw new InvalidArgumentException('Max deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['min_deal_value'], $data['max_deal_value'])\n && $data['min_deal_value'] > $data['max_deal_value']\n ) {\n throw new InvalidArgumentException('Min deal value cannot be greater than max deal value');\n }\n\n return $reportData;\n }\n\n private function validateDateRange(array $data, array $reportData, string $frequency): array\n {\n // Set date range only for one_off frequency\n if ($frequency === 'one_off') {\n if (isset($data['start_date_period'])) {\n $reportData['from'] = $this->parseDate($data['start_date_period']);\n }\n\n if (isset($data['end_date_period'])) {\n $reportData['to'] = $this->parseDate($data['end_date_period']);\n }\n\n if (empty($reportData['from']) || empty($reportData['to'])) {\n throw new InvalidArgumentException(\n 'Start date and end date are required for one_off frequency'\n );\n }\n } else {\n $reportData['from'] = null;\n $reportData['to'] = null;\n }\n\n return $reportData;\n }\n\n private function validateCallDurations(array $data, array $reportData): array\n {\n // Convert call durations from minutes to seconds\n if (isset($data['min_call_duration'])) {\n $reportData['call_duration_min'] = (int) $data['min_call_duration'] * 60;\n\n if ($reportData['call_duration_min'] > 4294967295 || $reportData['call_duration_min'] < 0) {\n throw new InvalidArgumentException('Min call duration should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_call_duration'])) {\n $reportData['call_duration_max'] = (int) $data['max_call_duration'] * 60;\n\n if ($reportData['call_duration_max'] > 4294967295 || $reportData['call_duration_max'] < 0) {\n throw new InvalidArgumentException('Max call duration should be between 0 and 4294967295');\n }\n }\n\n return $reportData;\n }\n\n private function validateCallTypes(array $data, array $reportData): array\n {\n // Set call types\n $reportData['call_types'] = $data['call_type'] ?? [];\n if (empty($reportData['call_types'])) {\n $reportData['call_types'] = self::getCallTypes();\n }\n\n foreach ($reportData['call_types'] as $callType) {\n if (! in_array($callType, self::getCallTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Call type %s is invalid', $callType));\n }\n }\n\n return $reportData;\n }\n\n private function validateMediaTypes(array $data, array $reportData): array\n {\n // Set media types from input data\n $reportData['media_types'] = $data['media_types'] ?? [];\n\n if (empty($reportData['media_types'])) {\n throw new InvalidArgumentException('Media types are required');\n }\n\n foreach ($reportData['media_types'] as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n throw new InvalidArgumentException(sprintf('Media type %s is invalid', $mediaType));\n }\n }\n\n return $reportData;\n }\n\n private function validateDealStages(array $data, array $reportData, Team $team, string $reportType): array\n {\n // Validate and set deal stages\n if (isset($data['deal_stage_at_call'])) {\n $reportData['deal_at_call_stages'] =\n $this->validateAndGetDealStageIds($team, $data['deal_stage_at_call'], 'Deal stage at call');\n }\n\n if (isset($data['current_deal_stage'])) {\n $reportData['current_deal_stages'] =\n $this->validateAndGetDealStageIds($team, $data['current_deal_stage'], 'Current deal stage');\n }\n\n // Ensure current_deal_stage is not provided for loss_analysis report type\n if ($reportType === self::TYPE_LOSS_ANALYSIS && ! empty($data['current_deal_stage'])) {\n throw new InvalidArgumentException('Current deal stage is not applicable for Loss Analysis reports');\n }\n\n return $reportData;\n }\n\n // transform uuid to id\n private function validatePlaybookCategories(array $data, array $reportData, Team $team): array\n {\n $key = 'playbook_categories';\n\n if (isset($data[$key])) {\n $payloadIds = $data[$key];\n $ids = [];\n\n foreach ($payloadIds as $uuid) {\n $uuid = (string) $uuid;\n\n try {\n $playbookCategory = $this->playbookCategoryRepository->findByUuid($uuid);\n } catch (Throwable $throwable) {\n Log::error(__METHOD__ . ' ' . $throwable->getMessage());\n\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory) {\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory->hasPlaybook()) {\n throw new InvalidArgumentException(sprintf('Playbook category %s has no playbook', $uuid));\n }\n\n if ($playbookCategory->getPlaybook()->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Playbook category %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $ids[] = $playbookCategory->getId();\n }\n\n $reportData[$key] = $ids;\n }\n\n return $reportData;\n }\n\n private function validateReportStatus($status): bool\n {\n if (! in_array($status, [true, false], true)) {\n throw new InvalidArgumentException('Report status is invalid');\n }\n\n return $status;\n }\n\n private function validateReportType($type): string\n {\n if (! in_array($type, self::getTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Report type is invalid: %s', $type));\n }\n\n return $type;\n }\n\n private function validateFrequency($frequency): string\n {\n if (! in_array($frequency, self::getFrequencies(), true)) {\n throw new InvalidArgumentException('Frequency is invalid');\n }\n\n return $frequency;\n }\n\n private function validateAdditionalPromptInput(?string $additionalPromptInput): ?string\n {\n if ($additionalPromptInput && strlen($additionalPromptInput) > 5000) {\n throw new InvalidArgumentException('Additional Prompt Input should be less than 5000 characters');\n }\n\n return $additionalPromptInput;\n }\n\n private function validateCustomReportName(?string $customReportName): ?string\n {\n if ($customReportName === null || $customReportName === '') {\n return null;\n }\n\n if (strlen($customReportName) > 70) {\n throw new InvalidArgumentException('Custom report name should be less than 70 characters');\n }\n\n return $customReportName;\n }\n\n private function validateOrganization(?string $organizationUuid): Team\n {\n if (! $organizationUuid) {\n throw new InvalidArgumentException('Organization is required');\n }\n\n $team = $this->teamRepository->idOrUuid($organizationUuid);\n\n if (! $team) {\n throw new InvalidArgumentException('Organization not found');\n }\n\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n throw new InvalidArgumentException('Organization does not have the Automated Reports feature');\n }\n\n return $team;\n }\n\n private function validateAndGetGroupIds(Team $team, array $teamUuids): array\n {\n $groupIds = [];\n\n foreach ($teamUuids as $uuid) {\n $group = $this->groupRepository->findByUuid($uuid);\n\n if ($group === null || $group->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Group %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $groupIds[] = $group->getId();\n\n }\n\n return $groupIds;\n }\n\n private function validateAndGetDealStageIds(Team $team, array $stageUuids, string $propertyLabel): array\n {\n $stageIds = [];\n\n foreach ($stageUuids as $uuid) {\n $stage = $this->stageRepository->findByUuid($uuid);\n\n if ($stage === null || $stage->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Stage %s not found for team %s for %s', $uuid, $team->getUuid(), $propertyLabel)\n );\n }\n\n $stageIds[] = $stage->getId();\n }\n\n return $stageIds;\n }\n\n private function validateAndGetUserIds(array $userUuids, callable $teamCheck): array\n {\n if (empty($userUuids)) {\n return [];\n }\n\n $userIds = [];\n\n foreach ($userUuids as $uuid) {\n $user = $this->userRepository->findByUuid($uuid);\n\n if (! $user || ! $user->isStatusActive()) {\n throw new InvalidArgumentException(\n sprintf('User %s not found or is not active', $uuid)\n );\n }\n\n if (! $teamCheck($user)) {\n throw new InvalidArgumentException(\n sprintf('User %s does not belong to the allowed team(s)', $uuid)\n );\n }\n\n $userIds[] = $user->getId();\n }\n\n return $userIds;\n }\n\n private function validateAndGetUserIdsByTeam(Team $team, array $userUuids): array\n {\n return $this->validateAndGetUserIds($userUuids, fn ($user) => $user->getTeamId() === $team->getId());\n }\n\n private function validateAndGetJiminnyUserIds(array $userUuids): array\n {\n $allowedTeamIds = config('kiosk.teamIds', []);\n\n return $this->validateAndGetUserIds($userUuids, fn ($user) => in_array($user->getTeamId(), $allowedTeamIds, true));\n }\n\n private function parseDate(string $dateString): string\n {\n return date('Y-m-d H:i:s', strtotime($dateString));\n }\n\n private function generateReportResultViewUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.view', ['uuid' => $result->getUuid()]);\n }\n\n private function generateReportResultDownloadUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.download', ['uuid' => $result->getUuid()]);\n }\n\n private function getReportMediaRouteResource(AutomatedReportResult $result): string\n {\n if ($result->getMediaType() === self::MEDIA_TYPE_PDF) {\n return self::PDF_KEY;\n } elseif ($result->getMediaType() === self::MEDIA_TYPE_PODCAST) {\n return self::AUDIO_KEY;\n }\n\n throw new \\InvalidArgumentException('Unknown media type.');\n }\n\n public function getMediaPath(AutomatedReportResult $result): ?string\n {\n $url = match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => $result->getPdfUrl(),\n self::MEDIA_TYPE_PODCAST => $result->getPodcastAudioUrl(),\n default => null,\n };\n\n if ($url === null) {\n return null;\n }\n\n $path = parse_url(trim($url, '\"\\''), PHP_URL_PATH);\n\n return $path ?: null;\n }\n\n public function getFilenameSuffix(AutomatedReportResult $result): ?string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => 'Podcast',\n default => null,\n };\n }\n\n public function getMailSubjectSuffix(AutomatedReportResult $result): string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => 'report',\n self::MEDIA_TYPE_PODCAST => 'podcast',\n default => '',\n };\n }\n\n public function getMediaTypeMetadata(AutomatedReportResult $result): array\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => ['extension' => 'mp3', 'mime' => 'audio/mpeg'],\n self::MEDIA_TYPE_PDF => ['extension' => 'pdf', 'mime' => 'application/pdf'],\n default => ['extension' => null, 'mime' => null],\n };\n }\n\n public function deleteS3Files(AutomatedReportResult $result): void\n {\n $teamUuid = $result->getReport()->getTeam()->getUuid();\n $reportUuid = $result->getUuid();\n\n // delete all files for a report uuid no mather of pdf, podcast, or both\n // in case of both - the podcast files are linked to the pdf (parent) uuid\n // pdf and podcast date times should be close\n $path = sprintf('%s/%s/%s', $teamUuid, self::S3_DIR, $reportUuid);\n\n foreach (self::FILE_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted S3 file', [\n 'path' => $file,\n ]);\n }\n }\n\n foreach (self::FILE_PODCAST_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '_podcast.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted Podcast S3 file', [\n 'path' => $file,\n ]);\n }\n }\n }\n\n /**\n *\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): Collection\n {\n return $this->automatedReportsRepository->getTeamIdsWithReportsResults($teamId);\n }\n\n /**\n * Core delete logic for report results using a query\n *\n * @param Builder $query\n * @param array $logContext\n *\n * @return int\n */\n private function deleteReportResultsByQuery(Builder $query, array $logContext = []): int\n {\n $deletedCount = 0;\n\n if ($query->exists()) {\n Log::info(\n 'Run delete report results',\n array_merge(\n $logContext,\n [\n 'service' => 'AutomatedReportsService',\n ]\n )\n );\n\n $query->chunkById(50, function ($results) use (&$deletedCount, $logContext) {\n foreach ($results as $result) {\n $this->deleteReportResult($result);\n $deletedCount++;\n\n Log::info(\n 'Deleted a report result',\n array_merge(\n $logContext,\n [\n 'result_id' => $result->getId(),\n 'report_id' => $result->getReportId(),\n ]\n )\n );\n }\n });\n }\n\n return $deletedCount;\n }\n\n /**\n * Delete report results for a team by retention period\n *\n * @param Team $team\n * @param CarbonImmutable $retentionDate\n *\n * @return int Number of deleted report results\n */\n public function deleteReportsResultsInRetentionPeriod(Team $team, CarbonImmutable $retentionDate): int\n {\n $reportIds = $this->automatedReportsRepository->getReportIdsByTeam($team);\n\n if ($reportIds->isEmpty()) {\n return 0;\n }\n\n $query = $this->automatedReportsRepository\n ->getReportResultsQueryForRetention($team, $retentionDate);\n\n return $this->deleteReportResultsByQuery($query, [\n 'team_id' => $team->getId(),\n 'retention_date' => $retentionDate->toDateTimeString(),\n ]);\n }\n\n /**\n * Delete ALL report results for a specific automated report\n *\n * @param string $uuid\n *\n * @return int\n */\n public function deleteReportResults(string $uuid): int\n {\n $report = $this->getReport($uuid);\n\n $query = $this->automatedReportsRepository->getResultsByReportQuery($report);\n\n return $this->deleteReportResultsByQuery($query, [\n 'report_uuid' => $uuid,\n 'report_id' => $report->getId(),\n ]);\n }\n\n public function deleteReportResult(AutomatedReportResult $result): void\n {\n $this->deleteS3Files($result);\n\n $result->delete();\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getTeamReports(Team $team): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getReportsByTeam($team);\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getReportResults(AutomatedReport $report): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getResultsByReport($report);\n }\n\n public function deleteAllReportResults(AutomatedReport $report): void\n {\n $results = $this->getReportResults($report);\n\n /** @var AutomatedReportResult $result */\n foreach ($results as $result) {\n Log::info('Deleting result', [\n 'report' => $report->getId(),\n 'result' => $result->getId(),\n ]);\n\n $this->deleteReportResult($result);\n }\n }\n\n public function deleteAllData(Team $team): void\n {\n Log::info('Deleting automated report and results for team', [\n 'team' => $team->getId(),\n ]);\n\n $reports = $this->getTeamReports($team);\n\n /** @var AutomatedReport $report */\n foreach ($reports as $report) {\n Log::info('Deleting report', [\n 'team' => $team->getId(),\n 'report' => $report->getId(),\n ]);\n\n $this->deleteAllReportResults($report);\n\n $report->delete();\n }\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"18","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"14","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"2","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"4","depth":4,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o\nJOIN activities a ON o.id = a.opportunity_id\nWHERE a.crm_configuration_id = 39\nAND a.actual_start_time > '2025-10-13'\nAND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM activities\nWHERE crm_configuration_id = 39 and user_id = 143\nand actual_start_time >= '2025-10-13'\nAND type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM opportunities WHERE account_id IN (178);\nselect * from activities where id IN (620137, 620187, 620188, 620189, 620230);\n\n# HS\nSELECT * FROM opportunities WHERE id IN (238);\nselect * from activities where id IN (477,2076);\n\nselect * from users;\n\nSELECT COUNT(*) FROM users;\nSELECT COUNT(*) FROM activities;\nSELECT COUNT(*) FROM opportunities;\n\nUPDATE activities\nSET\n actual_start_time = '2025-12-19 09:00:00',\n actual_end_time = '2025-12-19 10:30:00',\n scheduled_start_time = '2025-12-19 09:00:00',\n scheduled_end_time = '2025-12-19 10:30:00'\nWHERE id IN (407509,407375);\n\nselect * from partners;\n\nSELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id\nFROM activities\nWHERE user_id = 143\nAND actual_start_time >= '2025-10-13 00:00:00'\nAND actual_start_time <= '2026-01-13 23:59:59'\nORDER BY actual_start_time DESC;\n\nSELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;\nSELECT * FROM crm_layouts where crm_configuration_id = 39;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;\n# lead_id\n# account_id 177\n# contact_id 3969\n# opportunity_id\n# stage_id 203\n\nSELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;\n\nSELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'\nAND user_id = 143 and actual_start_time >= '2025-10-13';\n\nSELECT * FROM activities a\n# JOIN opportunities o ON a.opportunity_id = o.id\nWHERE a.crm_configuration_id = 39 AND a.type = 'conference'\nand status = 'completed' and recording_state = 'recorded'\nand a.actual_start_time >= '2025-10-13'\nAND a.user_id = 143\n;\n\nselect * from leads\nwhere crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707\n\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310);\nSELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198\nSELECT * FROM activities WHERE id IN (356001, 356008); # contacts:\n\nSELECT * FROM opportunities WHERE id IN (1707);\nSELECT * FROM stages where id IN (204, 198);\nSELECT * FROM opportunities WHERE account_id IN (178);\nSELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';\nSELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal\n\nSELECT * FROM activities where crm_configuration_id = 39\nAND opportunity_id IS NULL\nAND is_internal = false\nand status = 'completed' and recording_state = 'recorded'\nAND actual_start_time >= '2025-10-13'\nAND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)\n# AND lead_id IN (112, 109)\n;\n\nSELECT * FROM crm_profiles WHERE user_id = 143;\n\nselect * from inboxes; # 212\nselect * from users where id = 143; # 143\nselect * from inbox_email_batches where inbox_id = 212\nand updated_at >= '2026-01-28 00:00:00' order by id desc;\nselect * from inbox_emails where inbox_id = 212\nand batch_id = 95885 order by id desc;\nselect * from email_messages where origin_user_id = 143;\nselect * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';\nselect * from participants where activity_id = 620247;\n\nselect * from crm_profiles where user_id = 143;\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001\nselect * from transcription where activity_id = 356001; # 6943\nselect * from ai_prompts where transcription_id = 6943;\nSELECT * FROM activity_summary_logs where activity_id = 356001;\n\nSELECT * FROM social_accounts WHERE sociable_id = 143;\n\n# ************************************************************************************\nSELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;\n# 422515 softphone tr. 8100\n\nSELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;\n# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS\n\nselect * from ai_prompts where transcription_id IN (8100, 7670);\nselect * from activity_summary_logs where activity_id = 407509;\n\nselect * from sidekick_settings;\nselect * from default_activity_types;\n\nSELECT * FROM contacts WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\nSELECT * FROM leads WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\n\nSELECT * FROM activity_searches where user_id = 143;\nSELECT * FROM groups where team_id = 1;\n\nselect * from teams where id = 1;\nselect * from groups where team_id = 1; # 1150 - 7e75f8025c22\nselect id, name, group_id, status, deleted_at, email\nfrom users where team_id = 1 order by group_id desc ;\n\nselect * from activity_searches where id in (1977, 1978, 1979);\nselect * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);\nselect * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277\nselect * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879\n\nINSERT INTO `activity_search_filters`\n(`activity_search_id`, `filter`, `value`) VALUES\n(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')\n;\n\nselect * from crm_configurations where id = 39;\n\n\nselect sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id\nwhere u.team_id = 1;\nSELECT * FROM social_accounts WHERE sociable_id = 1635;\nSELECT * FROM users WHERE id = 1635;\n\nselect * from teams where id = 1;\nselect * from users where team_id = 1;\nselect * from team_features where team_id = 1;\nselect * from features;\n\nSELECT * FROM activity_searches where id = 1982; # 1981\nSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;\n\nSELECT * FROM automated_reports where id = 68;\nUPDATE automated_reports set playbook_categories = NULL where id = 68;\nSELECT * FROM automated_report_results where id = 275;\n\nSELECT * FROM automated_reports order by id desc;\nSELECT * FROM automated_report_results order by id desc;\nselect * from activity_searches where user_id = 143;\nselect * from ask_anything_prompts;\n\nSELECT * FROM groups WHERE id = 1439;\nSELECT * FROM users WHERE group_id = 1439;\n\nselect * from permissions; # 158\nselect * from roles;\nselect * from permission_role\n\nselect * from teams where id = 1;\nselect * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;\nselect * from groups where id = 28;\nselect * from playbooks where team_id = 1;\nselect * from playbooks where id = 179;\nselect * from playbook_categories where id = 1391;\nselect * from users where id = 143;\nselect * from crm_profiles where user_id = 143;\nselect * from activities where crm_configuration_id = 39 and type = 'conference'\nand crm_provider_id IS NOT NULL ORDER by id desc;\nselect * from activities where id = 422003; # 00UO400000pB6fpMAC\n\nSELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type\nFROM automated_report_results ar\nJOIN automated_reports a ON a.id = ar.report_id\nWHERE a.type = 'ask_jiminny'\nLIMIT 10;\n\nSELECT `automated_report_results`.* FROM `automated_report_results`\nINNER JOIN `automated_reports`\n ON `automated_report_results`.`report_id` = `automated_reports`.`id`\nWHERE `automated_report_results`.`generated_at` IS NOT NULL\n AND `automated_reports`.`team_id` = 1\n AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$.\"users\"')\n;\n\n\nselect * from teams where id = 3143;\nselect * from crm_configurations where id = 500;\nselect * from users where name = 'Integration Account'; # 1695\nSELECT * FROM social_accounts WHERE sociable_id = 1695;\n\nselect * from activities where crm_configuration_id = 39\nand recording_state = 'recorded' and duration > 60\nand status = 'completed' and actual_start_time >= '2025-12-01';\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;\n\nselect * from leads;","depth":4,"value":"SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o\nJOIN activities a ON o.id = a.opportunity_id\nWHERE a.crm_configuration_id = 39\nAND a.actual_start_time > '2025-10-13'\nAND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM activities\nWHERE crm_configuration_id = 39 and user_id = 143\nand actual_start_time >= '2025-10-13'\nAND type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM opportunities WHERE account_id IN (178);\nselect * from activities where id IN (620137, 620187, 620188, 620189, 620230);\n\n# HS\nSELECT * FROM opportunities WHERE id IN (238);\nselect * from activities where id IN (477,2076);\n\nselect * from users;\n\nSELECT COUNT(*) FROM users;\nSELECT COUNT(*) FROM activities;\nSELECT COUNT(*) FROM opportunities;\n\nUPDATE activities\nSET\n actual_start_time = '2025-12-19 09:00:00',\n actual_end_time = '2025-12-19 10:30:00',\n scheduled_start_time = '2025-12-19 09:00:00',\n scheduled_end_time = '2025-12-19 10:30:00'\nWHERE id IN (407509,407375);\n\nselect * from partners;\n\nSELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id\nFROM activities\nWHERE user_id = 143\nAND actual_start_time >= '2025-10-13 00:00:00'\nAND actual_start_time <= '2026-01-13 23:59:59'\nORDER BY actual_start_time DESC;\n\nSELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;\nSELECT * FROM crm_layouts where crm_configuration_id = 39;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;\n# lead_id\n# account_id 177\n# contact_id 3969\n# opportunity_id\n# stage_id 203\n\nSELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;\n\nSELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'\nAND user_id = 143 and actual_start_time >= '2025-10-13';\n\nSELECT * FROM activities a\n# JOIN opportunities o ON a.opportunity_id = o.id\nWHERE a.crm_configuration_id = 39 AND a.type = 'conference'\nand status = 'completed' and recording_state = 'recorded'\nand a.actual_start_time >= '2025-10-13'\nAND a.user_id = 143\n;\n\nselect * from leads\nwhere crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707\n\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310);\nSELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198\nSELECT * FROM activities WHERE id IN (356001, 356008); # contacts:\n\nSELECT * FROM opportunities WHERE id IN (1707);\nSELECT * FROM stages where id IN (204, 198);\nSELECT * FROM opportunities WHERE account_id IN (178);\nSELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';\nSELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal\n\nSELECT * FROM activities where crm_configuration_id = 39\nAND opportunity_id IS NULL\nAND is_internal = false\nand status = 'completed' and recording_state = 'recorded'\nAND actual_start_time >= '2025-10-13'\nAND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)\n# AND lead_id IN (112, 109)\n;\n\nSELECT * FROM crm_profiles WHERE user_id = 143;\n\nselect * from inboxes; # 212\nselect * from users where id = 143; # 143\nselect * from inbox_email_batches where inbox_id = 212\nand updated_at >= '2026-01-28 00:00:00' order by id desc;\nselect * from inbox_emails where inbox_id = 212\nand batch_id = 95885 order by id desc;\nselect * from email_messages where origin_user_id = 143;\nselect * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';\nselect * from participants where activity_id = 620247;\n\nselect * from crm_profiles where user_id = 143;\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001\nselect * from transcription where activity_id = 356001; # 6943\nselect * from ai_prompts where transcription_id = 6943;\nSELECT * FROM activity_summary_logs where activity_id = 356001;\n\nSELECT * FROM social_accounts WHERE sociable_id = 143;\n\n# ************************************************************************************\nSELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;\n# 422515 softphone tr. 8100\n\nSELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;\n# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS\n\nselect * from ai_prompts where transcription_id IN (8100, 7670);\nselect * from activity_summary_logs where activity_id = 407509;\n\nselect * from sidekick_settings;\nselect * from default_activity_types;\n\nSELECT * FROM contacts WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\nSELECT * FROM leads WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\n\nSELECT * FROM activity_searches where user_id = 143;\nSELECT * FROM groups where team_id = 1;\n\nselect * from teams where id = 1;\nselect * from groups where team_id = 1; # 1150 - 7e75f8025c22\nselect id, name, group_id, status, deleted_at, email\nfrom users where team_id = 1 order by group_id desc ;\n\nselect * from activity_searches where id in (1977, 1978, 1979);\nselect * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);\nselect * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277\nselect * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879\n\nINSERT INTO `activity_search_filters`\n(`activity_search_id`, `filter`, `value`) VALUES\n(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')\n;\n\nselect * from crm_configurations where id = 39;\n\n\nselect sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id\nwhere u.team_id = 1;\nSELECT * FROM social_accounts WHERE sociable_id = 1635;\nSELECT * FROM users WHERE id = 1635;\n\nselect * from teams where id = 1;\nselect * from users where team_id = 1;\nselect * from team_features where team_id = 1;\nselect * from features;\n\nSELECT * FROM activity_searches where id = 1982; # 1981\nSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;\n\nSELECT * FROM automated_reports where id = 68;\nUPDATE automated_reports set playbook_categories = NULL where id = 68;\nSELECT * FROM automated_report_results where id = 275;\n\nSELECT * FROM automated_reports order by id desc;\nSELECT * FROM automated_report_results order by id desc;\nselect * from activity_searches where user_id = 143;\nselect * from ask_anything_prompts;\n\nSELECT * FROM groups WHERE id = 1439;\nSELECT * FROM users WHERE group_id = 1439;\n\nselect * from permissions; # 158\nselect * from roles;\nselect * from permission_role\n\nselect * from teams where id = 1;\nselect * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;\nselect * from groups where id = 28;\nselect * from playbooks where team_id = 1;\nselect * from playbooks where id = 179;\nselect * from playbook_categories where id = 1391;\nselect * from users where id = 143;\nselect * from crm_profiles where user_id = 143;\nselect * from activities where crm_configuration_id = 39 and type = 'conference'\nand crm_provider_id IS NOT NULL ORDER by id desc;\nselect * from activities where id = 422003; # 00UO400000pB6fpMAC\n\nSELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type\nFROM automated_report_results ar\nJOIN automated_reports a ON a.id = ar.report_id\nWHERE a.type = 'ask_jiminny'\nLIMIT 10;\n\nSELECT `automated_report_results`.* FROM `automated_report_results`\nINNER JOIN `automated_reports`\n ON `automated_report_results`.`report_id` = `automated_reports`.`id`\nWHERE `automated_report_results`.`generated_at` IS NOT NULL\n AND `automated_reports`.`team_id` = 1\n AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$.\"users\"')\n;\n\n\nselect * from teams where id = 3143;\nselect * from crm_configurations where id = 500;\nselect * from users where name = 'Integration Account'; # 1695\nSELECT * FROM social_accounts WHERE sociable_id = 1695;\n\nselect * from activities where crm_configuration_id = 39\nand recording_state = 'recorded' and duration > 60\nand status = 'completed' and actual_start_time >= '2025-12-01';\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;\n\nselect * from leads;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-6532606308203292909
|
1126710648141684156
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsRepositoryTest
Run 'AutomatedReportsRepositoryTest'
Debug 'AutomatedReportsRepositoryTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
102
3
34
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Kiosk\AutomatedReports;
use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Carbon\Exceptions\InvalidFormatException;
use DateTime;
use DateTimeInterface;
use DateTimeZone;
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcher;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Jiminny\Component\ActivitySearch\FilterDefinition\InputTypeEnum;
use Jiminny\Component\AskAnything\AskAnythingPromptService;
use Jiminny\Component\AskAnything\Dtos\AskAnythingPromptDto;
use Jiminny\Component\UrlGenerator\Webhook;
use Jiminny\Contracts\Repositories\PlaybookCategoryRepository;
use Jiminny\Contracts\Repositories\TeamRepository;
use Jiminny\Contracts\Repositories\UserRepository;
use Jiminny\Exceptions\ApplicationException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Exceptions\ModelNotFoundException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateReportJob;
use Jiminny\Models\Activity\Search;
use Jiminny\Models\AskAnything\AskAnythingPrompt;
use Jiminny\Models\AskAnything\AskAnythingPromptTarget;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Contracts\UserContract;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AskAnythingRepository;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Repositories\GroupRepository;
use Jiminny\Repositories\SearchRepository;
use Jiminny\Repositories\StageRepository;
use Throwable;
class AutomatedReportsService
{
public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';
public const string TYPE_ASK_JIMINNY = 'ask_jiminny';
/**
* Standard report types (used by kiosk for existing automated reports).
*/
// @TODO this will add filter, however if we need to control feature by FF we need conditional logic
public const array TYPES = [
['id' => 'exec_summary', 'name' => 'Exec Summary'],
['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],
['id' => 'product_feedback', 'name' => 'Product Feedback'],
['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],
// ['id' => 'questions', 'name' => 'Questions'],
// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],
];
public const array ALL_TYPES = [
...self::TYPES,
['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],
];
public const string FREQUENCY_DAILY = 'daily';
public const string FREQUENCY_WEEKLY = 'weekly';
public const string FREQUENCY_MONTHLY = 'monthly';
public const string FREQUENCY_QUARTERLY = 'quarterly';
public const string FREQUENCY_ONE_OFF = 'one_off';
/**
* Frequencies for standard (non-Ask Jiminny) reports.
*/
public const array FREQUENCIES = [
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
/**
* Frequencies for Ask Jiminny reports.
*/
public const array ASK_JIMINNY_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
];
public const string MEDIA_TYPE_PDF = 'pdf';
public const string MEDIA_TYPE_PODCAST = 'podcast';
public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];
public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];
public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];
public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];
public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];
public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];
public const int SENT_REPORT_AT_HOURS = 5;
public const string PDF_KEY = 'pdf';
public const string AUDIO_KEY = 'audio';
private const array ALL_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
private const string S3_DIR = 'reports';
private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];
private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];
public function __construct(
private readonly TeamRepository $teamRepository,
private readonly GroupRepository $groupRepository,
private readonly UserRepository $userRepository,
private readonly StageRepository $stageRepository,
private readonly DealStagesService $dealStagesService,
private readonly RecipientsService $recipientsService,
private readonly AutomatedReportsRepository $automatedReportsRepository,
private readonly Webhook $webhookService,
private readonly BusDispatcher $dispatcher,
private readonly ActivityTypeService $activityTypeService,
private readonly PlaybookCategoryRepository $playbookCategoryRepository,
private readonly AskAnythingPromptService $askAnythingPromptService,
private readonly SearchRepository $activitySearchRepository,
private readonly AskAnythingRepository $askAnythingRepository,
) {
}
public static function getTypes(): array
{
$types = self::TYPES;
return array_map(static function ($type) {
return $type['id'];
}, $types);
}
public static function getCallTypes(): array
{
return array_map(static function ($callType) {
return $callType['id'];
}, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);
}
public static function getFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::FREQUENCIES);
}
// front-facing structure
public function getReportEnabledFieldData(bool $value = false): array
{
return [
'id' => 'report_enabled',
'label' => '',
'inputType' => InputTypeEnum::TOGGLE,
'value' => $value,
];
}
// Organizations = Teams
public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array
{
$options = $this->getTeams();
if ($shortVersion) {
return [
'id' => 'organization',
'label' => 'Organization',
'options' => $options,
];
}
return [
'id' => 'organization',
'label' => 'Organization',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $options,
'value' => $value,
'dependencies' => [
'teams',
'deal_stage_at_call',
'current_deal_stage',
'recipients',
ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,
],
'dependsOn' => [],
];
}
// Teams = Groups
public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array
{
if ($shortVersion) {
return [
'id' => 'teams',
'label' => 'Team',
'options' => $options,
];
}
return [
'id' => 'teams',
'label' => 'Team',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => false,
'placeholder' => 'Select',
'options' => $options,
'value' => $value, // value should be an array of objects {id, name}
'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],
'dependsOn' => [],
];
}
public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array
{
$types = [];
if ($team instanceof Team) {
if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
$types = self::TYPES;
}
if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {
$types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];
}
} else {
$types = self::TYPES;
}
if ($shortVersion) {
return [
'id' => 'report_type',
'label' => 'Report Type',
'options' => $types,
];
}
return [
'id' => 'report_type',
'label' => 'Report Type',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $types,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getFrequencyFieldData(?string $value = null): array
{
return [
'id' => 'frequency',
'label' => 'Frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => self::FREQUENCIES,
'value' => $value,
'dependencies' => ['period'],
'dependsOn' => [],
];
}
public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array
{
return [
'id' => 'period',
'label' => 'Select one-off period',
'inputType' => InputTypeEnum::DATE_RANGE,
'required' => true,
'placeholder' => 'Select',
'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],
'queryParams' => [
'startDate' => 'start_date_period',
'endDate' => 'end_date_period',
],
'dependencies' => [],
'dependsOn' => ['frequency'],
];
}
public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array
{
return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);
}
public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);
}
public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);
}
public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'deal_value',
'label' => 'Deal Value',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_deal_value',
'max' => 'max_deal_value',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array
{
$value = [];
$conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;
$dialerOn && $value[] = self::CALL_TYPE_DIALER;
return [
'id' => 'call_type',
'label' => 'Call Type',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => [
self::CALL_TYPE_CONFERENCE,
self::CALL_TYPE_DIALER,
],
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getMediaTypeFieldData(?AutomatedReport $report = null): array
{
$value = [];
if ($report) {
$value = $this->transformMediaTypes($report);
}
return [
'id' => 'media_types',
'label' => 'Export as',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => self::MEDIA_TYPE_OBJECTS,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'call_duration',
'label' => 'Call Duration',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_call_duration',
'max' => 'max_call_duration',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getRecipientsFieldData(?Team $team = null, array $value = []): array
{
return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);
}
public function getJiminnyRecipientsFieldData(array $value = []): array
{
return $this->recipientsService->getJiminnyRecipientsFieldData($value);
}
public function getAdditionalPromptInputFieldData(?string $value = null): array
{
return [
'id' => 'additional_prompt_input',
'label' => 'Special requirements',
'inputType' => InputTypeEnum::TEXTAREA,
'required' => false,
'placeholder' => 'What should be the focus of the report?',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCustomReportNameFieldData(?string $value = null): array
{
return [
'id' => 'custom_name',
'label' => 'Custom report name',
'inputType' => InputTypeEnum::TEXT,
'required' => false,
'placeholder' => 'Enter custom name',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
// data providers
public function getTeams(): array
{
$teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);
$teamData = [];
foreach ($teams as $team) {
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
continue;
}
$teamData[] = $this->transformTeam($team);
}
return $teamData;
}
public function getTeamGroups(string $teamUuid): array
{
$data = [];
$team = $this->getTeam($teamUuid);
if ($team !== null) {
$groups = $team->groups()->get();
foreach ($groups as $group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
];
}
}
return $data;
}
public function getTeamsGroupsOptions(array $filterTeamUuids = []): array
{
$data = [];
$teams = $this->getTeams();
foreach ($teams as $team) {
if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {
continue;
}
$data[] = [
'label' => $team['name'],
'groups' => $this->getTeamGroups($team['id']),
];
}
return $data;
}
public function getTeam(string $teamUuid): ?Team
{
return $this->teamRepository->idOrUuid($teamUuid);
}
public function getTeamById(int $teamId): ?Team
{
return $this->teamRepository->find($teamId);
}
public function getGroupsUuids(AutomatedReport $report): array
{
$uuids = [];
$reportGroups = $report->getGroups();
foreach ($reportGroups as $groupId) {
if ($group = $this->groupRepository->find($groupId)) {
$uuids[] = $group->getUuid();
}
}
return $uuids;
}
public function getPlaybookCategoriesUuids(AutomatedReport $report): array
{
$uuids = [];
$playbookCategories = $report->getPlaybookCategories();
foreach ($playbookCategories as $id) {
if ($category = $this->playbookCategoryRepository->find($id)) {
$uuids[] = $category->getUuid();
}
}
return $uuids;
}
public function getDealAtCallStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getDealAtCallStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getCurrentDealStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getCurrentDealStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getRecipients());
}
public function getJiminnyUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function extractUserUuids(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => $user->getUuid())
->values()
->all();
}
// get mail data
public function getRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getRecipients());
}
/**
* @return array<UserContract>
*/
public function getRecipientUserObjects(AutomatedReport $report): array
{
$userIds = $report->getRecipients()['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->values()
->all();
}
private function getJiminnyRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function buildRecipientUsers(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => [
'email' => $user->getEmailAddress(),
'name' => $user->getName(),
'timezone' => $user->getTimezone()->getName(),
])
->values()
->all();
}
public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array
{
if ($report->isAskJiminnyReport()) {
$recipients = $this->resolveAskJiminnyRecipients($report);
} else {
$recipients = $this->getRecipientUsers($report);
if ($includeJiminny) {
$recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));
}
}
$emails = [];
return array_values(array_filter(
$recipients,
static function ($recipient) use (&$emails) {
if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {
return false;
}
$emails[] = $recipient['email'];
return true;
}
));
}
private function resolveAskJiminnyRecipients(AutomatedReport $report): array
{
$recipients = [];
$creator = $report->getCreator();
if ($creator !== null) {
$recipients[] = [
'email' => $creator->getEmailAddress(),
'name' => $creator->getName(),
'timezone' => $creator->getTimezone()->getName(),
];
}
return array_merge(
$recipients,
$this->buildRecipientUsers($report->getRecipients()),
$this->getGroupRecipientUsers($report),
);
}
private function getGroupRecipientUsers(AutomatedReport $report): array
{
$users = [];
foreach ($report->getGroups() as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group === null) {
continue;
}
foreach ($group->getMembers() as $member) {
$users[] = [
'email' => $member->getEmailAddress(),
'name' => $member->getName(),
'timezone' => $member->getTimezone()->getName(),
];
}
}
return $users;
}
public function getReportTypeName(AutomatedReportResult $report): string
{
$type = $report->getReport()->getType();
$getType = $this->transformReportType($type);
return $getType['name'];
}
public function getReportPeriodName(AutomatedReportResult $report): string
{
$from = $report->getFromDate();
$to = $report->getToDate();
$frequency = $report->getReport()->getFrequency();
if ($from === null || $to === null) {
if (! $report->getReport()->isAskJiminnyReport()) {
$invalidPeriod = $from === null ? 'from' : 'to';
throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);
}
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
}
return $this->formatReportPeriodName($frequency, $from, $to);
}
private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string
{
$fromYear = $from->format('Y');
$toYear = $to->format('Y');
$differentYears = $fromYear !== $toYear;
switch ($frequency) {
case self::FREQUENCY_DAILY:
return $from->format('j M Y');
case self::FREQUENCY_QUARTERLY:
// 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ
$startMonth = $from->format('M');
$endMonth = $to->copy()->subMonth();
$endMonthName = $endMonth->format('M');
$endMonthYear = $endMonth->format('Y');
if ($differentYears) {
return "{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}";
}
return "{$startMonth} - {$endMonthName} {$toYear}";
case self::FREQUENCY_MONTHLY:
// 'May 2025' - monthly reports are always within the same year
return $from->format('M Y');
case self::FREQUENCY_WEEKLY:
// '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ
$startDay = $from->format('j');
$endDay = $to->format('j');
$startMonth = $from->format('M');
$endMonth = $to->format('M');
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
if ($startMonth !== $endMonth) {
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
}
return "{$startDay} - {$endDay} {$endMonth} {$toYear}";
case self::FREQUENCY_ONE_OFF:
// '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ
$startDay = $from->format('j');
$startMonth = $from->format('M');
$endDay = $to->format('j');
$endMonth = $to->format('M');
// If same month and year, use a format like '2-31 May 2025'
if ($startMonth === $endMonth && ! $differentYears) {
return "{$startDay} - {$endDay} {$startMonth} {$toYear}";
}
// If different years, include both years
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
// Same year but different months
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
default:
// Default format for unknown frequencies
return $from->format('j M Y') . ' - ' . $to->format('j M Y');
}
}
public function getReportTeamsName(AutomatedReportResult $report): string
{
$groups = $report->getGroups();
if (empty($groups)) {
return 'All';
}
// Get group names from repository
$groupNames = [];
foreach ($groups as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group) {
$groupNames[] = $group->getName();
}
}
if (count($groupNames) === 1) {
// Single team format
$teamsName = $groupNames[0];
} else {
// Multiple teams format
$teamsName = implode(', ', $groupNames);
}
return $teamsName;
}
public function getReportFileName(AutomatedReportResult $report): string
{
$customName = $report->getReport()->getCustomName();
$periodName = $this->getReportPeriodName($report);
$filenameSuffix = $this->getFilenameSuffix($report);
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$customName} - {$periodName}");
}
$baseName = $this->getReportTypeName($report);
if ($filenameSuffix) {
$baseName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}");
}
public function getReportFileNameWithExtension(AutomatedReportResult $result): string
{
$extension = $this->getMediaTypeMetadata($result)['extension'];
return $this->getReportFileName($result) . '.' . $extension;
}
public function sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool
{
$recipients = array_map('intval', $report->getRecipients()['users'] ?? []);
return in_array($user->getId(), $recipients);
}
public function transformReportResults(Collection $automatedReportResults): array
{
$data = [];
foreach ($automatedReportResults as $automatedReportResult) {
/** @var AutomatedReportResult $automatedReportResult */
$report = $automatedReportResult->getReport();
$createdBy = $report->getCreator();
$creator = [
'id' => $createdBy?->getUuid(),
'name' => $createdBy?->getName(),
'email' => $createdBy?->getEmailAddress(),
'photoUrl' => $createdBy?->getPhotoUrl(),
];
$data[] = [
'id' => $automatedReportResult->getUuid(),
'name' => $automatedReportResult->getName(),
'frequency' => $this->transformFrequency($report->getFrequency()),
'recipients' => $this->buildRecipients($report),
'report_type' => $this->transformReportType($report->getType()),
'media_type' => $automatedReportResult->getMediaType(),
'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),
'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),
'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),
'creator' => $creator,
];
}
return $data;
}
private function buildRecipients(AutomatedReport $report): array
{
$creatorUuid = $report->getCreator()?->getUuid();
$recipients = array_values(array_filter(
$this->transformRecipients($report->getRecipients()),
static fn (array $recipient): bool => $recipient['id'] !== $creatorUuid,
));
if (! $report->isAskJiminnyReport()) {
return $recipients;
}
return [
...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),
...$recipients,
];
}
public function hasCallTypeConference(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);
}
public function hasCallTypeDialer(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);
}
// transformers
private function transformTeam(Team $team): array
{
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
return [];
}
return [
'id' => $team->getUuid(),
'name' => $team->getName(),
];
}
private function transformReportFullView(AutomatedReport $report): array
{
$base = $this->transformReportBase($report);
return $report->getType() === self::TYPE_ASK_JIMINNY
? $base + $this->transformAskJiminnyFields($report)
: $base + $this->transformStandardReportFields($report);
}
private function transformReportBase(AutomatedReport $report): array
{
return [
'id' => $report->getUuid(),
'organization' => $this->transformOrganization(team: $report->getTeam()),
'report_type' => $this->transformReportType($report->getType()),
'frequency' => $this->transformFrequency($report->getFrequency()),
];
}
private function transformStandardReportFields(AutomatedReport $report): array
{
$team = $report->getTeam();
return [
'report_enabled' => $report->getStatus(),
'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),
'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),
'deal_value_min' => $report->getDealValueMin(),
'deal_value_max' => $report->getDealValueMax(),
'call_types' => $this->transformCallType($report->getCallTypes()),
'media_types' => $this->transformMediaTypes($report),
'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),
'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),
'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),
'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),
'recipients' => $this->transformRecipients($report->getRecipients()),
'created_by' => $this->transformCreator($report->getCreator()),
'additional_prompt_input' => $report->getAdditionalPromptInput(),
'custom_name' => $report->getCustomName(),
'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),
'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),
'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),
];
}
private function transformAskJiminnyFields(AutomatedReport $report): array
{
$team = $report->getTeam();
$creatorId = $report->getAttribute('created_by');
$explicitUserIds = array_values(array_filter(
$report->getRecipients()['users'] ?? [],
static fn ($id) => $id !== $creatorId
));
return [
'report_name' => $report->getCustomName(),
'enabled' => $report->getStatus(),
'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),
'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),
'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),
'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),
];
}
private function transformOrganization(?Team $team): array
{
return [
'id' => $team?->getUuid(),
'name' => $team?->getName(),
];
}
private function transformReportType(string $type): array
{
foreach (self::ALL_TYPES as $typeItem) {
if ($typeItem['id'] === $type) {
return $typeItem;
}
}
return [];
}
private function transformCallType(array $types): array
{
$result = [];
$callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];
foreach ($types as $type) {
foreach ($callTypes as $callTypeItem) {
if ($callTypeItem['id'] === $type) {
$result[] = $callTypeItem;
break;
}
}
}
return $result;
}
private function transformMediaTypes(AutomatedReport $report): array
{
$values = [];
foreach ($report->getMediaTypes() as $mediaType) {
if (! in_array($mediaType, self::MEDIA_TYPES, true)) {
continue;
}
$values[] = match ($mediaType) {
self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,
self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,
};
}
return $values;
}
private function transformFrequency(string $frequency): array
{
foreach (self::ALL_FREQUENCIES as $frequencyItem) {
if ($frequencyItem['id'] === $frequency) {
return $frequencyItem;
}
}
return [];
}
public function transformDurationToMinutes(?int $duration): ?int
{
if (! $duration) {
return null;
}
return (int) ($duration / 60);
}
private function transformGroups(?Team $team, array $groupsIds): array
{
if (empty($groupsIds) || ! $team) {
return [];
}
$data = [];
foreach ($groupsIds as $groupId) {
$group = $team->groups()->where('id', $groupId)->first();
if ($group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
'photoUrl' => $group->getPhotoUrl(),
];
}
}
return $data;
}
private function transformStages(?Team $team, array $stagesIds): array
{
if (empty($stagesIds) || ! $team) {
return [];
}
$data = [];
foreach ($stagesIds as $stageId) {
$stage = $team->stages()->where('id', $stageId)->first();
if ($stage) {
$data[] = [
'id' => $stage->getUuid(),
'name' => $stage->getName(),
];
}
}
return $data;
}
private function transformRecipients(array $recipients): array
{
$users = [];
foreach ($recipients['users'] ?? [] as $userId) {
$users[] = $this->transformUser($userId);
}
return $users;
}
private function transformCreator(?User $user): ?array
{
if ($user === null) {
return null;
}
return $this->transformUser($user->getId());
}
private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array
{
if ($prompt === null) {
return null;
}
return [
'id' => $prompt->getUuid(),
'name' => $prompt->getTitle(),
];
}
private function transformSafeSearch(?Search $search): ?array
{
if ($search === null) {
return null;
}
return [
'id' => $search->getUuid(),
'name' => $search->getName(),
];
}
private function transformUser(int $userId): array
{
/* @var ?User $user */
$user = $this->userRepository->find($userId);
return [
'id' => $user?->getUuid(),
'name' => $user?->getName(),
'email' => $user?->getEmailAddress(),
'photoUrl' => $user?->getPhotoUrl(),
];
}
public function create(array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$validatedData['created_by'] = auth()->id();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
public function update(string $uuid, array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$report = $this->automatedReportsRepository->findByUuid($uuid);
if (! $report) {
throw new InvalidArgumentException('Report not found');
}
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
/**
* Create an Ask Jiminny report.
*/
public function createAskJiminnyReport(array $data, User $creator): array
{
$validatedData = $this->validateAskJiminnyReportData($data, $creator);
$validatedData['created_by'] = $creator->getId();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
return $this->transformReportFullView($automatedReport);
}
/**
* Update an Ask Jiminny report.
*/
public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array
{
if (! $report->isAskJiminnyReport()) {
throw new InvalidArgumentException('Report is not an Ask Jiminny report');
}
$validatedData = $this->validateAskJiminnyReportData($data, $user);
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
return $this->transformReportFullView($automatedReport);
}
public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array
{
$this->automatedReportsRepository->update($report, ['status' => $status]);
return $this->transformReportFullView($report->fresh());
}
/**
* Validate and transform data for Ask Jiminny reports.
*/
private function validateAskJiminnyReportData(array $data, User $user): array
{
// Validate name
$name = trim($data['report_name'] ?? '');
if (empty($name)) {
throw new InvalidArgumentException('Report name is required');
}
if (mb_strlen($name) > 50) {
throw new InvalidArgumentException('Report name must be 50 characters or less');
}
// Validate frequency (only daily, weekly, monthly for Ask Jiminny)
$frequency = $data['frequency'] ?? null;
$askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];
if (! in_array($frequency, $askJiminnyFrequencies, true)) {
throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');
}
// Validate expiration date
$expiresAt = $data['expires_on'] ?? null;
if (empty($expiresAt)) {
throw new InvalidArgumentException('Expiration date is required');
}
try {
$expiresAtDate = Carbon::parse($expiresAt);
} catch (InvalidFormatException $e) {
throw new InvalidArgumentException('Expiration date format is invalid');
}
$maxExpiration = Carbon::now()->addYear()->endOfDay();
if ($expiresAtDate->gt($maxExpiration)) {
throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');
}
if ($expiresAtDate->isPast()) {
throw new InvalidArgumentException('Expiration date cannot be in the past');
}
// Validate saved search
$activitySearchId = $data['saved_search'] ?? null;
if (empty($activitySearchId)) {
throw new InvalidArgumentException('Saved search is required');
}
$savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);
if (! $savedSearch) {
throw new InvalidArgumentException('Saved search not found or does not belong to you');
}
// Validate saved prompt
$askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;
if (empty($askAnythingPromptId)) {
throw new InvalidArgumentException('Ask Jiminny prompt is required');
}
$prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);
if (! $prompt) {
throw new InvalidArgumentException('Ask Jiminny prompt not found');
}
// Validate status
$status = $data['enabled'] ?? false;
$recipientUserIds = [$user->getId()];
if (! empty($data['share_users'])) {
$sharedUserIds = $this->validateAndGetUserIdsByTeam(
$user->team,
(array) $data['share_users']
);
$recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);
}
$sharedGroupIds = [];
if (! empty($data['share_teams'])) {
$sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);
}
$recipientUserIds = array_values(array_unique($recipientUserIds));
return [
'team_id' => $user->getTeamId(),
'type' => self::TYPE_ASK_JIMINNY,
'status' => (bool) $status,
'frequency' => $frequency,
'custom_name' => $name,
'activity_search_id' => $savedSearch->getId(),
'ask_anything_prompt_id' => $prompt->getId(),
'expires_at' => $expiresAtDate->toDateString(),
'media_types' => [self::MEDIA_TYPE_PDF],
'call_types' => [],
'recipients' => ['users' => $recipientUserIds],
'groups' => $sharedGroupIds,
];
}
public static function getAskJiminnyFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::ASK_JIMINNY_FREQUENCIES);
}
public function getAskJiminnyReportFilters(User $user): array
{
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
return [
[
'id' => 'prompt',
'label' => 'Prompt',
'options' => $prompts,
],
[
'id' => 'saved_search',
'label' => 'Saved Search',
'options' => $savedSearches,
],
];
}
public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array
{
$team = $user->getTeam();
$userTimezone = $user->getTimezone();
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
$teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [
'id' => $group->getUuid(),
'name' => $group->getName(),
])->values()->all();
$shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];
$sharedTeamsValue = [];
$sharedUsersValue = [];
if ($report) {
$sharedTeamsValue = $this->transformGroups($team, $report->getGroups());
$recipientUserIds = $report->getRecipients()['users'] ?? [];
$creatorId = $report->getAttribute('created_by');
$sharedUserIds = array_values(array_filter(
$recipientUserIds,
static fn ($id) => $id !== $creatorId
));
$sharedUsersValue = collect($sharedUserIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (User $u) => [
'id' => $u->getUuid(),
'name' => $u->getName(),
])
->values()
->all();
}
return [
'fields' => [
[
'id' => 'enabled',
'inputType' => InputTypeEnum::TOGGLE,
'label' => '',
'value' => $report?->getStatus() ?? false,
],
[
'id' => 'report_name',
'inputType' => InputTypeEnum::TEXT,
'label' => 'Name',
'placeholder' => 'Enter name',
'required' => true,
'validation' => ['maxLength' => 50],
'value' => $report?->getCustomName() ?? '',
],
[
'id' => 'frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'label' => 'Frequency',
'required' => true,
'placeholder' => 'Select',
'options' => self::ASK_JIMINNY_FREQUENCIES,
'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,
],
[
'id' => 'expires_on',
'inputType' => InputTypeEnum::DATE,
'label' => 'Expires on',
'required' => true,
'placeholder' => 'Select',
'validation' => [
'minDate' => now($userTimezone)->toDateString(),
'maxDate' => n...
|
66788
|
|
66793
|
1504
|
0
|
2026-04-21T15:04:39.021843+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776783879021_m2.jpg...
|
PhpStorm
|
faVsco.js – AutomatedReportsService.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsRepositoryTest
Run 'AutomatedReportsRepositoryTest'
Debug 'AutomatedReportsRepositoryTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
102
3
34
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Kiosk\AutomatedReports;
use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Carbon\Exceptions\InvalidFormatException;
use DateTime;
use DateTimeInterface;
use DateTimeZone;
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcher;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Jiminny\Component\ActivitySearch\FilterDefinition\InputTypeEnum;
use Jiminny\Component\AskAnything\AskAnythingPromptService;
use Jiminny\Component\AskAnything\Dtos\AskAnythingPromptDto;
use Jiminny\Component\UrlGenerator\Webhook;
use Jiminny\Contracts\Repositories\PlaybookCategoryRepository;
use Jiminny\Contracts\Repositories\TeamRepository;
use Jiminny\Contracts\Repositories\UserRepository;
use Jiminny\Exceptions\ApplicationException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Exceptions\ModelNotFoundException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateReportJob;
use Jiminny\Models\Activity\Search;
use Jiminny\Models\AskAnything\AskAnythingPrompt;
use Jiminny\Models\AskAnything\AskAnythingPromptTarget;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Contracts\UserContract;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AskAnythingRepository;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Repositories\GroupRepository;
use Jiminny\Repositories\SearchRepository;
use Jiminny\Repositories\StageRepository;
use Throwable;
class AutomatedReportsService
{
public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';
public const string TYPE_ASK_JIMINNY = 'ask_jiminny';
/**
* Standard report types (used by kiosk for existing automated reports).
*/
// @TODO this will add filter, however if we need to control feature by FF we need conditional logic
public const array TYPES = [
['id' => 'exec_summary', 'name' => 'Exec Summary'],
['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],
['id' => 'product_feedback', 'name' => 'Product Feedback'],
['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],
// ['id' => 'questions', 'name' => 'Questions'],
// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],
];
public const array ALL_TYPES = [
...self::TYPES,
['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],
];
public const string FREQUENCY_DAILY = 'daily';
public const string FREQUENCY_WEEKLY = 'weekly';
public const string FREQUENCY_MONTHLY = 'monthly';
public const string FREQUENCY_QUARTERLY = 'quarterly';
public const string FREQUENCY_ONE_OFF = 'one_off';
/**
* Frequencies for standard (non-Ask Jiminny) reports.
*/
public const array FREQUENCIES = [
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
/**
* Frequencies for Ask Jiminny reports.
*/
public const array ASK_JIMINNY_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
];
public const string MEDIA_TYPE_PDF = 'pdf';
public const string MEDIA_TYPE_PODCAST = 'podcast';
public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];
public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];
public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];
public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];
public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];
public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];
public const int SENT_REPORT_AT_HOURS = 5;
public const string PDF_KEY = 'pdf';
public const string AUDIO_KEY = 'audio';
private const array ALL_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
private const string S3_DIR = 'reports';
private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];
private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];
public function __construct(
private readonly TeamRepository $teamRepository,
private readonly GroupRepository $groupRepository,
private readonly UserRepository $userRepository,
private readonly StageRepository $stageRepository,
private readonly DealStagesService $dealStagesService,
private readonly RecipientsService $recipientsService,
private readonly AutomatedReportsRepository $automatedReportsRepository,
private readonly Webhook $webhookService,
private readonly BusDispatcher $dispatcher,
private readonly ActivityTypeService $activityTypeService,
private readonly PlaybookCategoryRepository $playbookCategoryRepository,
private readonly AskAnythingPromptService $askAnythingPromptService,
private readonly SearchRepository $activitySearchRepository,
private readonly AskAnythingRepository $askAnythingRepository,
) {
}
public static function getTypes(): array
{
$types = self::TYPES;
return array_map(static function ($type) {
return $type['id'];
}, $types);
}
public static function getCallTypes(): array
{
return array_map(static function ($callType) {
return $callType['id'];
}, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);
}
public static function getFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::FREQUENCIES);
}
// front-facing structure
public function getReportEnabledFieldData(bool $value = false): array
{
return [
'id' => 'report_enabled',
'label' => '',
'inputType' => InputTypeEnum::TOGGLE,
'value' => $value,
];
}
// Organizations = Teams
public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array
{
$options = $this->getTeams();
if ($shortVersion) {
return [
'id' => 'organization',
'label' => 'Organization',
'options' => $options,
];
}
return [
'id' => 'organization',
'label' => 'Organization',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $options,
'value' => $value,
'dependencies' => [
'teams',
'deal_stage_at_call',
'current_deal_stage',
'recipients',
ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,
],
'dependsOn' => [],
];
}
// Teams = Groups
public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array
{
if ($shortVersion) {
return [
'id' => 'teams',
'label' => 'Team',
'options' => $options,
];
}
return [
'id' => 'teams',
'label' => 'Team',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => false,
'placeholder' => 'Select',
'options' => $options,
'value' => $value, // value should be an array of objects {id, name}
'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],
'dependsOn' => [],
];
}
public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array
{
$types = [];
if ($team instanceof Team) {
if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
$types = self::TYPES;
}
if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {
$types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];
}
} else {
$types = self::TYPES;
}
if ($shortVersion) {
return [
'id' => 'report_type',
'label' => 'Report Type',
'options' => $types,
];
}
return [
'id' => 'report_type',
'label' => 'Report Type',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $types,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getFrequencyFieldData(?string $value = null): array
{
return [
'id' => 'frequency',
'label' => 'Frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => self::FREQUENCIES,
'value' => $value,
'dependencies' => ['period'],
'dependsOn' => [],
];
}
public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array
{
return [
'id' => 'period',
'label' => 'Select one-off period',
'inputType' => InputTypeEnum::DATE_RANGE,
'required' => true,
'placeholder' => 'Select',
'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],
'queryParams' => [
'startDate' => 'start_date_period',
'endDate' => 'end_date_period',
],
'dependencies' => [],
'dependsOn' => ['frequency'],
];
}
public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array
{
return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);
}
public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);
}
public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);
}
public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'deal_value',
'label' => 'Deal Value',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_deal_value',
'max' => 'max_deal_value',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array
{
$value = [];
$conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;
$dialerOn && $value[] = self::CALL_TYPE_DIALER;
return [
'id' => 'call_type',
'label' => 'Call Type',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => [
self::CALL_TYPE_CONFERENCE,
self::CALL_TYPE_DIALER,
],
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getMediaTypeFieldData(?AutomatedReport $report = null): array
{
$value = [];
if ($report) {
$value = $this->transformMediaTypes($report);
}
return [
'id' => 'media_types',
'label' => 'Export as',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => self::MEDIA_TYPE_OBJECTS,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'call_duration',
'label' => 'Call Duration',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_call_duration',
'max' => 'max_call_duration',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getRecipientsFieldData(?Team $team = null, array $value = []): array
{
return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);
}
public function getJiminnyRecipientsFieldData(array $value = []): array
{
return $this->recipientsService->getJiminnyRecipientsFieldData($value);
}
public function getAdditionalPromptInputFieldData(?string $value = null): array
{
return [
'id' => 'additional_prompt_input',
'label' => 'Special requirements',
'inputType' => InputTypeEnum::TEXTAREA,
'required' => false,
'placeholder' => 'What should be the focus of the report?',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCustomReportNameFieldData(?string $value = null): array
{
return [
'id' => 'custom_name',
'label' => 'Custom report name',
'inputType' => InputTypeEnum::TEXT,
'required' => false,
'placeholder' => 'Enter custom name',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
// data providers
public function getTeams(): array
{
$teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);
$teamData = [];
foreach ($teams as $team) {
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
continue;
}
$teamData[] = $this->transformTeam($team);
}
return $teamData;
}
public function getTeamGroups(string $teamUuid): array
{
$data = [];
$team = $this->getTeam($teamUuid);
if ($team !== null) {
$groups = $team->groups()->get();
foreach ($groups as $group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
];
}
}
return $data;
}
public function getTeamsGroupsOptions(array $filterTeamUuids = []): array
{
$data = [];
$teams = $this->getTeams();
foreach ($teams as $team) {
if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {
continue;
}
$data[] = [
'label' => $team['name'],
'groups' => $this->getTeamGroups($team['id']),
];
}
return $data;
}
public function getTeam(string $teamUuid): ?Team
{
return $this->teamRepository->idOrUuid($teamUuid);
}
public function getTeamById(int $teamId): ?Team
{
return $this->teamRepository->find($teamId);
}
public function getGroupsUuids(AutomatedReport $report): array
{
$uuids = [];
$reportGroups = $report->getGroups();
foreach ($reportGroups as $groupId) {
if ($group = $this->groupRepository->find($groupId)) {
$uuids[] = $group->getUuid();
}
}
return $uuids;
}
public function getPlaybookCategoriesUuids(AutomatedReport $report): array
{
$uuids = [];
$playbookCategories = $report->getPlaybookCategories();
foreach ($playbookCategories as $id) {
if ($category = $this->playbookCategoryRepository->find($id)) {
$uuids[] = $category->getUuid();
}
}
return $uuids;
}
public function getDealAtCallStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getDealAtCallStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getCurrentDealStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getCurrentDealStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getRecipients());
}
public function getJiminnyUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function extractUserUuids(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => $user->getUuid())
->values()
->all();
}
// get mail data
public function getRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getRecipients());
}
/**
* @return array<UserContract>
*/
public function getRecipientUserObjects(AutomatedReport $report): array
{
$userIds = $report->getRecipients()['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->values()
->all();
}
private function getJiminnyRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function buildRecipientUsers(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => [
'email' => $user->getEmailAddress(),
'name' => $user->getName(),
'timezone' => $user->getTimezone()->getName(),
])
->values()
->all();
}
public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array
{
if ($report->isAskJiminnyReport()) {
$recipients = $this->resolveAskJiminnyRecipients($report);
} else {
$recipients = $this->getRecipientUsers($report);
if ($includeJiminny) {
$recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));
}
}
$emails = [];
return array_values(array_filter(
$recipients,
static function ($recipient) use (&$emails) {
if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {
return false;
}
$emails[] = $recipient['email'];
return true;
}
));
}
private function resolveAskJiminnyRecipients(AutomatedReport $report): array
{
$recipients = [];
$creator = $report->getCreator();
if ($creator !== null) {
$recipients[] = [
'email' => $creator->getEmailAddress(),
'name' => $creator->getName(),
'timezone' => $creator->getTimezone()->getName(),
];
}
return array_merge(
$recipients,
$this->buildRecipientUsers($report->getRecipients()),
$this->getGroupRecipientUsers($report),
);
}
private function getGroupRecipientUsers(AutomatedReport $report): array
{
$users = [];
foreach ($report->getGroups() as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group === null) {
continue;
}
foreach ($group->getMembers() as $member) {
$users[] = [
'email' => $member->getEmailAddress(),
'name' => $member->getName(),
'timezone' => $member->getTimezone()->getName(),
];
}
}
return $users;
}
public function getReportTypeName(AutomatedReportResult $report): string
{
$type = $report->getReport()->getType();
$getType = $this->transformReportType($type);
return $getType['name'];
}
public function getReportPeriodName(AutomatedReportResult $report): string
{
$from = $report->getFromDate();
$to = $report->getToDate();
$frequency = $report->getReport()->getFrequency();
if ($from === null || $to === null) {
if (! $report->getReport()->isAskJiminnyReport()) {
$invalidPeriod = $from === null ? 'from' : 'to';
throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);
}
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
}
return $this->formatReportPeriodName($frequency, $from, $to);
}
private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string
{
$fromYear = $from->format('Y');
$toYear = $to->format('Y');
$differentYears = $fromYear !== $toYear;
switch ($frequency) {
case self::FREQUENCY_DAILY:
return $from->format('j M Y');
case self::FREQUENCY_QUARTERLY:
// 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ
$startMonth = $from->format('M');
$endMonth = $to->copy()->subMonth();
$endMonthName = $endMonth->format('M');
$endMonthYear = $endMonth->format('Y');
if ($differentYears) {
return "{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}";
}
return "{$startMonth} - {$endMonthName} {$toYear}";
case self::FREQUENCY_MONTHLY:
// 'May 2025' - monthly reports are always within the same year
return $from->format('M Y');
case self::FREQUENCY_WEEKLY:
// '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ
$startDay = $from->format('j');
$endDay = $to->format('j');
$startMonth = $from->format('M');
$endMonth = $to->format('M');
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
if ($startMonth !== $endMonth) {
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
}
return "{$startDay} - {$endDay} {$endMonth} {$toYear}";
case self::FREQUENCY_ONE_OFF:
// '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ
$startDay = $from->format('j');
$startMonth = $from->format('M');
$endDay = $to->format('j');
$endMonth = $to->format('M');
// If same month and year, use a format like '2-31 May 2025'
if ($startMonth === $endMonth && ! $differentYears) {
return "{$startDay} - {$endDay} {$startMonth} {$toYear}";
}
// If different years, include both years
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
// Same year but different months
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
default:
// Default format for unknown frequencies
return $from->format('j M Y') . ' - ' . $to->format('j M Y');
}
}
public function getReportTeamsName(AutomatedReportResult $report): string
{
$groups = $report->getGroups();
if (empty($groups)) {
return 'All';
}
// Get group names from repository
$groupNames = [];
foreach ($groups as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group) {
$groupNames[] = $group->getName();
}
}
if (count($groupNames) === 1) {
// Single team format
$teamsName = $groupNames[0];
} else {
// Multiple teams format
$teamsName = implode(', ', $groupNames);
}
return $teamsName;
}
public function getReportFileName(AutomatedReportResult $report): string
{
$customName = $report->getReport()->getCustomName();
$periodName = $this->getReportPeriodName($report);
$filenameSuffix = $this->getFilenameSuffix($report);
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$customName} - {$periodName}");
}
$baseName = $this->getReportTypeName($report);
if ($filenameSuffix) {
$baseName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}");
}
public function getReportFileNameWithExtension(AutomatedReportResult $result): string
{
$extension = $this->getMediaTypeMetadata($result)['extension'];
return $this->getReportFileName($result) . '.' . $extension;
}
public function sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool
{
$recipients = array_map('intval', $report->getRecipients()['users'] ?? []);
return in_array($user->getId(), $recipients);
}
public function transformReportResults(Collection $automatedReportResults): array
{
$data = [];
foreach ($automatedReportResults as $automatedReportResult) {
/** @var AutomatedReportResult $automatedReportResult */
$report = $automatedReportResult->getReport();
$createdBy = $report->getCreator();
$creator = [
'id' => $createdBy?->getUuid(),
'name' => $createdBy?->getName(),
'email' => $createdBy?->getEmailAddress(),
'photoUrl' => $createdBy?->getPhotoUrl(),
];
$data[] = [
'id' => $automatedReportResult->getUuid(),
'name' => $automatedReportResult->getName(),
'frequency' => $this->transformFrequency($report->getFrequency()),
'recipients' => $this->buildRecipients($report),
'report_type' => $this->transformReportType($report->getType()),
'media_type' => $automatedReportResult->getMediaType(),
'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),
'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),
'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),
'creator' => $creator,
];
}
return $data;
}
private function buildRecipients(AutomatedReport $report): array
{
$creatorUuid = $report->getCreator()?->getUuid();
$recipients = array_values(array_filter(
$this->transformRecipients($report->getRecipients()),
static fn (array $recipient): bool => $recipient['id'] !== $creatorUuid,
));
if (! $report->isAskJiminnyReport()) {
return $recipients;
}
return [
...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),
...$recipients,
];
}
public function hasCallTypeConference(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);
}
public function hasCallTypeDialer(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);
}
// transformers
private function transformTeam(Team $team): array
{
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
return [];
}
return [
'id' => $team->getUuid(),
'name' => $team->getName(),
];
}
private function transformReportFullView(AutomatedReport $report): array
{
$base = $this->transformReportBase($report);
return $report->getType() === self::TYPE_ASK_JIMINNY
? $base + $this->transformAskJiminnyFields($report)
: $base + $this->transformStandardReportFields($report);
}
private function transformReportBase(AutomatedReport $report): array
{
return [
'id' => $report->getUuid(),
'organization' => $this->transformOrganization(team: $report->getTeam()),
'report_type' => $this->transformReportType($report->getType()),
'frequency' => $this->transformFrequency($report->getFrequency()),
];
}
private function transformStandardReportFields(AutomatedReport $report): array
{
$team = $report->getTeam();
return [
'report_enabled' => $report->getStatus(),
'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),
'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),
'deal_value_min' => $report->getDealValueMin(),
'deal_value_max' => $report->getDealValueMax(),
'call_types' => $this->transformCallType($report->getCallTypes()),
'media_types' => $this->transformMediaTypes($report),
'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),
'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),
'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),
'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),
'recipients' => $this->transformRecipients($report->getRecipients()),
'created_by' => $this->transformCreator($report->getCreator()),
'additional_prompt_input' => $report->getAdditionalPromptInput(),
'custom_name' => $report->getCustomName(),
'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),
'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),
'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),
];
}
private function transformAskJiminnyFields(AutomatedReport $report): array
{
$team = $report->getTeam();
$creatorId = $report->getAttribute('created_by');
$explicitUserIds = array_values(array_filter(
$report->getRecipients()['users'] ?? [],
static fn ($id) => $id !== $creatorId
));
return [
'report_name' => $report->getCustomName(),
'enabled' => $report->getStatus(),
'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),
'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),
'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),
'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),
];
}
private function transformOrganization(?Team $team): array
{
return [
'id' => $team?->getUuid(),
'name' => $team?->getName(),
];
}
private function transformReportType(string $type): array
{
foreach (self::ALL_TYPES as $typeItem) {
if ($typeItem['id'] === $type) {
return $typeItem;
}
}
return [];
}
private function transformCallType(array $types): array
{
$result = [];
$callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];
foreach ($types as $type) {
foreach ($callTypes as $callTypeItem) {
if ($callTypeItem['id'] === $type) {
$result[] = $callTypeItem;
break;
}
}
}
return $result;
}
private function transformMediaTypes(AutomatedReport $report): array
{
$values = [];
foreach ($report->getMediaTypes() as $mediaType) {
if (! in_array($mediaType, self::MEDIA_TYPES, true)) {
continue;
}
$values[] = match ($mediaType) {
self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,
self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,
};
}
return $values;
}
private function transformFrequency(string $frequency): array
{
foreach (self::ALL_FREQUENCIES as $frequencyItem) {
if ($frequencyItem['id'] === $frequency) {
return $frequencyItem;
}
}
return [];
}
public function transformDurationToMinutes(?int $duration): ?int
{
if (! $duration) {
return null;
}
return (int) ($duration / 60);
}
private function transformGroups(?Team $team, array $groupsIds): array
{
if (empty($groupsIds) || ! $team) {
return [];
}
$data = [];
foreach ($groupsIds as $groupId) {
$group = $team->groups()->where('id', $groupId)->first();
if ($group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
'photoUrl' => $group->getPhotoUrl(),
];
}
}
return $data;
}
private function transformStages(?Team $team, array $stagesIds): array
{
if (empty($stagesIds) || ! $team) {
return [];
}
$data = [];
foreach ($stagesIds as $stageId) {
$stage = $team->stages()->where('id', $stageId)->first();
if ($stage) {
$data[] = [
'id' => $stage->getUuid(),
'name' => $stage->getName(),
];
}
}
return $data;
}
private function transformRecipients(array $recipients): array
{
$users = [];
foreach ($recipients['users'] ?? [] as $userId) {
$users[] = $this->transformUser($userId);
}
return $users;
}
private function transformCreator(?User $user): ?array
{
if ($user === null) {
return null;
}
return $this->transformUser($user->getId());
}
private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array
{
if ($prompt === null) {
return null;
}
return [
'id' => $prompt->getUuid(),
'name' => $prompt->getTitle(),
];
}
private function transformSafeSearch(?Search $search): ?array
{
if ($search === null) {
return null;
}
return [
'id' => $search->getUuid(),
'name' => $search->getName(),
];
}
private function transformUser(int $userId): array
{
/* @var ?User $user */
$user = $this->userRepository->find($userId);
return [
'id' => $user?->getUuid(),
'name' => $user?->getName(),
'email' => $user?->getEmailAddress(),
'photoUrl' => $user?->getPhotoUrl(),
];
}
public function create(array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$validatedData['created_by'] = auth()->id();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
public function update(string $uuid, array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$report = $this->automatedReportsRepository->findByUuid($uuid);
if (! $report) {
throw new InvalidArgumentException('Report not found');
}
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
/**
* Create an Ask Jiminny report.
*/
public function createAskJiminnyReport(array $data, User $creator): array
{
$validatedData = $this->validateAskJiminnyReportData($data, $creator);
$validatedData['created_by'] = $creator->getId();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
return $this->transformReportFullView($automatedReport);
}
/**
* Update an Ask Jiminny report.
*/
public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array
{
if (! $report->isAskJiminnyReport()) {
throw new InvalidArgumentException('Report is not an Ask Jiminny report');
}
$validatedData = $this->validateAskJiminnyReportData($data, $user);
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
return $this->transformReportFullView($automatedReport);
}
public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array
{
$this->automatedReportsRepository->update($report, ['status' => $status]);
return $this->transformReportFullView($report->fresh());
}
/**
* Validate and transform data for Ask Jiminny reports.
*/
private function validateAskJiminnyReportData(array $data, User $user): array
{
// Validate name
$name = trim($data['report_name'] ?? '');
if (empty($name)) {
throw new InvalidArgumentException('Report name is required');
}
if (mb_strlen($name) > 50) {
throw new InvalidArgumentException('Report name must be 50 characters or less');
}
// Validate frequency (only daily, weekly, monthly for Ask Jiminny)
$frequency = $data['frequency'] ?? null;
$askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];
if (! in_array($frequency, $askJiminnyFrequencies, true)) {
throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');
}
// Validate expiration date
$expiresAt = $data['expires_on'] ?? null;
if (empty($expiresAt)) {
throw new InvalidArgumentException('Expiration date is required');
}
try {
$expiresAtDate = Carbon::parse($expiresAt);
} catch (InvalidFormatException $e) {
throw new InvalidArgumentException('Expiration date format is invalid');
}
$maxExpiration = Carbon::now()->addYear()->endOfDay();
if ($expiresAtDate->gt($maxExpiration)) {
throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');
}
if ($expiresAtDate->isPast()) {
throw new InvalidArgumentException('Expiration date cannot be in the past');
}
// Validate saved search
$activitySearchId = $data['saved_search'] ?? null;
if (empty($activitySearchId)) {
throw new InvalidArgumentException('Saved search is required');
}
$savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);
if (! $savedSearch) {
throw new InvalidArgumentException('Saved search not found or does not belong to you');
}
// Validate saved prompt
$askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;
if (empty($askAnythingPromptId)) {
throw new InvalidArgumentException('Ask Jiminny prompt is required');
}
$prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);
if (! $prompt) {
throw new InvalidArgumentException('Ask Jiminny prompt not found');
}
// Validate status
$status = $data['enabled'] ?? false;
$recipientUserIds = [$user->getId()];
if (! empty($data['share_users'])) {
$sharedUserIds = $this->validateAndGetUserIdsByTeam(
$user->team,
(array) $data['share_users']
);
$recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);
}
$sharedGroupIds = [];
if (! empty($data['share_teams'])) {
$sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);
}
$recipientUserIds = array_values(array_unique($recipientUserIds));
return [
'team_id' => $user->getTeamId(),
'type' => self::TYPE_ASK_JIMINNY,
'status' => (bool) $status,
'frequency' => $frequency,
'custom_name' => $name,
'activity_search_id' => $savedSearch->getId(),
'ask_anything_prompt_id' => $prompt->getId(),
'expires_at' => $expiresAtDate->toDateString(),
'media_types' => [self::MEDIA_TYPE_PDF],
'call_types' => [],
'recipients' => ['users' => $recipientUserIds],
'groups' => $sharedGroupIds,
];
}
public static function getAskJiminnyFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::ASK_JIMINNY_FREQUENCIES);
}
public function getAskJiminnyReportFilters(User $user): array
{
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
return [
[
'id' => 'prompt',
'label' => 'Prompt',
'options' => $prompts,
],
[
'id' => 'saved_search',
'label' => 'Saved Search',
'options' => $savedSearches,
],
];
}
public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array
{
$team = $user->getTeam();
$userTimezone = $user->getTimezone();
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
$teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [
'id' => $group->getUuid(),
'name' => $group->getName(),
])->values()->all();
$shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];
$sharedTeamsValue = [];
$sharedUsersValue = [];
if ($report) {
$sharedTeamsValue = $this->transformGroups($team, $report->getGroups());
$recipientUserIds = $report->getRecipients()['users'] ?? [];
$creatorId = $report->getAttribute('created_by');
$sharedUserIds = array_values(array_filter(
$recipientUserIds,
static fn ($id) => $id !== $creatorId
));
$sharedUsersValue = collect($sharedUserIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (User $u) => [
'id' => $u->getUuid(),
'name' => $u->getName(),
])
->values()
->all();
}
return [
'fields' => [
[
'id' => 'enabled',
'inputType' => InputTypeEnum::TOGGLE,
'label' => '',
'value' => $report?->getStatus() ?? false,
],
[
'id' => 'report_name',
'inputType' => InputTypeEnum::TEXT,
'label' => 'Name',
'placeholder' => 'Enter name',
'required' => true,
'validation' => ['maxLength' => 50],
'value' => $report?->getCustomName() ?? '',
],
[
'id' => 'frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'label' => 'Frequency',
'required' => true,
'placeholder' => 'Select',
'options' => self::ASK_JIMINNY_FREQUENCIES,
'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,
],
[
'id' => 'expires_on',
'inputType' => InputTypeEnum::DATE,
'label' => 'Expires on',
'required' => true,
'placeholder' => 'Select',
'validation' => [
'minDate' => now($userTimezone)->toDateString(),
'maxDate' => n...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"#11894 on JY-18909-automated-reports-ask-jiminny, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.12134308,"height":0.025538707},"help_text":"Pull request #11894 exists for current branch JY-18909-automated-reports-ask-jiminny","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8161569,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AutomatedReportsRepositoryTest","depth":6,"bounds":{"left":0.83144945,"top":0.019952115,"width":0.084109046,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AutomatedReportsRepositoryTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AutomatedReportsRepositoryTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"102","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.011968086,"height":0.0},"role_description":"text"},{"role":"AXStaticText","text":"3","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.007978723,"height":0.0},"role_description":"text"},{"role":"AXStaticText","text":"34","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.010305851,"height":0.0},"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.006981383,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Kiosk\\AutomatedReports;\n\nuse Carbon\\CarbonImmutable;\nuse Carbon\\CarbonInterface;\nuse Carbon\\Exceptions\\InvalidFormatException;\nuse DateTime;\nuse DateTimeInterface;\nuse DateTimeZone;\nuse Illuminate\\Contracts\\Bus\\Dispatcher as BusDispatcher;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Support\\Facades\\Log;\nuse Illuminate\\Support\\Facades\\Storage;\nuse Jiminny\\Component\\ActivitySearch\\FilterDefinition\\InputTypeEnum;\nuse Jiminny\\Component\\AskAnything\\AskAnythingPromptService;\nuse Jiminny\\Component\\AskAnything\\Dtos\\AskAnythingPromptDto;\nuse Jiminny\\Component\\UrlGenerator\\Webhook;\nuse Jiminny\\Contracts\\Repositories\\PlaybookCategoryRepository;\nuse Jiminny\\Contracts\\Repositories\\TeamRepository;\nuse Jiminny\\Contracts\\Repositories\\UserRepository;\nuse Jiminny\\Exceptions\\ApplicationException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Exceptions\\ModelNotFoundException;\nuse Jiminny\\Jobs\\AutomatedReports\\RequestGenerateReportJob;\nuse Jiminny\\Models\\Activity\\Search;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPrompt;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPromptTarget;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Contracts\\UserContract;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Repositories\\AskAnythingRepository;\nuse Jiminny\\Repositories\\AutomatedReportsRepository;\nuse Jiminny\\Repositories\\GroupRepository;\nuse Jiminny\\Repositories\\SearchRepository;\nuse Jiminny\\Repositories\\StageRepository;\nuse Throwable;\n\nclass AutomatedReportsService\n{\n public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';\n public const string TYPE_ASK_JIMINNY = 'ask_jiminny';\n\n /**\n * Standard report types (used by kiosk for existing automated reports).\n */\n // @TODO this will add filter, however if we need to control feature by FF we need conditional logic\n public const array TYPES = [\n ['id' => 'exec_summary', 'name' => 'Exec Summary'],\n ['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],\n ['id' => 'product_feedback', 'name' => 'Product Feedback'],\n ['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],\n// ['id' => 'questions', 'name' => 'Questions'],\n// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],\n ];\n\n public const array ALL_TYPES = [\n ...self::TYPES,\n ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],\n ];\n\n public const string FREQUENCY_DAILY = 'daily';\n public const string FREQUENCY_WEEKLY = 'weekly';\n public const string FREQUENCY_MONTHLY = 'monthly';\n public const string FREQUENCY_QUARTERLY = 'quarterly';\n public const string FREQUENCY_ONE_OFF = 'one_off';\n\n /**\n * Frequencies for standard (non-Ask Jiminny) reports.\n */\n public const array FREQUENCIES = [\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n\n /**\n * Frequencies for Ask Jiminny reports.\n */\n public const array ASK_JIMINNY_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ];\n\n public const string MEDIA_TYPE_PDF = 'pdf';\n public const string MEDIA_TYPE_PODCAST = 'podcast';\n public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];\n public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];\n public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];\n public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];\n\n public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];\n public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];\n public const int SENT_REPORT_AT_HOURS = 5;\n public const string PDF_KEY = 'pdf';\n public const string AUDIO_KEY = 'audio';\n\n private const array ALL_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n private const string S3_DIR = 'reports';\n private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];\n private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];\n\n public function __construct(\n private readonly TeamRepository $teamRepository,\n private readonly GroupRepository $groupRepository,\n private readonly UserRepository $userRepository,\n private readonly StageRepository $stageRepository,\n private readonly DealStagesService $dealStagesService,\n private readonly RecipientsService $recipientsService,\n private readonly AutomatedReportsRepository $automatedReportsRepository,\n private readonly Webhook $webhookService,\n private readonly BusDispatcher $dispatcher,\n private readonly ActivityTypeService $activityTypeService,\n private readonly PlaybookCategoryRepository $playbookCategoryRepository,\n private readonly AskAnythingPromptService $askAnythingPromptService,\n private readonly SearchRepository $activitySearchRepository,\n private readonly AskAnythingRepository $askAnythingRepository,\n ) {\n }\n\n public static function getTypes(): array\n {\n $types = self::TYPES;\n\n return array_map(static function ($type) {\n return $type['id'];\n }, $types);\n }\n\n public static function getCallTypes(): array\n {\n return array_map(static function ($callType) {\n return $callType['id'];\n }, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);\n }\n\n public static function getFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::FREQUENCIES);\n }\n\n // front-facing structure\n public function getReportEnabledFieldData(bool $value = false): array\n {\n return [\n 'id' => 'report_enabled',\n 'label' => '',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'value' => $value,\n ];\n }\n\n // Organizations = Teams\n public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array\n {\n $options = $this->getTeams();\n\n if ($shortVersion) {\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value,\n 'dependencies' => [\n 'teams',\n 'deal_stage_at_call',\n 'current_deal_stage',\n 'recipients',\n ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,\n ],\n 'dependsOn' => [],\n ];\n }\n\n // Teams = Groups\n public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array\n {\n if ($shortVersion) {\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value, // value should be an array of objects {id, name}\n 'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],\n 'dependsOn' => [],\n ];\n }\n\n public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array\n {\n $types = [];\n if ($team instanceof Team) {\n if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n $types = self::TYPES;\n }\n if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {\n $types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];\n }\n } else {\n $types = self::TYPES;\n }\n\n if ($shortVersion) {\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'options' => $types,\n ];\n }\n\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $types,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getFrequencyFieldData(?string $value = null): array\n {\n return [\n 'id' => 'frequency',\n 'label' => 'Frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::FREQUENCIES,\n 'value' => $value,\n 'dependencies' => ['period'],\n 'dependsOn' => [],\n ];\n }\n\n public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array\n {\n return [\n 'id' => 'period',\n 'label' => 'Select one-off period',\n 'inputType' => InputTypeEnum::DATE_RANGE,\n 'required' => true,\n 'placeholder' => 'Select',\n 'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],\n 'queryParams' => [\n 'startDate' => 'start_date_period',\n 'endDate' => 'end_date_period',\n ],\n 'dependencies' => [],\n 'dependsOn' => ['frequency'],\n ];\n }\n\n public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array\n {\n return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);\n }\n\n public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);\n }\n\n public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);\n }\n\n public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'deal_value',\n 'label' => 'Deal Value',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_deal_value',\n 'max' => 'max_deal_value',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array\n {\n $value = [];\n $conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;\n $dialerOn && $value[] = self::CALL_TYPE_DIALER;\n\n return [\n 'id' => 'call_type',\n 'label' => 'Call Type',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => [\n self::CALL_TYPE_CONFERENCE,\n self::CALL_TYPE_DIALER,\n ],\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getMediaTypeFieldData(?AutomatedReport $report = null): array\n {\n $value = [];\n\n if ($report) {\n $value = $this->transformMediaTypes($report);\n }\n\n return [\n 'id' => 'media_types',\n 'label' => 'Export as',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => self::MEDIA_TYPE_OBJECTS,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'call_duration',\n 'label' => 'Call Duration',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_call_duration',\n 'max' => 'max_call_duration',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getRecipientsFieldData(?Team $team = null, array $value = []): array\n {\n return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);\n }\n\n public function getJiminnyRecipientsFieldData(array $value = []): array\n {\n return $this->recipientsService->getJiminnyRecipientsFieldData($value);\n }\n\n public function getAdditionalPromptInputFieldData(?string $value = null): array\n {\n return [\n 'id' => 'additional_prompt_input',\n 'label' => 'Special requirements',\n 'inputType' => InputTypeEnum::TEXTAREA,\n 'required' => false,\n 'placeholder' => 'What should be the focus of the report?',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCustomReportNameFieldData(?string $value = null): array\n {\n return [\n 'id' => 'custom_name',\n 'label' => 'Custom report name',\n 'inputType' => InputTypeEnum::TEXT,\n 'required' => false,\n 'placeholder' => 'Enter custom name',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n // data providers\n public function getTeams(): array\n {\n $teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);\n\n $teamData = [];\n foreach ($teams as $team) {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n continue;\n }\n\n $teamData[] = $this->transformTeam($team);\n }\n\n return $teamData;\n }\n\n public function getTeamGroups(string $teamUuid): array\n {\n $data = [];\n $team = $this->getTeam($teamUuid);\n\n if ($team !== null) {\n $groups = $team->groups()->get();\n\n foreach ($groups as $group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n public function getTeamsGroupsOptions(array $filterTeamUuids = []): array\n {\n $data = [];\n $teams = $this->getTeams();\n\n foreach ($teams as $team) {\n if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {\n continue;\n }\n\n $data[] = [\n 'label' => $team['name'],\n 'groups' => $this->getTeamGroups($team['id']),\n ];\n }\n\n return $data;\n }\n\n public function getTeam(string $teamUuid): ?Team\n {\n return $this->teamRepository->idOrUuid($teamUuid);\n }\n\n public function getTeamById(int $teamId): ?Team\n {\n return $this->teamRepository->find($teamId);\n }\n\n public function getGroupsUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportGroups = $report->getGroups();\n foreach ($reportGroups as $groupId) {\n if ($group = $this->groupRepository->find($groupId)) {\n $uuids[] = $group->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getPlaybookCategoriesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $playbookCategories = $report->getPlaybookCategories();\n foreach ($playbookCategories as $id) {\n if ($category = $this->playbookCategoryRepository->find($id)) {\n $uuids[] = $category->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getDealAtCallStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getDealAtCallStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getCurrentDealStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getCurrentDealStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getRecipients());\n }\n\n public function getJiminnyUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function extractUserUuids(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => $user->getUuid())\n ->values()\n ->all();\n }\n\n // get mail data\n public function getRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getRecipients());\n }\n\n /**\n * @return array<UserContract>\n */\n public function getRecipientUserObjects(AutomatedReport $report): array\n {\n $userIds = $report->getRecipients()['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->values()\n ->all();\n }\n\n private function getJiminnyRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function buildRecipientUsers(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => [\n 'email' => $user->getEmailAddress(),\n 'name' => $user->getName(),\n 'timezone' => $user->getTimezone()->getName(),\n ])\n ->values()\n ->all();\n }\n\n public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array\n {\n if ($report->isAskJiminnyReport()) {\n $recipients = $this->resolveAskJiminnyRecipients($report);\n } else {\n $recipients = $this->getRecipientUsers($report);\n if ($includeJiminny) {\n $recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));\n }\n }\n\n $emails = [];\n\n return array_values(array_filter(\n $recipients,\n static function ($recipient) use (&$emails) {\n if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {\n return false;\n }\n $emails[] = $recipient['email'];\n\n return true;\n }\n ));\n }\n\n private function resolveAskJiminnyRecipients(AutomatedReport $report): array\n {\n $recipients = [];\n\n $creator = $report->getCreator();\n if ($creator !== null) {\n $recipients[] = [\n 'email' => $creator->getEmailAddress(),\n 'name' => $creator->getName(),\n 'timezone' => $creator->getTimezone()->getName(),\n ];\n }\n\n return array_merge(\n $recipients,\n $this->buildRecipientUsers($report->getRecipients()),\n $this->getGroupRecipientUsers($report),\n );\n }\n\n private function getGroupRecipientUsers(AutomatedReport $report): array\n {\n $users = [];\n foreach ($report->getGroups() as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group === null) {\n continue;\n }\n foreach ($group->getMembers() as $member) {\n $users[] = [\n 'email' => $member->getEmailAddress(),\n 'name' => $member->getName(),\n 'timezone' => $member->getTimezone()->getName(),\n ];\n }\n }\n\n return $users;\n }\n\n public function getReportTypeName(AutomatedReportResult $report): string\n {\n $type = $report->getReport()->getType();\n\n $getType = $this->transformReportType($type);\n\n return $getType['name'];\n }\n\n public function getReportPeriodName(AutomatedReportResult $report): string\n {\n $from = $report->getFromDate();\n $to = $report->getToDate();\n $frequency = $report->getReport()->getFrequency();\n\n if ($from === null || $to === null) {\n if (! $report->getReport()->isAskJiminnyReport()) {\n $invalidPeriod = $from === null ? 'from' : 'to';\n\n throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);\n }\n\n $period = $this->calculateFromAndToDatePeriod($frequency);\n $from = $period['fromDate'];\n $to = $period['toDate'];\n }\n\n return $this->formatReportPeriodName($frequency, $from, $to);\n }\n\n private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string\n {\n $fromYear = $from->format('Y');\n $toYear = $to->format('Y');\n $differentYears = $fromYear !== $toYear;\n\n switch ($frequency) {\n case self::FREQUENCY_DAILY:\n return $from->format('j M Y');\n\n case self::FREQUENCY_QUARTERLY:\n // 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ\n $startMonth = $from->format('M');\n $endMonth = $to->copy()->subMonth();\n $endMonthName = $endMonth->format('M');\n $endMonthYear = $endMonth->format('Y');\n\n if ($differentYears) {\n return \"{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}\";\n }\n\n return \"{$startMonth} - {$endMonthName} {$toYear}\";\n\n case self::FREQUENCY_MONTHLY:\n // 'May 2025' - monthly reports are always within the same year\n return $from->format('M Y');\n\n case self::FREQUENCY_WEEKLY:\n // '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ\n $startDay = $from->format('j');\n $endDay = $to->format('j');\n $startMonth = $from->format('M');\n $endMonth = $to->format('M');\n\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n if ($startMonth !== $endMonth) {\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n return \"{$startDay} - {$endDay} {$endMonth} {$toYear}\";\n\n case self::FREQUENCY_ONE_OFF:\n // '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ\n $startDay = $from->format('j');\n $startMonth = $from->format('M');\n $endDay = $to->format('j');\n $endMonth = $to->format('M');\n\n // If same month and year, use a format like '2-31 May 2025'\n if ($startMonth === $endMonth && ! $differentYears) {\n return \"{$startDay} - {$endDay} {$startMonth} {$toYear}\";\n }\n\n // If different years, include both years\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n // Same year but different months\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n\n default:\n // Default format for unknown frequencies\n return $from->format('j M Y') . ' - ' . $to->format('j M Y');\n }\n }\n\n public function getReportTeamsName(AutomatedReportResult $report): string\n {\n $groups = $report->getGroups();\n\n if (empty($groups)) {\n return 'All';\n }\n\n // Get group names from repository\n $groupNames = [];\n foreach ($groups as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group) {\n $groupNames[] = $group->getName();\n }\n }\n\n if (count($groupNames) === 1) {\n // Single team format\n $teamsName = $groupNames[0];\n } else {\n // Multiple teams format\n $teamsName = implode(', ', $groupNames);\n }\n\n return $teamsName;\n }\n\n public function getReportFileName(AutomatedReportResult $report): string\n {\n $customName = $report->getReport()->getCustomName();\n $periodName = $this->getReportPeriodName($report);\n $filenameSuffix = $this->getFilenameSuffix($report);\n\n if ($customName) {\n if ($filenameSuffix) {\n $customName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$customName} - {$periodName}\");\n }\n\n $baseName = $this->getReportTypeName($report);\n\n if ($filenameSuffix) {\n $baseName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}\");\n }\n\n public function getReportFileNameWithExtension(AutomatedReportResult $result): string\n {\n $extension = $this->getMediaTypeMetadata($result)['extension'];\n\n return $this->getReportFileName($result) . '.' . $extension;\n }\n\n public function sanitizeFileName(string $fileName): string\n {\n return str_replace(['/', '\\\\'], '-', $fileName);\n }\n\n public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool\n {\n $recipients = array_map('intval', $report->getRecipients()['users'] ?? []);\n\n return in_array($user->getId(), $recipients);\n }\n\n public function transformReportResults(Collection $automatedReportResults): array\n {\n $data = [];\n foreach ($automatedReportResults as $automatedReportResult) {\n /** @var AutomatedReportResult $automatedReportResult */\n\n $report = $automatedReportResult->getReport();\n\n $createdBy = $report->getCreator();\n $creator = [\n 'id' => $createdBy?->getUuid(),\n 'name' => $createdBy?->getName(),\n 'email' => $createdBy?->getEmailAddress(),\n 'photoUrl' => $createdBy?->getPhotoUrl(),\n ];\n\n $data[] = [\n 'id' => $automatedReportResult->getUuid(),\n 'name' => $automatedReportResult->getName(),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n 'recipients' => $this->buildRecipients($report),\n 'report_type' => $this->transformReportType($report->getType()),\n 'media_type' => $automatedReportResult->getMediaType(),\n 'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),\n 'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),\n 'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),\n 'creator' => $creator,\n ];\n }\n\n return $data;\n }\n\n private function buildRecipients(AutomatedReport $report): array\n {\n $creatorUuid = $report->getCreator()?->getUuid();\n\n $recipients = array_values(array_filter(\n $this->transformRecipients($report->getRecipients()),\n static fn (array $recipient): bool => $recipient['id'] !== $creatorUuid,\n ));\n\n if (! $report->isAskJiminnyReport()) {\n return $recipients;\n }\n\n return [\n ...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),\n ...$recipients,\n ];\n }\n\n public function hasCallTypeConference(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);\n }\n\n public function hasCallTypeDialer(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);\n }\n\n // transformers\n private function transformTeam(Team $team): array\n {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n return [];\n }\n\n return [\n 'id' => $team->getUuid(),\n 'name' => $team->getName(),\n ];\n }\n\n private function transformReportFullView(AutomatedReport $report): array\n {\n $base = $this->transformReportBase($report);\n\n return $report->getType() === self::TYPE_ASK_JIMINNY\n ? $base + $this->transformAskJiminnyFields($report)\n : $base + $this->transformStandardReportFields($report);\n }\n\n private function transformReportBase(AutomatedReport $report): array\n {\n return [\n 'id' => $report->getUuid(),\n 'organization' => $this->transformOrganization(team: $report->getTeam()),\n 'report_type' => $this->transformReportType($report->getType()),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n ];\n }\n\n private function transformStandardReportFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n\n return [\n 'report_enabled' => $report->getStatus(),\n 'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),\n 'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),\n 'deal_value_min' => $report->getDealValueMin(),\n 'deal_value_max' => $report->getDealValueMax(),\n 'call_types' => $this->transformCallType($report->getCallTypes()),\n 'media_types' => $this->transformMediaTypes($report),\n 'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),\n 'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),\n 'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),\n 'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),\n 'recipients' => $this->transformRecipients($report->getRecipients()),\n 'created_by' => $this->transformCreator($report->getCreator()),\n 'additional_prompt_input' => $report->getAdditionalPromptInput(),\n 'custom_name' => $report->getCustomName(),\n 'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),\n 'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),\n 'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),\n ];\n }\n\n private function transformAskJiminnyFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n $creatorId = $report->getAttribute('created_by');\n $explicitUserIds = array_values(array_filter(\n $report->getRecipients()['users'] ?? [],\n static fn ($id) => $id !== $creatorId\n ));\n\n return [\n 'report_name' => $report->getCustomName(),\n 'enabled' => $report->getStatus(),\n 'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),\n 'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),\n 'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),\n 'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),\n ];\n }\n\n private function transformOrganization(?Team $team): array\n {\n return [\n 'id' => $team?->getUuid(),\n 'name' => $team?->getName(),\n ];\n }\n\n private function transformReportType(string $type): array\n {\n foreach (self::ALL_TYPES as $typeItem) {\n if ($typeItem['id'] === $type) {\n return $typeItem;\n }\n }\n\n return [];\n }\n\n private function transformCallType(array $types): array\n {\n $result = [];\n $callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];\n\n foreach ($types as $type) {\n foreach ($callTypes as $callTypeItem) {\n if ($callTypeItem['id'] === $type) {\n $result[] = $callTypeItem;\n\n break;\n }\n }\n }\n\n return $result;\n }\n\n private function transformMediaTypes(AutomatedReport $report): array\n {\n $values = [];\n\n foreach ($report->getMediaTypes() as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n continue;\n }\n\n $values[] = match ($mediaType) {\n self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,\n self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,\n };\n }\n\n return $values;\n }\n\n private function transformFrequency(string $frequency): array\n {\n foreach (self::ALL_FREQUENCIES as $frequencyItem) {\n if ($frequencyItem['id'] === $frequency) {\n return $frequencyItem;\n }\n }\n\n return [];\n }\n\n public function transformDurationToMinutes(?int $duration): ?int\n {\n if (! $duration) {\n return null;\n }\n\n return (int) ($duration / 60);\n }\n\n private function transformGroups(?Team $team, array $groupsIds): array\n {\n if (empty($groupsIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($groupsIds as $groupId) {\n $group = $team->groups()->where('id', $groupId)->first();\n\n if ($group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n 'photoUrl' => $group->getPhotoUrl(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformStages(?Team $team, array $stagesIds): array\n {\n if (empty($stagesIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($stagesIds as $stageId) {\n $stage = $team->stages()->where('id', $stageId)->first();\n\n if ($stage) {\n $data[] = [\n 'id' => $stage->getUuid(),\n 'name' => $stage->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformRecipients(array $recipients): array\n {\n $users = [];\n foreach ($recipients['users'] ?? [] as $userId) {\n $users[] = $this->transformUser($userId);\n }\n\n return $users;\n }\n\n private function transformCreator(?User $user): ?array\n {\n if ($user === null) {\n return null;\n }\n\n return $this->transformUser($user->getId());\n }\n\n private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array\n {\n if ($prompt === null) {\n return null;\n }\n\n return [\n 'id' => $prompt->getUuid(),\n 'name' => $prompt->getTitle(),\n ];\n }\n\n private function transformSafeSearch(?Search $search): ?array\n {\n if ($search === null) {\n return null;\n }\n\n return [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ];\n }\n\n private function transformUser(int $userId): array\n {\n /* @var ?User $user */\n $user = $this->userRepository->find($userId);\n\n return [\n 'id' => $user?->getUuid(),\n 'name' => $user?->getName(),\n 'email' => $user?->getEmailAddress(),\n 'photoUrl' => $user?->getPhotoUrl(),\n ];\n }\n\n public function create(array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $validatedData['created_by'] = auth()->id();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function update(string $uuid, array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $report = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $report) {\n throw new InvalidArgumentException('Report not found');\n }\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Create an Ask Jiminny report.\n */\n public function createAskJiminnyReport(array $data, User $creator): array\n {\n $validatedData = $this->validateAskJiminnyReportData($data, $creator);\n $validatedData['created_by'] = $creator->getId();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Update an Ask Jiminny report.\n */\n public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array\n {\n if (! $report->isAskJiminnyReport()) {\n throw new InvalidArgumentException('Report is not an Ask Jiminny report');\n }\n\n $validatedData = $this->validateAskJiminnyReportData($data, $user);\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array\n {\n $this->automatedReportsRepository->update($report, ['status' => $status]);\n\n return $this->transformReportFullView($report->fresh());\n }\n\n /**\n * Validate and transform data for Ask Jiminny reports.\n */\n private function validateAskJiminnyReportData(array $data, User $user): array\n {\n // Validate name\n $name = trim($data['report_name'] ?? '');\n if (empty($name)) {\n throw new InvalidArgumentException('Report name is required');\n }\n if (mb_strlen($name) > 50) {\n throw new InvalidArgumentException('Report name must be 50 characters or less');\n }\n\n // Validate frequency (only daily, weekly, monthly for Ask Jiminny)\n $frequency = $data['frequency'] ?? null;\n $askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];\n if (! in_array($frequency, $askJiminnyFrequencies, true)) {\n throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');\n }\n\n // Validate expiration date\n $expiresAt = $data['expires_on'] ?? null;\n if (empty($expiresAt)) {\n throw new InvalidArgumentException('Expiration date is required');\n }\n\n try {\n $expiresAtDate = Carbon::parse($expiresAt);\n } catch (InvalidFormatException $e) {\n throw new InvalidArgumentException('Expiration date format is invalid');\n }\n $maxExpiration = Carbon::now()->addYear()->endOfDay();\n if ($expiresAtDate->gt($maxExpiration)) {\n throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');\n }\n if ($expiresAtDate->isPast()) {\n throw new InvalidArgumentException('Expiration date cannot be in the past');\n }\n\n // Validate saved search\n $activitySearchId = $data['saved_search'] ?? null;\n if (empty($activitySearchId)) {\n throw new InvalidArgumentException('Saved search is required');\n }\n $savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);\n if (! $savedSearch) {\n throw new InvalidArgumentException('Saved search not found or does not belong to you');\n }\n\n // Validate saved prompt\n $askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;\n if (empty($askAnythingPromptId)) {\n throw new InvalidArgumentException('Ask Jiminny prompt is required');\n }\n $prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);\n if (! $prompt) {\n throw new InvalidArgumentException('Ask Jiminny prompt not found');\n }\n\n // Validate status\n $status = $data['enabled'] ?? false;\n\n $recipientUserIds = [$user->getId()];\n\n if (! empty($data['share_users'])) {\n $sharedUserIds = $this->validateAndGetUserIdsByTeam(\n $user->team,\n (array) $data['share_users']\n );\n $recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);\n }\n\n $sharedGroupIds = [];\n if (! empty($data['share_teams'])) {\n $sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);\n }\n\n $recipientUserIds = array_values(array_unique($recipientUserIds));\n\n return [\n 'team_id' => $user->getTeamId(),\n 'type' => self::TYPE_ASK_JIMINNY,\n 'status' => (bool) $status,\n 'frequency' => $frequency,\n 'custom_name' => $name,\n 'activity_search_id' => $savedSearch->getId(),\n 'ask_anything_prompt_id' => $prompt->getId(),\n 'expires_at' => $expiresAtDate->toDateString(),\n 'media_types' => [self::MEDIA_TYPE_PDF],\n 'call_types' => [],\n 'recipients' => ['users' => $recipientUserIds],\n 'groups' => $sharedGroupIds,\n ];\n }\n\n public static function getAskJiminnyFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::ASK_JIMINNY_FREQUENCIES);\n }\n\n public function getAskJiminnyReportFilters(User $user): array\n {\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n return [\n [\n 'id' => 'prompt',\n 'label' => 'Prompt',\n 'options' => $prompts,\n ],\n [\n 'id' => 'saved_search',\n 'label' => 'Saved Search',\n 'options' => $savedSearches,\n ],\n ];\n }\n\n public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array\n {\n $team = $user->getTeam();\n $userTimezone = $user->getTimezone();\n\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n $teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ])->values()->all();\n\n $shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];\n\n $sharedTeamsValue = [];\n $sharedUsersValue = [];\n if ($report) {\n $sharedTeamsValue = $this->transformGroups($team, $report->getGroups());\n\n $recipientUserIds = $report->getRecipients()['users'] ?? [];\n $creatorId = $report->getAttribute('created_by');\n $sharedUserIds = array_values(array_filter(\n $recipientUserIds,\n static fn ($id) => $id !== $creatorId\n ));\n $sharedUsersValue = collect($sharedUserIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (User $u) => [\n 'id' => $u->getUuid(),\n 'name' => $u->getName(),\n ])\n ->values()\n ->all();\n }\n\n return [\n 'fields' => [\n [\n 'id' => 'enabled',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'label' => '',\n 'value' => $report?->getStatus() ?? false,\n ],\n [\n 'id' => 'report_name',\n 'inputType' => InputTypeEnum::TEXT,\n 'label' => 'Name',\n 'placeholder' => 'Enter name',\n 'required' => true,\n 'validation' => ['maxLength' => 50],\n 'value' => $report?->getCustomName() ?? '',\n ],\n [\n 'id' => 'frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Frequency',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::ASK_JIMINNY_FREQUENCIES,\n 'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,\n ],\n [\n 'id' => 'expires_on',\n 'inputType' => InputTypeEnum::DATE,\n 'label' => 'Expires on',\n 'required' => true,\n 'placeholder' => 'Select',\n 'validation' => [\n 'minDate' => now($userTimezone)->toDateString(),\n 'maxDate' => now($userTimezone)->addYear()->toDateString(),\n ],\n 'value' => $report?->getExpiresAt()?->toDateString(),\n ],\n [\n 'id' => 'share_teams',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team',\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $teamGroups,\n 'value' => $sharedTeamsValue,\n ],\n [\n 'id' => 'share_users',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team member',\n 'required' => false,\n 'placeholder' => 'Select',\n 'groupLabelKey' => 'label',\n 'groupValuesKey' => 'users',\n 'optionLabelKey' => 'name',\n 'optionValueKey' => 'id',\n 'options' => $shareUsers,\n 'value' => $sharedUsersValue,\n ],\n [\n 'id' => 'saved_search',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Saved search',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $savedSearches,\n 'value' => $report && $report->getSavedSearch() ? [\n 'id' => $report->getSavedSearch()->getUuid(),\n 'name' => $report->getSavedSearch()->getName(),\n ] : null,\n ],\n [\n 'id' => 'ask_jiminny_prompt',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Ask Jiminny prompt',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $prompts,\n 'value' => $report && $report->getAskAnythingPrompt() ? [\n 'id' => $report->getAskAnythingPrompt()->getUuid(),\n 'name' => $report->getAskAnythingPrompt()->getTitle(),\n ] : null,\n ],\n ],\n ];\n }\n\n private function updateResultNames(AutomatedReport $automatedReport): void\n {\n $results = $this->automatedReportsRepository->getResultsByReport($automatedReport);\n\n foreach ($results as $result) {\n $result->update(['name' => $this->getReportFileName($result)]);\n }\n }\n\n public function updateStatus(string $uuid, array $data): array\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $automatedReport->update([\n 'status' => $status,\n ]);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n private function generateOneOffReport(AutomatedReport $automatedReport): void\n {\n // the scheduler handles all the other frequency types\n if ($automatedReport->getStatus() === false || $automatedReport->getFrequency() !== self::FREQUENCY_ONE_OFF) {\n return;\n }\n\n $this->dispatcher->dispatch(new RequestGenerateReportJob($automatedReport->getUuid()));\n }\n\n public function getReport(string $uuid): AutomatedReport\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n return $automatedReport;\n }\n\n public function get(string $uuid): array\n {\n $automatedReport = $this->getReport($uuid);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function list(string $sortColumn = 'created_at', string $sortDirection = 'desc'): array\n {\n $results = [];\n $collection = $this->automatedReportsRepository->getAllStandardReports($sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function listAskJiminnyReports(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): array {\n $results = [];\n $collection = $this->automatedReportsRepository->getAskJiminnyReportsByUser($user, $sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function delete(string $uuid): void\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $automatedReport->delete();\n }\n\n public function createReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n return $this->automatedReportsRepository->createResult(\n array_merge(\n [\n 'report_id' => $automatedReport->getId(),\n 'status' => AutomatedReportResult::STATUS_DEFAULT,\n ],\n $data\n )\n );\n }\n\n public function getOrCreateReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n $existing = $this->automatedReportsRepository->findLatestDefaultOrFailedResult($automatedReport);\n\n if ($existing !== null) {\n $existing->update(['status' => AutomatedReportResult::STATUS_DEFAULT]);\n\n return $existing;\n }\n\n return $this->createReportResult($automatedReport, $data);\n }\n\n public function getReportResult(string $resultUuid): AutomatedReportResult\n {\n $report = $this->automatedReportsRepository->findResultByUuid($resultUuid);\n\n if (! $report) {\n throw new ModelNotFoundException('Report Result not found');\n }\n\n return $report;\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return $this->automatedReportsRepository->findChildResult($result, $type);\n }\n\n // prophet API calls\n /**\n * @throws ApplicationException\n */\n public function getGenerateReportPayload(AutomatedReport $automatedReport, string $reportResultUuid): array\n {\n $period = $this->calculateFromAndToDate($automatedReport);\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n return [\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResultUuid,\n 'report_type' => $automatedReport->getType(),\n 'media_types' => $automatedReport->getMediaTypes(),\n 'from_date' => $fromDate->startOfDay()->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->endOfDay()->format(DateTimeInterface::RFC3339),\n 'group_ids' => $automatedReport->getGroups(),\n 'call_deal_stage' => $automatedReport->getDealAtCallStages(),\n 'current_deal_stage' => $automatedReport->getCurrentDealStages(),\n 'deal_min_value' => $automatedReport->getDealValueMin(),\n 'deal_max_value' => $automatedReport->getDealValueMax(),\n 'call_types' => $automatedReport->getCallTypes(),\n 'call_duration_min_seconds' => $automatedReport->getCallDurationMin(),\n 'call_duration_max_seconds' => $automatedReport->getCallDurationMax(),\n 'special_requirements' => $automatedReport->getAdditionalPromptInput(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->formatReportPeriodName(\n $automatedReport->getFrequency(),\n $fromDate,\n $toDate,\n ),\n 'playbook_categories' => $automatedReport->getPlaybookCategories(),\n 'custom_name' => $automatedReport->getCustomName(),\n ];\n }\n\n // $inputPayload - FE payload structure\n public function getActivitiesCountPayload(array $inputPayload): array\n {\n // Use validateAndTransformData to validate and normalize input\n $validatedData = $this->validateAndTransformData($inputPayload);\n $period = $this->calculateFromAndToDatePeriod(\n $validatedData['frequency'],\n Carbon::parse($validatedData['from']),\n Carbon::parse($validatedData['to']),\n );\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n // Create payload similar to getGenerateReportPayload\n return [\n 'team_id' => $validatedData['team_id'],\n 'group_ids' => $validatedData['groups'] ?? [],\n 'report_type' => $validatedData['type'],\n 'from_date' => $fromDate->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->format(DateTimeInterface::RFC3339),\n 'call_deal_stage' => $validatedData['deal_at_call_stages'] ?? [],\n 'current_deal_stage' => $validatedData['current_deal_stages'] ?? [],\n 'deal_min_value' => $validatedData['deal_value_min'] ?? null,\n 'deal_max_value' => $validatedData['deal_value_max'] ?? null,\n 'call_types' => $validatedData['call_types'],\n 'call_duration_min_seconds' => $validatedData['call_duration_min'] ?? null,\n 'call_duration_max_seconds' => $validatedData['call_duration_max'] ?? null,\n 'special_requirements' => $validatedData['additional_prompt_input'] ?? null,\n 'playbook_categories' => $validatedData['playbook_categories'] ?? [],\n 'request_id' => null,\n 'callback_url' => null,\n ];\n }\n\n public function shouldSendReport(array $users, ?CarbonInterface $generatedAt = null): bool\n {\n if (empty($users)) {\n return false;\n }\n\n $earliestTz = collect($users)\n ->mapWithKeys(function (array $user) {\n $tz = new DateTimeZone($user['timezone']);\n $nowUtc = new DateTime('now', new DateTimeZone('UTC'));\n $offset = $tz->getOffset($nowUtc);\n\n return [$user['timezone'] => $offset];\n })\n ->sortDesc()\n ->keys()\n ->first();\n\n $now = Carbon::now($earliestTz);\n $isScheduledTime = (int) $now->format('H') === self::SENT_REPORT_AT_HOURS;\n\n if ($isScheduledTime) {\n return true;\n }\n\n return $this->hasPassedScheduledTime($generatedAt, $earliestTz);\n }\n\n public function hasPassedScheduledTime(?CarbonInterface $generatedAt, string $timezone): bool\n {\n if ($generatedAt === null) {\n return false;\n }\n\n $now = Carbon::now($timezone);\n $scheduledTime = $now->copy()->setTime(self::SENT_REPORT_AT_HOURS, 0, 0);\n\n if ($now->hour < self::SENT_REPORT_AT_HOURS) {\n $scheduledTime = $scheduledTime->subDay();\n }\n\n $scheduledTimeUtc = $scheduledTime->copy()->utc();\n $generatedAtUtc = $generatedAt->copy()->utc();\n $nowUtc = $now->copy()->utc();\n\n return $generatedAtUtc->lt($scheduledTimeUtc) && $nowUtc->gt($scheduledTimeUtc);\n }\n\n public function calculateFromAndToDatePeriod(\n string $frequency,\n ?Carbon $fromDate = null,\n ?Carbon $toDate = null\n ): array {\n if ($frequency === self::FREQUENCY_ONE_OFF) {\n return [\n 'fromDate' => $fromDate,\n 'toDate' => $toDate,\n ];\n }\n\n $now = Carbon::now();\n\n return match ($frequency) {\n self::FREQUENCY_DAILY => [\n 'fromDate' => $now->copy()->subDay()->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_WEEKLY => [\n 'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_MONTHLY => [\n 'fromDate' => $now->copy()->subMonths(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_QUARTERLY => [\n 'fromDate' => $now->copy()->subMonths(3)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n default => throw new InvalidArgumentException(\"Unsupported frequency: {$frequency}\"),\n };\n }\n\n private function calculateFromAndToDate(AutomatedReport $automatedReport): array\n {\n return $this->calculateFromAndToDatePeriod(\n $automatedReport->getFrequency(),\n $automatedReport->getFrom(),\n $automatedReport->getTo()\n );\n }\n\n public function getAskJiminnyGenerateReportPayload(\n AutomatedReport $automatedReport,\n AutomatedReportResult $reportResult,\n array $activityIds,\n ): array {\n return [\n 'user_question' => $automatedReport->getAskAnythingPrompt()?->getContent(),\n 'call_ids' => array_map('strval', $activityIds),\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResult->getUuid(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->getReportPeriodName($reportResult),\n 'report_name' => $automatedReport->getCustomName(),\n ];\n }\n\n private function getCallbackUrl(): string\n {\n return $this->webhookService->route('jiminny.webhook.reports.ready');\n }\n\n /**\n * Validate and transform payload data for automated reports\n *\n * @param array $data\n *\n * @throws InvalidArgumentException\n *\n * @return array\n */\n private function validateAndTransformData(array $data): array\n {\n // Validate organization (team) and check feature\n $team = $this->validateOrganization($data['organization'] ?? null);\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $type = $this->validateReportType($data['report_type'] ?? null);\n $frequency = $this->validateFrequency($data['frequency'] ?? null);\n $additionalPromptInput = $this->validateAdditionalPromptInput(\n $data['additional_prompt_input'] ?? null\n );\n $customReportName = $this->validateCustomReportName($data['custom_name'] ?? null);\n\n // Prepare data for the database\n $reportData = [\n 'team_id' => $team->getId(),\n 'type' => $type,\n 'status' => $status,\n 'frequency' => $frequency,\n 'additional_prompt_input' => $additionalPromptInput,\n 'custom_name' => $customReportName,\n ];\n\n // Validate deal values\n $reportData = $this->validateDealValues($data, $reportData);\n\n // Validate date range\n $reportData = $this->validateDateRange($data, $reportData, $frequency);\n\n // Validate call durations\n $reportData = $this->validateCallDurations($data, $reportData);\n\n // Validate call types\n $reportData = $this->validateCallTypes($data, $reportData);\n\n // Validate media types\n $reportData = $this->validateMediaTypes($data, $reportData);\n\n // Validate groups\n if (isset($data['teams'])) {\n $reportData['groups'] = $this->validateAndGetGroupIds($team, $data['teams']);\n }\n\n // Validate deal stages\n $reportData = $this->validateDealStages($data, $reportData, $team, $type);\n\n // Validate playbook categories\n $reportData = $this->validatePlaybookCategories($data, $reportData, $team);\n\n // Validate recipients\n $reportData['recipients'] = [\n 'users' => $this->validateAndGetUserIdsByTeam($team, $data['recipients'] ?? []),\n ];\n\n if (isset($data['jiminny_recipients'])) {\n // Validate Jiminny recipients\n $reportData['jiminny_recipients'] = [\n 'users' => $this->validateAndGetJiminnyUserIds((array) $data['jiminny_recipients']),\n ];\n }\n\n return $reportData;\n }\n\n private function validateDealValues(array $data, array $reportData): array\n {\n if (isset($data['min_deal_value'])) {\n $reportData['deal_value_min'] = (int) $data['min_deal_value'];\n\n if ($reportData['deal_value_min'] > 4294967295 || $reportData['deal_value_min'] < 0) {\n throw new InvalidArgumentException('Min deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_deal_value'])) {\n $reportData['deal_value_max'] = (int) $data['max_deal_value'];\n\n if ($reportData['deal_value_max'] > 4294967295 || $reportData['deal_value_max'] < 0) {\n throw new InvalidArgumentException('Max deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['min_deal_value'], $data['max_deal_value'])\n && $data['min_deal_value'] > $data['max_deal_value']\n ) {\n throw new InvalidArgumentException('Min deal value cannot be greater than max deal value');\n }\n\n return $reportData;\n }\n\n private function validateDateRange(array $data, array $reportData, string $frequency): array\n {\n // Set date range only for one_off frequency\n if ($frequency === 'one_off') {\n if (isset($data['start_date_period'])) {\n $reportData['from'] = $this->parseDate($data['start_date_period']);\n }\n\n if (isset($data['end_date_period'])) {\n $reportData['to'] = $this->parseDate($data['end_date_period']);\n }\n\n if (empty($reportData['from']) || empty($reportData['to'])) {\n throw new InvalidArgumentException(\n 'Start date and end date are required for one_off frequency'\n );\n }\n } else {\n $reportData['from'] = null;\n $reportData['to'] = null;\n }\n\n return $reportData;\n }\n\n private function validateCallDurations(array $data, array $reportData): array\n {\n // Convert call durations from minutes to seconds\n if (isset($data['min_call_duration'])) {\n $reportData['call_duration_min'] = (int) $data['min_call_duration'] * 60;\n\n if ($reportData['call_duration_min'] > 4294967295 || $reportData['call_duration_min'] < 0) {\n throw new InvalidArgumentException('Min call duration should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_call_duration'])) {\n $reportData['call_duration_max'] = (int) $data['max_call_duration'] * 60;\n\n if ($reportData['call_duration_max'] > 4294967295 || $reportData['call_duration_max'] < 0) {\n throw new InvalidArgumentException('Max call duration should be between 0 and 4294967295');\n }\n }\n\n return $reportData;\n }\n\n private function validateCallTypes(array $data, array $reportData): array\n {\n // Set call types\n $reportData['call_types'] = $data['call_type'] ?? [];\n if (empty($reportData['call_types'])) {\n $reportData['call_types'] = self::getCallTypes();\n }\n\n foreach ($reportData['call_types'] as $callType) {\n if (! in_array($callType, self::getCallTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Call type %s is invalid', $callType));\n }\n }\n\n return $reportData;\n }\n\n private function validateMediaTypes(array $data, array $reportData): array\n {\n // Set media types from input data\n $reportData['media_types'] = $data['media_types'] ?? [];\n\n if (empty($reportData['media_types'])) {\n throw new InvalidArgumentException('Media types are required');\n }\n\n foreach ($reportData['media_types'] as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n throw new InvalidArgumentException(sprintf('Media type %s is invalid', $mediaType));\n }\n }\n\n return $reportData;\n }\n\n private function validateDealStages(array $data, array $reportData, Team $team, string $reportType): array\n {\n // Validate and set deal stages\n if (isset($data['deal_stage_at_call'])) {\n $reportData['deal_at_call_stages'] =\n $this->validateAndGetDealStageIds($team, $data['deal_stage_at_call'], 'Deal stage at call');\n }\n\n if (isset($data['current_deal_stage'])) {\n $reportData['current_deal_stages'] =\n $this->validateAndGetDealStageIds($team, $data['current_deal_stage'], 'Current deal stage');\n }\n\n // Ensure current_deal_stage is not provided for loss_analysis report type\n if ($reportType === self::TYPE_LOSS_ANALYSIS && ! empty($data['current_deal_stage'])) {\n throw new InvalidArgumentException('Current deal stage is not applicable for Loss Analysis reports');\n }\n\n return $reportData;\n }\n\n // transform uuid to id\n private function validatePlaybookCategories(array $data, array $reportData, Team $team): array\n {\n $key = 'playbook_categories';\n\n if (isset($data[$key])) {\n $payloadIds = $data[$key];\n $ids = [];\n\n foreach ($payloadIds as $uuid) {\n $uuid = (string) $uuid;\n\n try {\n $playbookCategory = $this->playbookCategoryRepository->findByUuid($uuid);\n } catch (Throwable $throwable) {\n Log::error(__METHOD__ . ' ' . $throwable->getMessage());\n\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory) {\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory->hasPlaybook()) {\n throw new InvalidArgumentException(sprintf('Playbook category %s has no playbook', $uuid));\n }\n\n if ($playbookCategory->getPlaybook()->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Playbook category %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $ids[] = $playbookCategory->getId();\n }\n\n $reportData[$key] = $ids;\n }\n\n return $reportData;\n }\n\n private function validateReportStatus($status): bool\n {\n if (! in_array($status, [true, false], true)) {\n throw new InvalidArgumentException('Report status is invalid');\n }\n\n return $status;\n }\n\n private function validateReportType($type): string\n {\n if (! in_array($type, self::getTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Report type is invalid: %s', $type));\n }\n\n return $type;\n }\n\n private function validateFrequency($frequency): string\n {\n if (! in_array($frequency, self::getFrequencies(), true)) {\n throw new InvalidArgumentException('Frequency is invalid');\n }\n\n return $frequency;\n }\n\n private function validateAdditionalPromptInput(?string $additionalPromptInput): ?string\n {\n if ($additionalPromptInput && strlen($additionalPromptInput) > 5000) {\n throw new InvalidArgumentException('Additional Prompt Input should be less than 5000 characters');\n }\n\n return $additionalPromptInput;\n }\n\n private function validateCustomReportName(?string $customReportName): ?string\n {\n if ($customReportName === null || $customReportName === '') {\n return null;\n }\n\n if (strlen($customReportName) > 70) {\n throw new InvalidArgumentException('Custom report name should be less than 70 characters');\n }\n\n return $customReportName;\n }\n\n private function validateOrganization(?string $organizationUuid): Team\n {\n if (! $organizationUuid) {\n throw new InvalidArgumentException('Organization is required');\n }\n\n $team = $this->teamRepository->idOrUuid($organizationUuid);\n\n if (! $team) {\n throw new InvalidArgumentException('Organization not found');\n }\n\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n throw new InvalidArgumentException('Organization does not have the Automated Reports feature');\n }\n\n return $team;\n }\n\n private function validateAndGetGroupIds(Team $team, array $teamUuids): array\n {\n $groupIds = [];\n\n foreach ($teamUuids as $uuid) {\n $group = $this->groupRepository->findByUuid($uuid);\n\n if ($group === null || $group->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Group %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $groupIds[] = $group->getId();\n\n }\n\n return $groupIds;\n }\n\n private function validateAndGetDealStageIds(Team $team, array $stageUuids, string $propertyLabel): array\n {\n $stageIds = [];\n\n foreach ($stageUuids as $uuid) {\n $stage = $this->stageRepository->findByUuid($uuid);\n\n if ($stage === null || $stage->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Stage %s not found for team %s for %s', $uuid, $team->getUuid(), $propertyLabel)\n );\n }\n\n $stageIds[] = $stage->getId();\n }\n\n return $stageIds;\n }\n\n private function validateAndGetUserIds(array $userUuids, callable $teamCheck): array\n {\n if (empty($userUuids)) {\n return [];\n }\n\n $userIds = [];\n\n foreach ($userUuids as $uuid) {\n $user = $this->userRepository->findByUuid($uuid);\n\n if (! $user || ! $user->isStatusActive()) {\n throw new InvalidArgumentException(\n sprintf('User %s not found or is not active', $uuid)\n );\n }\n\n if (! $teamCheck($user)) {\n throw new InvalidArgumentException(\n sprintf('User %s does not belong to the allowed team(s)', $uuid)\n );\n }\n\n $userIds[] = $user->getId();\n }\n\n return $userIds;\n }\n\n private function validateAndGetUserIdsByTeam(Team $team, array $userUuids): array\n {\n return $this->validateAndGetUserIds($userUuids, fn ($user) => $user->getTeamId() === $team->getId());\n }\n\n private function validateAndGetJiminnyUserIds(array $userUuids): array\n {\n $allowedTeamIds = config('kiosk.teamIds', []);\n\n return $this->validateAndGetUserIds($userUuids, fn ($user) => in_array($user->getTeamId(), $allowedTeamIds, true));\n }\n\n private function parseDate(string $dateString): string\n {\n return date('Y-m-d H:i:s', strtotime($dateString));\n }\n\n private function generateReportResultViewUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.view', ['uuid' => $result->getUuid()]);\n }\n\n private function generateReportResultDownloadUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.download', ['uuid' => $result->getUuid()]);\n }\n\n private function getReportMediaRouteResource(AutomatedReportResult $result): string\n {\n if ($result->getMediaType() === self::MEDIA_TYPE_PDF) {\n return self::PDF_KEY;\n } elseif ($result->getMediaType() === self::MEDIA_TYPE_PODCAST) {\n return self::AUDIO_KEY;\n }\n\n throw new \\InvalidArgumentException('Unknown media type.');\n }\n\n public function getMediaPath(AutomatedReportResult $result): ?string\n {\n $url = match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => $result->getPdfUrl(),\n self::MEDIA_TYPE_PODCAST => $result->getPodcastAudioUrl(),\n default => null,\n };\n\n if ($url === null) {\n return null;\n }\n\n $path = parse_url(trim($url, '\"\\''), PHP_URL_PATH);\n\n return $path ?: null;\n }\n\n public function getFilenameSuffix(AutomatedReportResult $result): ?string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => 'Podcast',\n default => null,\n };\n }\n\n public function getMailSubjectSuffix(AutomatedReportResult $result): string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => 'report',\n self::MEDIA_TYPE_PODCAST => 'podcast',\n default => '',\n };\n }\n\n public function getMediaTypeMetadata(AutomatedReportResult $result): array\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => ['extension' => 'mp3', 'mime' => 'audio/mpeg'],\n self::MEDIA_TYPE_PDF => ['extension' => 'pdf', 'mime' => 'application/pdf'],\n default => ['extension' => null, 'mime' => null],\n };\n }\n\n public function deleteS3Files(AutomatedReportResult $result): void\n {\n $teamUuid = $result->getReport()->getTeam()->getUuid();\n $reportUuid = $result->getUuid();\n\n // delete all files for a report uuid no mather of pdf, podcast, or both\n // in case of both - the podcast files are linked to the pdf (parent) uuid\n // pdf and podcast date times should be close\n $path = sprintf('%s/%s/%s', $teamUuid, self::S3_DIR, $reportUuid);\n\n foreach (self::FILE_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted S3 file', [\n 'path' => $file,\n ]);\n }\n }\n\n foreach (self::FILE_PODCAST_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '_podcast.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted Podcast S3 file', [\n 'path' => $file,\n ]);\n }\n }\n }\n\n /**\n *\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): Collection\n {\n return $this->automatedReportsRepository->getTeamIdsWithReportsResults($teamId);\n }\n\n /**\n * Core delete logic for report results using a query\n *\n * @param Builder $query\n * @param array $logContext\n *\n * @return int\n */\n private function deleteReportResultsByQuery(Builder $query, array $logContext = []): int\n {\n $deletedCount = 0;\n\n if ($query->exists()) {\n Log::info(\n 'Run delete report results',\n array_merge(\n $logContext,\n [\n 'service' => 'AutomatedReportsService',\n ]\n )\n );\n\n $query->chunkById(50, function ($results) use (&$deletedCount, $logContext) {\n foreach ($results as $result) {\n $this->deleteReportResult($result);\n $deletedCount++;\n\n Log::info(\n 'Deleted a report result',\n array_merge(\n $logContext,\n [\n 'result_id' => $result->getId(),\n 'report_id' => $result->getReportId(),\n ]\n )\n );\n }\n });\n }\n\n return $deletedCount;\n }\n\n /**\n * Delete report results for a team by retention period\n *\n * @param Team $team\n * @param CarbonImmutable $retentionDate\n *\n * @return int Number of deleted report results\n */\n public function deleteReportsResultsInRetentionPeriod(Team $team, CarbonImmutable $retentionDate): int\n {\n $reportIds = $this->automatedReportsRepository->getReportIdsByTeam($team);\n\n if ($reportIds->isEmpty()) {\n return 0;\n }\n\n $query = $this->automatedReportsRepository\n ->getReportResultsQueryForRetention($team, $retentionDate);\n\n return $this->deleteReportResultsByQuery($query, [\n 'team_id' => $team->getId(),\n 'retention_date' => $retentionDate->toDateTimeString(),\n ]);\n }\n\n /**\n * Delete ALL report results for a specific automated report\n *\n * @param string $uuid\n *\n * @return int\n */\n public function deleteReportResults(string $uuid): int\n {\n $report = $this->getReport($uuid);\n\n $query = $this->automatedReportsRepository->getResultsByReportQuery($report);\n\n return $this->deleteReportResultsByQuery($query, [\n 'report_uuid' => $uuid,\n 'report_id' => $report->getId(),\n ]);\n }\n\n public function deleteReportResult(AutomatedReportResult $result): void\n {\n $this->deleteS3Files($result);\n\n $result->delete();\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getTeamReports(Team $team): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getReportsByTeam($team);\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getReportResults(AutomatedReport $report): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getResultsByReport($report);\n }\n\n public function deleteAllReportResults(AutomatedReport $report): void\n {\n $results = $this->getReportResults($report);\n\n /** @var AutomatedReportResult $result */\n foreach ($results as $result) {\n Log::info('Deleting result', [\n 'report' => $report->getId(),\n 'result' => $result->getId(),\n ]);\n\n $this->deleteReportResult($result);\n }\n }\n\n public function deleteAllData(Team $team): void\n {\n Log::info('Deleting automated report and results for team', [\n 'team' => $team->getId(),\n ]);\n\n $reports = $this->getTeamReports($team);\n\n /** @var AutomatedReport $report */\n foreach ($reports as $report) {\n Log::info('Deleting report', [\n 'team' => $team->getId(),\n 'report' => $report->getId(),\n ]);\n\n $this->deleteAllReportResults($report);\n\n $report->delete();\n }\n }\n}","depth":4,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Kiosk\\AutomatedReports;\n\nuse Carbon\\CarbonImmutable;\nuse Carbon\\CarbonInterface;\nuse Carbon\\Exceptions\\InvalidFormatException;\nuse DateTime;\nuse DateTimeInterface;\nuse DateTimeZone;\nuse Illuminate\\Contracts\\Bus\\Dispatcher as BusDispatcher;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Support\\Facades\\Log;\nuse Illuminate\\Support\\Facades\\Storage;\nuse Jiminny\\Component\\ActivitySearch\\FilterDefinition\\InputTypeEnum;\nuse Jiminny\\Component\\AskAnything\\AskAnythingPromptService;\nuse Jiminny\\Component\\AskAnything\\Dtos\\AskAnythingPromptDto;\nuse Jiminny\\Component\\UrlGenerator\\Webhook;\nuse Jiminny\\Contracts\\Repositories\\PlaybookCategoryRepository;\nuse Jiminny\\Contracts\\Repositories\\TeamRepository;\nuse Jiminny\\Contracts\\Repositories\\UserRepository;\nuse Jiminny\\Exceptions\\ApplicationException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Exceptions\\ModelNotFoundException;\nuse Jiminny\\Jobs\\AutomatedReports\\RequestGenerateReportJob;\nuse Jiminny\\Models\\Activity\\Search;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPrompt;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPromptTarget;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Contracts\\UserContract;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Repositories\\AskAnythingRepository;\nuse Jiminny\\Repositories\\AutomatedReportsRepository;\nuse Jiminny\\Repositories\\GroupRepository;\nuse Jiminny\\Repositories\\SearchRepository;\nuse Jiminny\\Repositories\\StageRepository;\nuse Throwable;\n\nclass AutomatedReportsService\n{\n public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';\n public const string TYPE_ASK_JIMINNY = 'ask_jiminny';\n\n /**\n * Standard report types (used by kiosk for existing automated reports).\n */\n // @TODO this will add filter, however if we need to control feature by FF we need conditional logic\n public const array TYPES = [\n ['id' => 'exec_summary', 'name' => 'Exec Summary'],\n ['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],\n ['id' => 'product_feedback', 'name' => 'Product Feedback'],\n ['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],\n// ['id' => 'questions', 'name' => 'Questions'],\n// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],\n ];\n\n public const array ALL_TYPES = [\n ...self::TYPES,\n ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],\n ];\n\n public const string FREQUENCY_DAILY = 'daily';\n public const string FREQUENCY_WEEKLY = 'weekly';\n public const string FREQUENCY_MONTHLY = 'monthly';\n public const string FREQUENCY_QUARTERLY = 'quarterly';\n public const string FREQUENCY_ONE_OFF = 'one_off';\n\n /**\n * Frequencies for standard (non-Ask Jiminny) reports.\n */\n public const array FREQUENCIES = [\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n\n /**\n * Frequencies for Ask Jiminny reports.\n */\n public const array ASK_JIMINNY_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ];\n\n public const string MEDIA_TYPE_PDF = 'pdf';\n public const string MEDIA_TYPE_PODCAST = 'podcast';\n public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];\n public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];\n public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];\n public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];\n\n public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];\n public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];\n public const int SENT_REPORT_AT_HOURS = 5;\n public const string PDF_KEY = 'pdf';\n public const string AUDIO_KEY = 'audio';\n\n private const array ALL_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n private const string S3_DIR = 'reports';\n private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];\n private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];\n\n public function __construct(\n private readonly TeamRepository $teamRepository,\n private readonly GroupRepository $groupRepository,\n private readonly UserRepository $userRepository,\n private readonly StageRepository $stageRepository,\n private readonly DealStagesService $dealStagesService,\n private readonly RecipientsService $recipientsService,\n private readonly AutomatedReportsRepository $automatedReportsRepository,\n private readonly Webhook $webhookService,\n private readonly BusDispatcher $dispatcher,\n private readonly ActivityTypeService $activityTypeService,\n private readonly PlaybookCategoryRepository $playbookCategoryRepository,\n private readonly AskAnythingPromptService $askAnythingPromptService,\n private readonly SearchRepository $activitySearchRepository,\n private readonly AskAnythingRepository $askAnythingRepository,\n ) {\n }\n\n public static function getTypes(): array\n {\n $types = self::TYPES;\n\n return array_map(static function ($type) {\n return $type['id'];\n }, $types);\n }\n\n public static function getCallTypes(): array\n {\n return array_map(static function ($callType) {\n return $callType['id'];\n }, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);\n }\n\n public static function getFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::FREQUENCIES);\n }\n\n // front-facing structure\n public function getReportEnabledFieldData(bool $value = false): array\n {\n return [\n 'id' => 'report_enabled',\n 'label' => '',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'value' => $value,\n ];\n }\n\n // Organizations = Teams\n public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array\n {\n $options = $this->getTeams();\n\n if ($shortVersion) {\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value,\n 'dependencies' => [\n 'teams',\n 'deal_stage_at_call',\n 'current_deal_stage',\n 'recipients',\n ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,\n ],\n 'dependsOn' => [],\n ];\n }\n\n // Teams = Groups\n public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array\n {\n if ($shortVersion) {\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value, // value should be an array of objects {id, name}\n 'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],\n 'dependsOn' => [],\n ];\n }\n\n public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array\n {\n $types = [];\n if ($team instanceof Team) {\n if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n $types = self::TYPES;\n }\n if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {\n $types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];\n }\n } else {\n $types = self::TYPES;\n }\n\n if ($shortVersion) {\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'options' => $types,\n ];\n }\n\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $types,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getFrequencyFieldData(?string $value = null): array\n {\n return [\n 'id' => 'frequency',\n 'label' => 'Frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::FREQUENCIES,\n 'value' => $value,\n 'dependencies' => ['period'],\n 'dependsOn' => [],\n ];\n }\n\n public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array\n {\n return [\n 'id' => 'period',\n 'label' => 'Select one-off period',\n 'inputType' => InputTypeEnum::DATE_RANGE,\n 'required' => true,\n 'placeholder' => 'Select',\n 'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],\n 'queryParams' => [\n 'startDate' => 'start_date_period',\n 'endDate' => 'end_date_period',\n ],\n 'dependencies' => [],\n 'dependsOn' => ['frequency'],\n ];\n }\n\n public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array\n {\n return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);\n }\n\n public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);\n }\n\n public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);\n }\n\n public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'deal_value',\n 'label' => 'Deal Value',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_deal_value',\n 'max' => 'max_deal_value',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array\n {\n $value = [];\n $conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;\n $dialerOn && $value[] = self::CALL_TYPE_DIALER;\n\n return [\n 'id' => 'call_type',\n 'label' => 'Call Type',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => [\n self::CALL_TYPE_CONFERENCE,\n self::CALL_TYPE_DIALER,\n ],\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getMediaTypeFieldData(?AutomatedReport $report = null): array\n {\n $value = [];\n\n if ($report) {\n $value = $this->transformMediaTypes($report);\n }\n\n return [\n 'id' => 'media_types',\n 'label' => 'Export as',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => self::MEDIA_TYPE_OBJECTS,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'call_duration',\n 'label' => 'Call Duration',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_call_duration',\n 'max' => 'max_call_duration',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getRecipientsFieldData(?Team $team = null, array $value = []): array\n {\n return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);\n }\n\n public function getJiminnyRecipientsFieldData(array $value = []): array\n {\n return $this->recipientsService->getJiminnyRecipientsFieldData($value);\n }\n\n public function getAdditionalPromptInputFieldData(?string $value = null): array\n {\n return [\n 'id' => 'additional_prompt_input',\n 'label' => 'Special requirements',\n 'inputType' => InputTypeEnum::TEXTAREA,\n 'required' => false,\n 'placeholder' => 'What should be the focus of the report?',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCustomReportNameFieldData(?string $value = null): array\n {\n return [\n 'id' => 'custom_name',\n 'label' => 'Custom report name',\n 'inputType' => InputTypeEnum::TEXT,\n 'required' => false,\n 'placeholder' => 'Enter custom name',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n // data providers\n public function getTeams(): array\n {\n $teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);\n\n $teamData = [];\n foreach ($teams as $team) {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n continue;\n }\n\n $teamData[] = $this->transformTeam($team);\n }\n\n return $teamData;\n }\n\n public function getTeamGroups(string $teamUuid): array\n {\n $data = [];\n $team = $this->getTeam($teamUuid);\n\n if ($team !== null) {\n $groups = $team->groups()->get();\n\n foreach ($groups as $group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n public function getTeamsGroupsOptions(array $filterTeamUuids = []): array\n {\n $data = [];\n $teams = $this->getTeams();\n\n foreach ($teams as $team) {\n if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {\n continue;\n }\n\n $data[] = [\n 'label' => $team['name'],\n 'groups' => $this->getTeamGroups($team['id']),\n ];\n }\n\n return $data;\n }\n\n public function getTeam(string $teamUuid): ?Team\n {\n return $this->teamRepository->idOrUuid($teamUuid);\n }\n\n public function getTeamById(int $teamId): ?Team\n {\n return $this->teamRepository->find($teamId);\n }\n\n public function getGroupsUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportGroups = $report->getGroups();\n foreach ($reportGroups as $groupId) {\n if ($group = $this->groupRepository->find($groupId)) {\n $uuids[] = $group->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getPlaybookCategoriesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $playbookCategories = $report->getPlaybookCategories();\n foreach ($playbookCategories as $id) {\n if ($category = $this->playbookCategoryRepository->find($id)) {\n $uuids[] = $category->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getDealAtCallStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getDealAtCallStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getCurrentDealStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getCurrentDealStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getRecipients());\n }\n\n public function getJiminnyUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function extractUserUuids(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => $user->getUuid())\n ->values()\n ->all();\n }\n\n // get mail data\n public function getRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getRecipients());\n }\n\n /**\n * @return array<UserContract>\n */\n public function getRecipientUserObjects(AutomatedReport $report): array\n {\n $userIds = $report->getRecipients()['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->values()\n ->all();\n }\n\n private function getJiminnyRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function buildRecipientUsers(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => [\n 'email' => $user->getEmailAddress(),\n 'name' => $user->getName(),\n 'timezone' => $user->getTimezone()->getName(),\n ])\n ->values()\n ->all();\n }\n\n public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array\n {\n if ($report->isAskJiminnyReport()) {\n $recipients = $this->resolveAskJiminnyRecipients($report);\n } else {\n $recipients = $this->getRecipientUsers($report);\n if ($includeJiminny) {\n $recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));\n }\n }\n\n $emails = [];\n\n return array_values(array_filter(\n $recipients,\n static function ($recipient) use (&$emails) {\n if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {\n return false;\n }\n $emails[] = $recipient['email'];\n\n return true;\n }\n ));\n }\n\n private function resolveAskJiminnyRecipients(AutomatedReport $report): array\n {\n $recipients = [];\n\n $creator = $report->getCreator();\n if ($creator !== null) {\n $recipients[] = [\n 'email' => $creator->getEmailAddress(),\n 'name' => $creator->getName(),\n 'timezone' => $creator->getTimezone()->getName(),\n ];\n }\n\n return array_merge(\n $recipients,\n $this->buildRecipientUsers($report->getRecipients()),\n $this->getGroupRecipientUsers($report),\n );\n }\n\n private function getGroupRecipientUsers(AutomatedReport $report): array\n {\n $users = [];\n foreach ($report->getGroups() as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group === null) {\n continue;\n }\n foreach ($group->getMembers() as $member) {\n $users[] = [\n 'email' => $member->getEmailAddress(),\n 'name' => $member->getName(),\n 'timezone' => $member->getTimezone()->getName(),\n ];\n }\n }\n\n return $users;\n }\n\n public function getReportTypeName(AutomatedReportResult $report): string\n {\n $type = $report->getReport()->getType();\n\n $getType = $this->transformReportType($type);\n\n return $getType['name'];\n }\n\n public function getReportPeriodName(AutomatedReportResult $report): string\n {\n $from = $report->getFromDate();\n $to = $report->getToDate();\n $frequency = $report->getReport()->getFrequency();\n\n if ($from === null || $to === null) {\n if (! $report->getReport()->isAskJiminnyReport()) {\n $invalidPeriod = $from === null ? 'from' : 'to';\n\n throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);\n }\n\n $period = $this->calculateFromAndToDatePeriod($frequency);\n $from = $period['fromDate'];\n $to = $period['toDate'];\n }\n\n return $this->formatReportPeriodName($frequency, $from, $to);\n }\n\n private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string\n {\n $fromYear = $from->format('Y');\n $toYear = $to->format('Y');\n $differentYears = $fromYear !== $toYear;\n\n switch ($frequency) {\n case self::FREQUENCY_DAILY:\n return $from->format('j M Y');\n\n case self::FREQUENCY_QUARTERLY:\n // 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ\n $startMonth = $from->format('M');\n $endMonth = $to->copy()->subMonth();\n $endMonthName = $endMonth->format('M');\n $endMonthYear = $endMonth->format('Y');\n\n if ($differentYears) {\n return \"{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}\";\n }\n\n return \"{$startMonth} - {$endMonthName} {$toYear}\";\n\n case self::FREQUENCY_MONTHLY:\n // 'May 2025' - monthly reports are always within the same year\n return $from->format('M Y');\n\n case self::FREQUENCY_WEEKLY:\n // '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ\n $startDay = $from->format('j');\n $endDay = $to->format('j');\n $startMonth = $from->format('M');\n $endMonth = $to->format('M');\n\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n if ($startMonth !== $endMonth) {\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n return \"{$startDay} - {$endDay} {$endMonth} {$toYear}\";\n\n case self::FREQUENCY_ONE_OFF:\n // '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ\n $startDay = $from->format('j');\n $startMonth = $from->format('M');\n $endDay = $to->format('j');\n $endMonth = $to->format('M');\n\n // If same month and year, use a format like '2-31 May 2025'\n if ($startMonth === $endMonth && ! $differentYears) {\n return \"{$startDay} - {$endDay} {$startMonth} {$toYear}\";\n }\n\n // If different years, include both years\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n // Same year but different months\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n\n default:\n // Default format for unknown frequencies\n return $from->format('j M Y') . ' - ' . $to->format('j M Y');\n }\n }\n\n public function getReportTeamsName(AutomatedReportResult $report): string\n {\n $groups = $report->getGroups();\n\n if (empty($groups)) {\n return 'All';\n }\n\n // Get group names from repository\n $groupNames = [];\n foreach ($groups as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group) {\n $groupNames[] = $group->getName();\n }\n }\n\n if (count($groupNames) === 1) {\n // Single team format\n $teamsName = $groupNames[0];\n } else {\n // Multiple teams format\n $teamsName = implode(', ', $groupNames);\n }\n\n return $teamsName;\n }\n\n public function getReportFileName(AutomatedReportResult $report): string\n {\n $customName = $report->getReport()->getCustomName();\n $periodName = $this->getReportPeriodName($report);\n $filenameSuffix = $this->getFilenameSuffix($report);\n\n if ($customName) {\n if ($filenameSuffix) {\n $customName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$customName} - {$periodName}\");\n }\n\n $baseName = $this->getReportTypeName($report);\n\n if ($filenameSuffix) {\n $baseName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}\");\n }\n\n public function getReportFileNameWithExtension(AutomatedReportResult $result): string\n {\n $extension = $this->getMediaTypeMetadata($result)['extension'];\n\n return $this->getReportFileName($result) . '.' . $extension;\n }\n\n public function sanitizeFileName(string $fileName): string\n {\n return str_replace(['/', '\\\\'], '-', $fileName);\n }\n\n public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool\n {\n $recipients = array_map('intval', $report->getRecipients()['users'] ?? []);\n\n return in_array($user->getId(), $recipients);\n }\n\n public function transformReportResults(Collection $automatedReportResults): array\n {\n $data = [];\n foreach ($automatedReportResults as $automatedReportResult) {\n /** @var AutomatedReportResult $automatedReportResult */\n\n $report = $automatedReportResult->getReport();\n\n $createdBy = $report->getCreator();\n $creator = [\n 'id' => $createdBy?->getUuid(),\n 'name' => $createdBy?->getName(),\n 'email' => $createdBy?->getEmailAddress(),\n 'photoUrl' => $createdBy?->getPhotoUrl(),\n ];\n\n $data[] = [\n 'id' => $automatedReportResult->getUuid(),\n 'name' => $automatedReportResult->getName(),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n 'recipients' => $this->buildRecipients($report),\n 'report_type' => $this->transformReportType($report->getType()),\n 'media_type' => $automatedReportResult->getMediaType(),\n 'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),\n 'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),\n 'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),\n 'creator' => $creator,\n ];\n }\n\n return $data;\n }\n\n private function buildRecipients(AutomatedReport $report): array\n {\n $creatorUuid = $report->getCreator()?->getUuid();\n\n $recipients = array_values(array_filter(\n $this->transformRecipients($report->getRecipients()),\n static fn (array $recipient): bool => $recipient['id'] !== $creatorUuid,\n ));\n\n if (! $report->isAskJiminnyReport()) {\n return $recipients;\n }\n\n return [\n ...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),\n ...$recipients,\n ];\n }\n\n public function hasCallTypeConference(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);\n }\n\n public function hasCallTypeDialer(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);\n }\n\n // transformers\n private function transformTeam(Team $team): array\n {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n return [];\n }\n\n return [\n 'id' => $team->getUuid(),\n 'name' => $team->getName(),\n ];\n }\n\n private function transformReportFullView(AutomatedReport $report): array\n {\n $base = $this->transformReportBase($report);\n\n return $report->getType() === self::TYPE_ASK_JIMINNY\n ? $base + $this->transformAskJiminnyFields($report)\n : $base + $this->transformStandardReportFields($report);\n }\n\n private function transformReportBase(AutomatedReport $report): array\n {\n return [\n 'id' => $report->getUuid(),\n 'organization' => $this->transformOrganization(team: $report->getTeam()),\n 'report_type' => $this->transformReportType($report->getType()),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n ];\n }\n\n private function transformStandardReportFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n\n return [\n 'report_enabled' => $report->getStatus(),\n 'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),\n 'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),\n 'deal_value_min' => $report->getDealValueMin(),\n 'deal_value_max' => $report->getDealValueMax(),\n 'call_types' => $this->transformCallType($report->getCallTypes()),\n 'media_types' => $this->transformMediaTypes($report),\n 'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),\n 'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),\n 'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),\n 'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),\n 'recipients' => $this->transformRecipients($report->getRecipients()),\n 'created_by' => $this->transformCreator($report->getCreator()),\n 'additional_prompt_input' => $report->getAdditionalPromptInput(),\n 'custom_name' => $report->getCustomName(),\n 'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),\n 'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),\n 'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),\n ];\n }\n\n private function transformAskJiminnyFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n $creatorId = $report->getAttribute('created_by');\n $explicitUserIds = array_values(array_filter(\n $report->getRecipients()['users'] ?? [],\n static fn ($id) => $id !== $creatorId\n ));\n\n return [\n 'report_name' => $report->getCustomName(),\n 'enabled' => $report->getStatus(),\n 'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),\n 'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),\n 'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),\n 'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),\n ];\n }\n\n private function transformOrganization(?Team $team): array\n {\n return [\n 'id' => $team?->getUuid(),\n 'name' => $team?->getName(),\n ];\n }\n\n private function transformReportType(string $type): array\n {\n foreach (self::ALL_TYPES as $typeItem) {\n if ($typeItem['id'] === $type) {\n return $typeItem;\n }\n }\n\n return [];\n }\n\n private function transformCallType(array $types): array\n {\n $result = [];\n $callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];\n\n foreach ($types as $type) {\n foreach ($callTypes as $callTypeItem) {\n if ($callTypeItem['id'] === $type) {\n $result[] = $callTypeItem;\n\n break;\n }\n }\n }\n\n return $result;\n }\n\n private function transformMediaTypes(AutomatedReport $report): array\n {\n $values = [];\n\n foreach ($report->getMediaTypes() as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n continue;\n }\n\n $values[] = match ($mediaType) {\n self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,\n self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,\n };\n }\n\n return $values;\n }\n\n private function transformFrequency(string $frequency): array\n {\n foreach (self::ALL_FREQUENCIES as $frequencyItem) {\n if ($frequencyItem['id'] === $frequency) {\n return $frequencyItem;\n }\n }\n\n return [];\n }\n\n public function transformDurationToMinutes(?int $duration): ?int\n {\n if (! $duration) {\n return null;\n }\n\n return (int) ($duration / 60);\n }\n\n private function transformGroups(?Team $team, array $groupsIds): array\n {\n if (empty($groupsIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($groupsIds as $groupId) {\n $group = $team->groups()->where('id', $groupId)->first();\n\n if ($group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n 'photoUrl' => $group->getPhotoUrl(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformStages(?Team $team, array $stagesIds): array\n {\n if (empty($stagesIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($stagesIds as $stageId) {\n $stage = $team->stages()->where('id', $stageId)->first();\n\n if ($stage) {\n $data[] = [\n 'id' => $stage->getUuid(),\n 'name' => $stage->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformRecipients(array $recipients): array\n {\n $users = [];\n foreach ($recipients['users'] ?? [] as $userId) {\n $users[] = $this->transformUser($userId);\n }\n\n return $users;\n }\n\n private function transformCreator(?User $user): ?array\n {\n if ($user === null) {\n return null;\n }\n\n return $this->transformUser($user->getId());\n }\n\n private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array\n {\n if ($prompt === null) {\n return null;\n }\n\n return [\n 'id' => $prompt->getUuid(),\n 'name' => $prompt->getTitle(),\n ];\n }\n\n private function transformSafeSearch(?Search $search): ?array\n {\n if ($search === null) {\n return null;\n }\n\n return [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ];\n }\n\n private function transformUser(int $userId): array\n {\n /* @var ?User $user */\n $user = $this->userRepository->find($userId);\n\n return [\n 'id' => $user?->getUuid(),\n 'name' => $user?->getName(),\n 'email' => $user?->getEmailAddress(),\n 'photoUrl' => $user?->getPhotoUrl(),\n ];\n }\n\n public function create(array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $validatedData['created_by'] = auth()->id();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function update(string $uuid, array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $report = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $report) {\n throw new InvalidArgumentException('Report not found');\n }\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Create an Ask Jiminny report.\n */\n public function createAskJiminnyReport(array $data, User $creator): array\n {\n $validatedData = $this->validateAskJiminnyReportData($data, $creator);\n $validatedData['created_by'] = $creator->getId();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Update an Ask Jiminny report.\n */\n public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array\n {\n if (! $report->isAskJiminnyReport()) {\n throw new InvalidArgumentException('Report is not an Ask Jiminny report');\n }\n\n $validatedData = $this->validateAskJiminnyReportData($data, $user);\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array\n {\n $this->automatedReportsRepository->update($report, ['status' => $status]);\n\n return $this->transformReportFullView($report->fresh());\n }\n\n /**\n * Validate and transform data for Ask Jiminny reports.\n */\n private function validateAskJiminnyReportData(array $data, User $user): array\n {\n // Validate name\n $name = trim($data['report_name'] ?? '');\n if (empty($name)) {\n throw new InvalidArgumentException('Report name is required');\n }\n if (mb_strlen($name) > 50) {\n throw new InvalidArgumentException('Report name must be 50 characters or less');\n }\n\n // Validate frequency (only daily, weekly, monthly for Ask Jiminny)\n $frequency = $data['frequency'] ?? null;\n $askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];\n if (! in_array($frequency, $askJiminnyFrequencies, true)) {\n throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');\n }\n\n // Validate expiration date\n $expiresAt = $data['expires_on'] ?? null;\n if (empty($expiresAt)) {\n throw new InvalidArgumentException('Expiration date is required');\n }\n\n try {\n $expiresAtDate = Carbon::parse($expiresAt);\n } catch (InvalidFormatException $e) {\n throw new InvalidArgumentException('Expiration date format is invalid');\n }\n $maxExpiration = Carbon::now()->addYear()->endOfDay();\n if ($expiresAtDate->gt($maxExpiration)) {\n throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');\n }\n if ($expiresAtDate->isPast()) {\n throw new InvalidArgumentException('Expiration date cannot be in the past');\n }\n\n // Validate saved search\n $activitySearchId = $data['saved_search'] ?? null;\n if (empty($activitySearchId)) {\n throw new InvalidArgumentException('Saved search is required');\n }\n $savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);\n if (! $savedSearch) {\n throw new InvalidArgumentException('Saved search not found or does not belong to you');\n }\n\n // Validate saved prompt\n $askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;\n if (empty($askAnythingPromptId)) {\n throw new InvalidArgumentException('Ask Jiminny prompt is required');\n }\n $prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);\n if (! $prompt) {\n throw new InvalidArgumentException('Ask Jiminny prompt not found');\n }\n\n // Validate status\n $status = $data['enabled'] ?? false;\n\n $recipientUserIds = [$user->getId()];\n\n if (! empty($data['share_users'])) {\n $sharedUserIds = $this->validateAndGetUserIdsByTeam(\n $user->team,\n (array) $data['share_users']\n );\n $recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);\n }\n\n $sharedGroupIds = [];\n if (! empty($data['share_teams'])) {\n $sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);\n }\n\n $recipientUserIds = array_values(array_unique($recipientUserIds));\n\n return [\n 'team_id' => $user->getTeamId(),\n 'type' => self::TYPE_ASK_JIMINNY,\n 'status' => (bool) $status,\n 'frequency' => $frequency,\n 'custom_name' => $name,\n 'activity_search_id' => $savedSearch->getId(),\n 'ask_anything_prompt_id' => $prompt->getId(),\n 'expires_at' => $expiresAtDate->toDateString(),\n 'media_types' => [self::MEDIA_TYPE_PDF],\n 'call_types' => [],\n 'recipients' => ['users' => $recipientUserIds],\n 'groups' => $sharedGroupIds,\n ];\n }\n\n public static function getAskJiminnyFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::ASK_JIMINNY_FREQUENCIES);\n }\n\n public function getAskJiminnyReportFilters(User $user): array\n {\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n return [\n [\n 'id' => 'prompt',\n 'label' => 'Prompt',\n 'options' => $prompts,\n ],\n [\n 'id' => 'saved_search',\n 'label' => 'Saved Search',\n 'options' => $savedSearches,\n ],\n ];\n }\n\n public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array\n {\n $team = $user->getTeam();\n $userTimezone = $user->getTimezone();\n\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n $teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ])->values()->all();\n\n $shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];\n\n $sharedTeamsValue = [];\n $sharedUsersValue = [];\n if ($report) {\n $sharedTeamsValue = $this->transformGroups($team, $report->getGroups());\n\n $recipientUserIds = $report->getRecipients()['users'] ?? [];\n $creatorId = $report->getAttribute('created_by');\n $sharedUserIds = array_values(array_filter(\n $recipientUserIds,\n static fn ($id) => $id !== $creatorId\n ));\n $sharedUsersValue = collect($sharedUserIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (User $u) => [\n 'id' => $u->getUuid(),\n 'name' => $u->getName(),\n ])\n ->values()\n ->all();\n }\n\n return [\n 'fields' => [\n [\n 'id' => 'enabled',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'label' => '',\n 'value' => $report?->getStatus() ?? false,\n ],\n [\n 'id' => 'report_name',\n 'inputType' => InputTypeEnum::TEXT,\n 'label' => 'Name',\n 'placeholder' => 'Enter name',\n 'required' => true,\n 'validation' => ['maxLength' => 50],\n 'value' => $report?->getCustomName() ?? '',\n ],\n [\n 'id' => 'frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Frequency',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::ASK_JIMINNY_FREQUENCIES,\n 'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,\n ],\n [\n 'id' => 'expires_on',\n 'inputType' => InputTypeEnum::DATE,\n 'label' => 'Expires on',\n 'required' => true,\n 'placeholder' => 'Select',\n 'validation' => [\n 'minDate' => now($userTimezone)->toDateString(),\n 'maxDate' => now($userTimezone)->addYear()->toDateString(),\n ],\n 'value' => $report?->getExpiresAt()?->toDateString(),\n ],\n [\n 'id' => 'share_teams',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team',\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $teamGroups,\n 'value' => $sharedTeamsValue,\n ],\n [\n 'id' => 'share_users',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team member',\n 'required' => false,\n 'placeholder' => 'Select',\n 'groupLabelKey' => 'label',\n 'groupValuesKey' => 'users',\n 'optionLabelKey' => 'name',\n 'optionValueKey' => 'id',\n 'options' => $shareUsers,\n 'value' => $sharedUsersValue,\n ],\n [\n 'id' => 'saved_search',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Saved search',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $savedSearches,\n 'value' => $report && $report->getSavedSearch() ? [\n 'id' => $report->getSavedSearch()->getUuid(),\n 'name' => $report->getSavedSearch()->getName(),\n ] : null,\n ],\n [\n 'id' => 'ask_jiminny_prompt',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Ask Jiminny prompt',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $prompts,\n 'value' => $report && $report->getAskAnythingPrompt() ? [\n 'id' => $report->getAskAnythingPrompt()->getUuid(),\n 'name' => $report->getAskAnythingPrompt()->getTitle(),\n ] : null,\n ],\n ],\n ];\n }\n\n private function updateResultNames(AutomatedReport $automatedReport): void\n {\n $results = $this->automatedReportsRepository->getResultsByReport($automatedReport);\n\n foreach ($results as $result) {\n $result->update(['name' => $this->getReportFileName($result)]);\n }\n }\n\n public function updateStatus(string $uuid, array $data): array\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $automatedReport->update([\n 'status' => $status,\n ]);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n private function generateOneOffReport(AutomatedReport $automatedReport): void\n {\n // the scheduler handles all the other frequency types\n if ($automatedReport->getStatus() === false || $automatedReport->getFrequency() !== self::FREQUENCY_ONE_OFF) {\n return;\n }\n\n $this->dispatcher->dispatch(new RequestGenerateReportJob($automatedReport->getUuid()));\n }\n\n public function getReport(string $uuid): AutomatedReport\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n return $automatedReport;\n }\n\n public function get(string $uuid): array\n {\n $automatedReport = $this->getReport($uuid);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function list(string $sortColumn = 'created_at', string $sortDirection = 'desc'): array\n {\n $results = [];\n $collection = $this->automatedReportsRepository->getAllStandardReports($sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function listAskJiminnyReports(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): array {\n $results = [];\n $collection = $this->automatedReportsRepository->getAskJiminnyReportsByUser($user, $sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function delete(string $uuid): void\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $automatedReport->delete();\n }\n\n public function createReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n return $this->automatedReportsRepository->createResult(\n array_merge(\n [\n 'report_id' => $automatedReport->getId(),\n 'status' => AutomatedReportResult::STATUS_DEFAULT,\n ],\n $data\n )\n );\n }\n\n public function getOrCreateReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n $existing = $this->automatedReportsRepository->findLatestDefaultOrFailedResult($automatedReport);\n\n if ($existing !== null) {\n $existing->update(['status' => AutomatedReportResult::STATUS_DEFAULT]);\n\n return $existing;\n }\n\n return $this->createReportResult($automatedReport, $data);\n }\n\n public function getReportResult(string $resultUuid): AutomatedReportResult\n {\n $report = $this->automatedReportsRepository->findResultByUuid($resultUuid);\n\n if (! $report) {\n throw new ModelNotFoundException('Report Result not found');\n }\n\n return $report;\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return $this->automatedReportsRepository->findChildResult($result, $type);\n }\n\n // prophet API calls\n /**\n * @throws ApplicationException\n */\n public function getGenerateReportPayload(AutomatedReport $automatedReport, string $reportResultUuid): array\n {\n $period = $this->calculateFromAndToDate($automatedReport);\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n return [\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResultUuid,\n 'report_type' => $automatedReport->getType(),\n 'media_types' => $automatedReport->getMediaTypes(),\n 'from_date' => $fromDate->startOfDay()->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->endOfDay()->format(DateTimeInterface::RFC3339),\n 'group_ids' => $automatedReport->getGroups(),\n 'call_deal_stage' => $automatedReport->getDealAtCallStages(),\n 'current_deal_stage' => $automatedReport->getCurrentDealStages(),\n 'deal_min_value' => $automatedReport->getDealValueMin(),\n 'deal_max_value' => $automatedReport->getDealValueMax(),\n 'call_types' => $automatedReport->getCallTypes(),\n 'call_duration_min_seconds' => $automatedReport->getCallDurationMin(),\n 'call_duration_max_seconds' => $automatedReport->getCallDurationMax(),\n 'special_requirements' => $automatedReport->getAdditionalPromptInput(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->formatReportPeriodName(\n $automatedReport->getFrequency(),\n $fromDate,\n $toDate,\n ),\n 'playbook_categories' => $automatedReport->getPlaybookCategories(),\n 'custom_name' => $automatedReport->getCustomName(),\n ];\n }\n\n // $inputPayload - FE payload structure\n public function getActivitiesCountPayload(array $inputPayload): array\n {\n // Use validateAndTransformData to validate and normalize input\n $validatedData = $this->validateAndTransformData($inputPayload);\n $period = $this->calculateFromAndToDatePeriod(\n $validatedData['frequency'],\n Carbon::parse($validatedData['from']),\n Carbon::parse($validatedData['to']),\n );\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n // Create payload similar to getGenerateReportPayload\n return [\n 'team_id' => $validatedData['team_id'],\n 'group_ids' => $validatedData['groups'] ?? [],\n 'report_type' => $validatedData['type'],\n 'from_date' => $fromDate->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->format(DateTimeInterface::RFC3339),\n 'call_deal_stage' => $validatedData['deal_at_call_stages'] ?? [],\n 'current_deal_stage' => $validatedData['current_deal_stages'] ?? [],\n 'deal_min_value' => $validatedData['deal_value_min'] ?? null,\n 'deal_max_value' => $validatedData['deal_value_max'] ?? null,\n 'call_types' => $validatedData['call_types'],\n 'call_duration_min_seconds' => $validatedData['call_duration_min'] ?? null,\n 'call_duration_max_seconds' => $validatedData['call_duration_max'] ?? null,\n 'special_requirements' => $validatedData['additional_prompt_input'] ?? null,\n 'playbook_categories' => $validatedData['playbook_categories'] ?? [],\n 'request_id' => null,\n 'callback_url' => null,\n ];\n }\n\n public function shouldSendReport(array $users, ?CarbonInterface $generatedAt = null): bool\n {\n if (empty($users)) {\n return false;\n }\n\n $earliestTz = collect($users)\n ->mapWithKeys(function (array $user) {\n $tz = new DateTimeZone($user['timezone']);\n $nowUtc = new DateTime('now', new DateTimeZone('UTC'));\n $offset = $tz->getOffset($nowUtc);\n\n return [$user['timezone'] => $offset];\n })\n ->sortDesc()\n ->keys()\n ->first();\n\n $now = Carbon::now($earliestTz);\n $isScheduledTime = (int) $now->format('H') === self::SENT_REPORT_AT_HOURS;\n\n if ($isScheduledTime) {\n return true;\n }\n\n return $this->hasPassedScheduledTime($generatedAt, $earliestTz);\n }\n\n public function hasPassedScheduledTime(?CarbonInterface $generatedAt, string $timezone): bool\n {\n if ($generatedAt === null) {\n return false;\n }\n\n $now = Carbon::now($timezone);\n $scheduledTime = $now->copy()->setTime(self::SENT_REPORT_AT_HOURS, 0, 0);\n\n if ($now->hour < self::SENT_REPORT_AT_HOURS) {\n $scheduledTime = $scheduledTime->subDay();\n }\n\n $scheduledTimeUtc = $scheduledTime->copy()->utc();\n $generatedAtUtc = $generatedAt->copy()->utc();\n $nowUtc = $now->copy()->utc();\n\n return $generatedAtUtc->lt($scheduledTimeUtc) && $nowUtc->gt($scheduledTimeUtc);\n }\n\n public function calculateFromAndToDatePeriod(\n string $frequency,\n ?Carbon $fromDate = null,\n ?Carbon $toDate = null\n ): array {\n if ($frequency === self::FREQUENCY_ONE_OFF) {\n return [\n 'fromDate' => $fromDate,\n 'toDate' => $toDate,\n ];\n }\n\n $now = Carbon::now();\n\n return match ($frequency) {\n self::FREQUENCY_DAILY => [\n 'fromDate' => $now->copy()->subDay()->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_WEEKLY => [\n 'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_MONTHLY => [\n 'fromDate' => $now->copy()->subMonths(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_QUARTERLY => [\n 'fromDate' => $now->copy()->subMonths(3)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n default => throw new InvalidArgumentException(\"Unsupported frequency: {$frequency}\"),\n };\n }\n\n private function calculateFromAndToDate(AutomatedReport $automatedReport): array\n {\n return $this->calculateFromAndToDatePeriod(\n $automatedReport->getFrequency(),\n $automatedReport->getFrom(),\n $automatedReport->getTo()\n );\n }\n\n public function getAskJiminnyGenerateReportPayload(\n AutomatedReport $automatedReport,\n AutomatedReportResult $reportResult,\n array $activityIds,\n ): array {\n return [\n 'user_question' => $automatedReport->getAskAnythingPrompt()?->getContent(),\n 'call_ids' => array_map('strval', $activityIds),\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResult->getUuid(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->getReportPeriodName($reportResult),\n 'report_name' => $automatedReport->getCustomName(),\n ];\n }\n\n private function getCallbackUrl(): string\n {\n return $this->webhookService->route('jiminny.webhook.reports.ready');\n }\n\n /**\n * Validate and transform payload data for automated reports\n *\n * @param array $data\n *\n * @throws InvalidArgumentException\n *\n * @return array\n */\n private function validateAndTransformData(array $data): array\n {\n // Validate organization (team) and check feature\n $team = $this->validateOrganization($data['organization'] ?? null);\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $type = $this->validateReportType($data['report_type'] ?? null);\n $frequency = $this->validateFrequency($data['frequency'] ?? null);\n $additionalPromptInput = $this->validateAdditionalPromptInput(\n $data['additional_prompt_input'] ?? null\n );\n $customReportName = $this->validateCustomReportName($data['custom_name'] ?? null);\n\n // Prepare data for the database\n $reportData = [\n 'team_id' => $team->getId(),\n 'type' => $type,\n 'status' => $status,\n 'frequency' => $frequency,\n 'additional_prompt_input' => $additionalPromptInput,\n 'custom_name' => $customReportName,\n ];\n\n // Validate deal values\n $reportData = $this->validateDealValues($data, $reportData);\n\n // Validate date range\n $reportData = $this->validateDateRange($data, $reportData, $frequency);\n\n // Validate call durations\n $reportData = $this->validateCallDurations($data, $reportData);\n\n // Validate call types\n $reportData = $this->validateCallTypes($data, $reportData);\n\n // Validate media types\n $reportData = $this->validateMediaTypes($data, $reportData);\n\n // Validate groups\n if (isset($data['teams'])) {\n $reportData['groups'] = $this->validateAndGetGroupIds($team, $data['teams']);\n }\n\n // Validate deal stages\n $reportData = $this->validateDealStages($data, $reportData, $team, $type);\n\n // Validate playbook categories\n $reportData = $this->validatePlaybookCategories($data, $reportData, $team);\n\n // Validate recipients\n $reportData['recipients'] = [\n 'users' => $this->validateAndGetUserIdsByTeam($team, $data['recipients'] ?? []),\n ];\n\n if (isset($data['jiminny_recipients'])) {\n // Validate Jiminny recipients\n $reportData['jiminny_recipients'] = [\n 'users' => $this->validateAndGetJiminnyUserIds((array) $data['jiminny_recipients']),\n ];\n }\n\n return $reportData;\n }\n\n private function validateDealValues(array $data, array $reportData): array\n {\n if (isset($data['min_deal_value'])) {\n $reportData['deal_value_min'] = (int) $data['min_deal_value'];\n\n if ($reportData['deal_value_min'] > 4294967295 || $reportData['deal_value_min'] < 0) {\n throw new InvalidArgumentException('Min deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_deal_value'])) {\n $reportData['deal_value_max'] = (int) $data['max_deal_value'];\n\n if ($reportData['deal_value_max'] > 4294967295 || $reportData['deal_value_max'] < 0) {\n throw new InvalidArgumentException('Max deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['min_deal_value'], $data['max_deal_value'])\n && $data['min_deal_value'] > $data['max_deal_value']\n ) {\n throw new InvalidArgumentException('Min deal value cannot be greater than max deal value');\n }\n\n return $reportData;\n }\n\n private function validateDateRange(array $data, array $reportData, string $frequency): array\n {\n // Set date range only for one_off frequency\n if ($frequency === 'one_off') {\n if (isset($data['start_date_period'])) {\n $reportData['from'] = $this->parseDate($data['start_date_period']);\n }\n\n if (isset($data['end_date_period'])) {\n $reportData['to'] = $this->parseDate($data['end_date_period']);\n }\n\n if (empty($reportData['from']) || empty($reportData['to'])) {\n throw new InvalidArgumentException(\n 'Start date and end date are required for one_off frequency'\n );\n }\n } else {\n $reportData['from'] = null;\n $reportData['to'] = null;\n }\n\n return $reportData;\n }\n\n private function validateCallDurations(array $data, array $reportData): array\n {\n // Convert call durations from minutes to seconds\n if (isset($data['min_call_duration'])) {\n $reportData['call_duration_min'] = (int) $data['min_call_duration'] * 60;\n\n if ($reportData['call_duration_min'] > 4294967295 || $reportData['call_duration_min'] < 0) {\n throw new InvalidArgumentException('Min call duration should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_call_duration'])) {\n $reportData['call_duration_max'] = (int) $data['max_call_duration'] * 60;\n\n if ($reportData['call_duration_max'] > 4294967295 || $reportData['call_duration_max'] < 0) {\n throw new InvalidArgumentException('Max call duration should be between 0 and 4294967295');\n }\n }\n\n return $reportData;\n }\n\n private function validateCallTypes(array $data, array $reportData): array\n {\n // Set call types\n $reportData['call_types'] = $data['call_type'] ?? [];\n if (empty($reportData['call_types'])) {\n $reportData['call_types'] = self::getCallTypes();\n }\n\n foreach ($reportData['call_types'] as $callType) {\n if (! in_array($callType, self::getCallTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Call type %s is invalid', $callType));\n }\n }\n\n return $reportData;\n }\n\n private function validateMediaTypes(array $data, array $reportData): array\n {\n // Set media types from input data\n $reportData['media_types'] = $data['media_types'] ?? [];\n\n if (empty($reportData['media_types'])) {\n throw new InvalidArgumentException('Media types are required');\n }\n\n foreach ($reportData['media_types'] as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n throw new InvalidArgumentException(sprintf('Media type %s is invalid', $mediaType));\n }\n }\n\n return $reportData;\n }\n\n private function validateDealStages(array $data, array $reportData, Team $team, string $reportType): array\n {\n // Validate and set deal stages\n if (isset($data['deal_stage_at_call'])) {\n $reportData['deal_at_call_stages'] =\n $this->validateAndGetDealStageIds($team, $data['deal_stage_at_call'], 'Deal stage at call');\n }\n\n if (isset($data['current_deal_stage'])) {\n $reportData['current_deal_stages'] =\n $this->validateAndGetDealStageIds($team, $data['current_deal_stage'], 'Current deal stage');\n }\n\n // Ensure current_deal_stage is not provided for loss_analysis report type\n if ($reportType === self::TYPE_LOSS_ANALYSIS && ! empty($data['current_deal_stage'])) {\n throw new InvalidArgumentException('Current deal stage is not applicable for Loss Analysis reports');\n }\n\n return $reportData;\n }\n\n // transform uuid to id\n private function validatePlaybookCategories(array $data, array $reportData, Team $team): array\n {\n $key = 'playbook_categories';\n\n if (isset($data[$key])) {\n $payloadIds = $data[$key];\n $ids = [];\n\n foreach ($payloadIds as $uuid) {\n $uuid = (string) $uuid;\n\n try {\n $playbookCategory = $this->playbookCategoryRepository->findByUuid($uuid);\n } catch (Throwable $throwable) {\n Log::error(__METHOD__ . ' ' . $throwable->getMessage());\n\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory) {\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory->hasPlaybook()) {\n throw new InvalidArgumentException(sprintf('Playbook category %s has no playbook', $uuid));\n }\n\n if ($playbookCategory->getPlaybook()->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Playbook category %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $ids[] = $playbookCategory->getId();\n }\n\n $reportData[$key] = $ids;\n }\n\n return $reportData;\n }\n\n private function validateReportStatus($status): bool\n {\n if (! in_array($status, [true, false], true)) {\n throw new InvalidArgumentException('Report status is invalid');\n }\n\n return $status;\n }\n\n private function validateReportType($type): string\n {\n if (! in_array($type, self::getTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Report type is invalid: %s', $type));\n }\n\n return $type;\n }\n\n private function validateFrequency($frequency): string\n {\n if (! in_array($frequency, self::getFrequencies(), true)) {\n throw new InvalidArgumentException('Frequency is invalid');\n }\n\n return $frequency;\n }\n\n private function validateAdditionalPromptInput(?string $additionalPromptInput): ?string\n {\n if ($additionalPromptInput && strlen($additionalPromptInput) > 5000) {\n throw new InvalidArgumentException('Additional Prompt Input should be less than 5000 characters');\n }\n\n return $additionalPromptInput;\n }\n\n private function validateCustomReportName(?string $customReportName): ?string\n {\n if ($customReportName === null || $customReportName === '') {\n return null;\n }\n\n if (strlen($customReportName) > 70) {\n throw new InvalidArgumentException('Custom report name should be less than 70 characters');\n }\n\n return $customReportName;\n }\n\n private function validateOrganization(?string $organizationUuid): Team\n {\n if (! $organizationUuid) {\n throw new InvalidArgumentException('Organization is required');\n }\n\n $team = $this->teamRepository->idOrUuid($organizationUuid);\n\n if (! $team) {\n throw new InvalidArgumentException('Organization not found');\n }\n\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n throw new InvalidArgumentException('Organization does not have the Automated Reports feature');\n }\n\n return $team;\n }\n\n private function validateAndGetGroupIds(Team $team, array $teamUuids): array\n {\n $groupIds = [];\n\n foreach ($teamUuids as $uuid) {\n $group = $this->groupRepository->findByUuid($uuid);\n\n if ($group === null || $group->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Group %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $groupIds[] = $group->getId();\n\n }\n\n return $groupIds;\n }\n\n private function validateAndGetDealStageIds(Team $team, array $stageUuids, string $propertyLabel): array\n {\n $stageIds = [];\n\n foreach ($stageUuids as $uuid) {\n $stage = $this->stageRepository->findByUuid($uuid);\n\n if ($stage === null || $stage->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Stage %s not found for team %s for %s', $uuid, $team->getUuid(), $propertyLabel)\n );\n }\n\n $stageIds[] = $stage->getId();\n }\n\n return $stageIds;\n }\n\n private function validateAndGetUserIds(array $userUuids, callable $teamCheck): array\n {\n if (empty($userUuids)) {\n return [];\n }\n\n $userIds = [];\n\n foreach ($userUuids as $uuid) {\n $user = $this->userRepository->findByUuid($uuid);\n\n if (! $user || ! $user->isStatusActive()) {\n throw new InvalidArgumentException(\n sprintf('User %s not found or is not active', $uuid)\n );\n }\n\n if (! $teamCheck($user)) {\n throw new InvalidArgumentException(\n sprintf('User %s does not belong to the allowed team(s)', $uuid)\n );\n }\n\n $userIds[] = $user->getId();\n }\n\n return $userIds;\n }\n\n private function validateAndGetUserIdsByTeam(Team $team, array $userUuids): array\n {\n return $this->validateAndGetUserIds($userUuids, fn ($user) => $user->getTeamId() === $team->getId());\n }\n\n private function validateAndGetJiminnyUserIds(array $userUuids): array\n {\n $allowedTeamIds = config('kiosk.teamIds', []);\n\n return $this->validateAndGetUserIds($userUuids, fn ($user) => in_array($user->getTeamId(), $allowedTeamIds, true));\n }\n\n private function parseDate(string $dateString): string\n {\n return date('Y-m-d H:i:s', strtotime($dateString));\n }\n\n private function generateReportResultViewUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.view', ['uuid' => $result->getUuid()]);\n }\n\n private function generateReportResultDownloadUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.download', ['uuid' => $result->getUuid()]);\n }\n\n private function getReportMediaRouteResource(AutomatedReportResult $result): string\n {\n if ($result->getMediaType() === self::MEDIA_TYPE_PDF) {\n return self::PDF_KEY;\n } elseif ($result->getMediaType() === self::MEDIA_TYPE_PODCAST) {\n return self::AUDIO_KEY;\n }\n\n throw new \\InvalidArgumentException('Unknown media type.');\n }\n\n public function getMediaPath(AutomatedReportResult $result): ?string\n {\n $url = match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => $result->getPdfUrl(),\n self::MEDIA_TYPE_PODCAST => $result->getPodcastAudioUrl(),\n default => null,\n };\n\n if ($url === null) {\n return null;\n }\n\n $path = parse_url(trim($url, '\"\\''), PHP_URL_PATH);\n\n return $path ?: null;\n }\n\n public function getFilenameSuffix(AutomatedReportResult $result): ?string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => 'Podcast',\n default => null,\n };\n }\n\n public function getMailSubjectSuffix(AutomatedReportResult $result): string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => 'report',\n self::MEDIA_TYPE_PODCAST => 'podcast',\n default => '',\n };\n }\n\n public function getMediaTypeMetadata(AutomatedReportResult $result): array\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => ['extension' => 'mp3', 'mime' => 'audio/mpeg'],\n self::MEDIA_TYPE_PDF => ['extension' => 'pdf', 'mime' => 'application/pdf'],\n default => ['extension' => null, 'mime' => null],\n };\n }\n\n public function deleteS3Files(AutomatedReportResult $result): void\n {\n $teamUuid = $result->getReport()->getTeam()->getUuid();\n $reportUuid = $result->getUuid();\n\n // delete all files for a report uuid no mather of pdf, podcast, or both\n // in case of both - the podcast files are linked to the pdf (parent) uuid\n // pdf and podcast date times should be close\n $path = sprintf('%s/%s/%s', $teamUuid, self::S3_DIR, $reportUuid);\n\n foreach (self::FILE_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted S3 file', [\n 'path' => $file,\n ]);\n }\n }\n\n foreach (self::FILE_PODCAST_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '_podcast.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted Podcast S3 file', [\n 'path' => $file,\n ]);\n }\n }\n }\n\n /**\n *\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): Collection\n {\n return $this->automatedReportsRepository->getTeamIdsWithReportsResults($teamId);\n }\n\n /**\n * Core delete logic for report results using a query\n *\n * @param Builder $query\n * @param array $logContext\n *\n * @return int\n */\n private function deleteReportResultsByQuery(Builder $query, array $logContext = []): int\n {\n $deletedCount = 0;\n\n if ($query->exists()) {\n Log::info(\n 'Run delete report results',\n array_merge(\n $logContext,\n [\n 'service' => 'AutomatedReportsService',\n ]\n )\n );\n\n $query->chunkById(50, function ($results) use (&$deletedCount, $logContext) {\n foreach ($results as $result) {\n $this->deleteReportResult($result);\n $deletedCount++;\n\n Log::info(\n 'Deleted a report result',\n array_merge(\n $logContext,\n [\n 'result_id' => $result->getId(),\n 'report_id' => $result->getReportId(),\n ]\n )\n );\n }\n });\n }\n\n return $deletedCount;\n }\n\n /**\n * Delete report results for a team by retention period\n *\n * @param Team $team\n * @param CarbonImmutable $retentionDate\n *\n * @return int Number of deleted report results\n */\n public function deleteReportsResultsInRetentionPeriod(Team $team, CarbonImmutable $retentionDate): int\n {\n $reportIds = $this->automatedReportsRepository->getReportIdsByTeam($team);\n\n if ($reportIds->isEmpty()) {\n return 0;\n }\n\n $query = $this->automatedReportsRepository\n ->getReportResultsQueryForRetention($team, $retentionDate);\n\n return $this->deleteReportResultsByQuery($query, [\n 'team_id' => $team->getId(),\n 'retention_date' => $retentionDate->toDateTimeString(),\n ]);\n }\n\n /**\n * Delete ALL report results for a specific automated report\n *\n * @param string $uuid\n *\n * @return int\n */\n public function deleteReportResults(string $uuid): int\n {\n $report = $this->getReport($uuid);\n\n $query = $this->automatedReportsRepository->getResultsByReportQuery($report);\n\n return $this->deleteReportResultsByQuery($query, [\n 'report_uuid' => $uuid,\n 'report_id' => $report->getId(),\n ]);\n }\n\n public function deleteReportResult(AutomatedReportResult $result): void\n {\n $this->deleteS3Files($result);\n\n $result->delete();\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getTeamReports(Team $team): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getReportsByTeam($team);\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getReportResults(AutomatedReport $report): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getResultsByReport($report);\n }\n\n public function deleteAllReportResults(AutomatedReport $report): void\n {\n $results = $this->getReportResults($report);\n\n /** @var AutomatedReportResult $result */\n foreach ($results as $result) {\n Log::info('Deleting result', [\n 'report' => $report->getId(),\n 'result' => $result->getId(),\n ]);\n\n $this->deleteReportResult($result);\n }\n }\n\n public function deleteAllData(Team $team): void\n {\n Log::info('Deleting automated report and results for team', [\n 'team' => $team->getId(),\n ]);\n\n $reports = $this->getTeamReports($team);\n\n /** @var AutomatedReport $report */\n foreach ($reports as $report) {\n Log::info('Deleting report', [\n 'team' => $team->getId(),\n 'report' => $report->getId(),\n ]);\n\n $this->deleteAllReportResults($report);\n\n $report->delete();\n }\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"bounds":{"left":0.50166225,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"bounds":{"left":0.5103058,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"bounds":{"left":0.5212766,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"bounds":{"left":0.5299202,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"bounds":{"left":0.53856385,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"bounds":{"left":0.54953456,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"bounds":{"left":0.56050533,"top":0.14844373,"width":0.024268618,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"bounds":{"left":0.58710104,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"bounds":{"left":0.5980718,"top":0.14844373,"width":0.029587766,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"bounds":{"left":0.6599069,"top":0.14844373,"width":0.02825798,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"18","depth":4,"bounds":{"left":0.63231385,"top":0.17318435,"width":0.009640957,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"14","depth":4,"bounds":{"left":0.64394945,"top":0.17318435,"width":0.009640957,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"2","depth":4,"bounds":{"left":0.6555851,"top":0.17318435,"width":0.007978723,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"4","depth":4,"bounds":{"left":0.6655585,"top":0.17318435,"width":0.007978723,"height":0.015163607},"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.67519945,"top":0.17158818,"width":0.00731383,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.6825133,"top":0.17158818,"width":0.006981383,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o\nJOIN activities a ON o.id = a.opportunity_id\nWHERE a.crm_configuration_id = 39\nAND a.actual_start_time > '2025-10-13'\nAND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM activities\nWHERE crm_configuration_id = 39 and user_id = 143\nand actual_start_time >= '2025-10-13'\nAND type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM opportunities WHERE account_id IN (178);\nselect * from activities where id IN (620137, 620187, 620188, 620189, 620230);\n\n# HS\nSELECT * FROM opportunities WHERE id IN (238);\nselect * from activities where id IN (477,2076);\n\nselect * from users;\n\nSELECT COUNT(*) FROM users;\nSELECT COUNT(*) FROM activities;\nSELECT COUNT(*) FROM opportunities;\n\nUPDATE activities\nSET\n actual_start_time = '2025-12-19 09:00:00',\n actual_end_time = '2025-12-19 10:30:00',\n scheduled_start_time = '2025-12-19 09:00:00',\n scheduled_end_time = '2025-12-19 10:30:00'\nWHERE id IN (407509,407375);\n\nselect * from partners;\n\nSELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id\nFROM activities\nWHERE user_id = 143\nAND actual_start_time >= '2025-10-13 00:00:00'\nAND actual_start_time <= '2026-01-13 23:59:59'\nORDER BY actual_start_time DESC;\n\nSELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;\nSELECT * FROM crm_layouts where crm_configuration_id = 39;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;\n# lead_id\n# account_id 177\n# contact_id 3969\n# opportunity_id\n# stage_id 203\n\nSELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;\n\nSELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'\nAND user_id = 143 and actual_start_time >= '2025-10-13';\n\nSELECT * FROM activities a\n# JOIN opportunities o ON a.opportunity_id = o.id\nWHERE a.crm_configuration_id = 39 AND a.type = 'conference'\nand status = 'completed' and recording_state = 'recorded'\nand a.actual_start_time >= '2025-10-13'\nAND a.user_id = 143\n;\n\nselect * from leads\nwhere crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707\n\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310);\nSELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198\nSELECT * FROM activities WHERE id IN (356001, 356008); # contacts:\n\nSELECT * FROM opportunities WHERE id IN (1707);\nSELECT * FROM stages where id IN (204, 198);\nSELECT * FROM opportunities WHERE account_id IN (178);\nSELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';\nSELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal\n\nSELECT * FROM activities where crm_configuration_id = 39\nAND opportunity_id IS NULL\nAND is_internal = false\nand status = 'completed' and recording_state = 'recorded'\nAND actual_start_time >= '2025-10-13'\nAND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)\n# AND lead_id IN (112, 109)\n;\n\nSELECT * FROM crm_profiles WHERE user_id = 143;\n\nselect * from inboxes; # 212\nselect * from users where id = 143; # 143\nselect * from inbox_email_batches where inbox_id = 212\nand updated_at >= '2026-01-28 00:00:00' order by id desc;\nselect * from inbox_emails where inbox_id = 212\nand batch_id = 95885 order by id desc;\nselect * from email_messages where origin_user_id = 143;\nselect * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';\nselect * from participants where activity_id = 620247;\n\nselect * from crm_profiles where user_id = 143;\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001\nselect * from transcription where activity_id = 356001; # 6943\nselect * from ai_prompts where transcription_id = 6943;\nSELECT * FROM activity_summary_logs where activity_id = 356001;\n\nSELECT * FROM social_accounts WHERE sociable_id = 143;\n\n# ************************************************************************************\nSELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;\n# 422515 softphone tr. 8100\n\nSELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;\n# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS\n\nselect * from ai_prompts where transcription_id IN (8100, 7670);\nselect * from activity_summary_logs where activity_id = 407509;\n\nselect * from sidekick_settings;\nselect * from default_activity_types;\n\nSELECT * FROM contacts WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\nSELECT * FROM leads WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\n\nSELECT * FROM activity_searches where user_id = 143;\nSELECT * FROM groups where team_id = 1;\n\nselect * from teams where id = 1;\nselect * from groups where team_id = 1; # 1150 - 7e75f8025c22\nselect id, name, group_id, status, deleted_at, email\nfrom users where team_id = 1 order by group_id desc ;\n\nselect * from activity_searches where id in (1977, 1978, 1979);\nselect * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);\nselect * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277\nselect * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879\n\nINSERT INTO `activity_search_filters`\n(`activity_search_id`, `filter`, `value`) VALUES\n(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')\n;\n\nselect * from crm_configurations where id = 39;\n\n\nselect sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id\nwhere u.team_id = 1;\nSELECT * FROM social_accounts WHERE sociable_id = 1635;\nSELECT * FROM users WHERE id = 1635;\n\nselect * from teams where id = 1;\nselect * from users where team_id = 1;\nselect * from team_features where team_id = 1;\nselect * from features;\n\nSELECT * FROM activity_searches where id = 1982; # 1981\nSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;\n\nSELECT * FROM automated_reports where id = 68;\nUPDATE automated_reports set playbook_categories = NULL where id = 68;\nSELECT * FROM automated_report_results where id = 275;\n\nSELECT * FROM automated_reports order by id desc;\nSELECT * FROM automated_report_results order by id desc;\nselect * from activity_searches where user_id = 143;\nselect * from ask_anything_prompts;\n\nSELECT * FROM groups WHERE id = 1439;\nSELECT * FROM users WHERE group_id = 1439;\n\nselect * from permissions; # 158\nselect * from roles;\nselect * from permission_role\n\nselect * from teams where id = 1;\nselect * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;\nselect * from groups where id = 28;\nselect * from playbooks where team_id = 1;\nselect * from playbooks where id = 179;\nselect * from playbook_categories where id = 1391;\nselect * from users where id = 143;\nselect * from crm_profiles where user_id = 143;\nselect * from activities where crm_configuration_id = 39 and type = 'conference'\nand crm_provider_id IS NOT NULL ORDER by id desc;\nselect * from activities where id = 422003; # 00UO400000pB6fpMAC\n\nSELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type\nFROM automated_report_results ar\nJOIN automated_reports a ON a.id = ar.report_id\nWHERE a.type = 'ask_jiminny'\nLIMIT 10;\n\nSELECT `automated_report_results`.* FROM `automated_report_results`\nINNER JOIN `automated_reports`\n ON `automated_report_results`.`report_id` = `automated_reports`.`id`\nWHERE `automated_report_results`.`generated_at` IS NOT NULL\n AND `automated_reports`.`team_id` = 1\n AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$.\"users\"')\n;\n\n\nselect * from teams where id = 3143;\nselect * from crm_configurations where id = 500;\nselect * from users where name = 'Integration Account'; # 1695\nSELECT * FROM social_accounts WHERE sociable_id = 1695;\n\nselect * from activities where crm_configuration_id = 39\nand recording_state = 'recorded' and duration > 60\nand status = 'completed' and actual_start_time >= '2025-12-01';\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;\n\nselect * from leads;","depth":4,"value":"SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o\nJOIN activities a ON o.id = a.opportunity_id\nWHERE a.crm_configuration_id = 39\nAND a.actual_start_time > '2025-10-13'\nAND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM activities\nWHERE crm_configuration_id = 39 and user_id = 143\nand actual_start_time >= '2025-10-13'\nAND type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM opportunities WHERE account_id IN (178);\nselect * from activities where id IN (620137, 620187, 620188, 620189, 620230);\n\n# HS\nSELECT * FROM opportunities WHERE id IN (238);\nselect * from activities where id IN (477,2076);\n\nselect * from users;\n\nSELECT COUNT(*) FROM users;\nSELECT COUNT(*) FROM activities;\nSELECT COUNT(*) FROM opportunities;\n\nUPDATE activities\nSET\n actual_start_time = '2025-12-19 09:00:00',\n actual_end_time = '2025-12-19 10:30:00',\n scheduled_start_time = '2025-12-19 09:00:00',\n scheduled_end_time = '2025-12-19 10:30:00'\nWHERE id IN (407509,407375);\n\nselect * from partners;\n\nSELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id\nFROM activities\nWHERE user_id = 143\nAND actual_start_time >= '2025-10-13 00:00:00'\nAND actual_start_time <= '2026-01-13 23:59:59'\nORDER BY actual_start_time DESC;\n\nSELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;\nSELECT * FROM crm_layouts where crm_configuration_id = 39;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;\n# lead_id\n# account_id 177\n# contact_id 3969\n# opportunity_id\n# stage_id 203\n\nSELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;\n\nSELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'\nAND user_id = 143 and actual_start_time >= '2025-10-13';\n\nSELECT * FROM activities a\n# JOIN opportunities o ON a.opportunity_id = o.id\nWHERE a.crm_configuration_id = 39 AND a.type = 'conference'\nand status = 'completed' and recording_state = 'recorded'\nand a.actual_start_time >= '2025-10-13'\nAND a.user_id = 143\n;\n\nselect * from leads\nwhere crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707\n\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310);\nSELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198\nSELECT * FROM activities WHERE id IN (356001, 356008); # contacts:\n\nSELECT * FROM opportunities WHERE id IN (1707);\nSELECT * FROM stages where id IN (204, 198);\nSELECT * FROM opportunities WHERE account_id IN (178);\nSELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';\nSELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal\n\nSELECT * FROM activities where crm_configuration_id = 39\nAND opportunity_id IS NULL\nAND is_internal = false\nand status = 'completed' and recording_state = 'recorded'\nAND actual_start_time >= '2025-10-13'\nAND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)\n# AND lead_id IN (112, 109)\n;\n\nSELECT * FROM crm_profiles WHERE user_id = 143;\n\nselect * from inboxes; # 212\nselect * from users where id = 143; # 143\nselect * from inbox_email_batches where inbox_id = 212\nand updated_at >= '2026-01-28 00:00:00' order by id desc;\nselect * from inbox_emails where inbox_id = 212\nand batch_id = 95885 order by id desc;\nselect * from email_messages where origin_user_id = 143;\nselect * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';\nselect * from participants where activity_id = 620247;\n\nselect * from crm_profiles where user_id = 143;\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001\nselect * from transcription where activity_id = 356001; # 6943\nselect * from ai_prompts where transcription_id = 6943;\nSELECT * FROM activity_summary_logs where activity_id = 356001;\n\nSELECT * FROM social_accounts WHERE sociable_id = 143;\n\n# ************************************************************************************\nSELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;\n# 422515 softphone tr. 8100\n\nSELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;\n# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS\n\nselect * from ai_prompts where transcription_id IN (8100, 7670);\nselect * from activity_summary_logs where activity_id = 407509;\n\nselect * from sidekick_settings;\nselect * from default_activity_types;\n\nSELECT * FROM contacts WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\nSELECT * FROM leads WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\n\nSELECT * FROM activity_searches where user_id = 143;\nSELECT * FROM groups where team_id = 1;\n\nselect * from teams where id = 1;\nselect * from groups where team_id = 1; # 1150 - 7e75f8025c22\nselect id, name, group_id, status, deleted_at, email\nfrom users where team_id = 1 order by group_id desc ;\n\nselect * from activity_searches where id in (1977, 1978, 1979);\nselect * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);\nselect * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277\nselect * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879\n\nINSERT INTO `activity_search_filters`\n(`activity_search_id`, `filter`, `value`) VALUES\n(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')\n;\n\nselect * from crm_configurations where id = 39;\n\n\nselect sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id\nwhere u.team_id = 1;\nSELECT * FROM social_accounts WHERE sociable_id = 1635;\nSELECT * FROM users WHERE id = 1635;\n\nselect * from teams where id = 1;\nselect * from users where team_id = 1;\nselect * from team_features where team_id = 1;\nselect * from features;\n\nSELECT * FROM activity_searches where id = 1982; # 1981\nSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;\n\nSELECT * FROM automated_reports where id = 68;\nUPDATE automated_reports set playbook_categories = NULL where id = 68;\nSELECT * FROM automated_report_results where id = 275;\n\nSELECT * FROM automated_reports order by id desc;\nSELECT * FROM automated_report_results order by id desc;\nselect * from activity_searches where user_id = 143;\nselect * from ask_anything_prompts;\n\nSELECT * FROM groups WHERE id = 1439;\nSELECT * FROM users WHERE group_id = 1439;\n\nselect * from permissions; # 158\nselect * from roles;\nselect * from permission_role\n\nselect * from teams where id = 1;\nselect * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;\nselect * from groups where id = 28;\nselect * from playbooks where team_id = 1;\nselect * from playbooks where id = 179;\nselect * from playbook_categories where id = 1391;\nselect * from users where id = 143;\nselect * from crm_profiles where user_id = 143;\nselect * from activities where crm_configuration_id = 39 and type = 'conference'\nand crm_provider_id IS NOT NULL ORDER by id desc;\nselect * from activities where id = 422003; # 00UO400000pB6fpMAC\n\nSELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type\nFROM automated_report_results ar\nJOIN automated_reports a ON a.id = ar.report_id\nWHERE a.type = 'ask_jiminny'\nLIMIT 10;\n\nSELECT `automated_report_results`.* FROM `automated_report_results`\nINNER JOIN `automated_reports`\n ON `automated_report_results`.`report_id` = `automated_reports`.`id`\nWHERE `automated_report_results`.`generated_at` IS NOT NULL\n AND `automated_reports`.`team_id` = 1\n AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$.\"users\"')\n;\n\n\nselect * from teams where id = 3143;\nselect * from crm_configurations where id = 500;\nselect * from users where name = 'Integration Account'; # 1695\nSELECT * FROM social_accounts WHERE sociable_id = 1695;\n\nselect * from activities where crm_configuration_id = 39\nand recording_state = 'recorded' and duration > 60\nand status = 'completed' and actual_start_time >= '2025-12-01';\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;\n\nselect * from leads;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"bounds":{"left":0.011968086,"top":0.047885075,"width":0.024268618,"height":0.024740623},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-6532606308203292909
|
1126710648141684156
|
idle
|
accessibility
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsRepositoryTest
Run 'AutomatedReportsRepositoryTest'
Debug 'AutomatedReportsRepositoryTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
102
3
34
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Kiosk\AutomatedReports;
use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Carbon\Exceptions\InvalidFormatException;
use DateTime;
use DateTimeInterface;
use DateTimeZone;
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcher;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Jiminny\Component\ActivitySearch\FilterDefinition\InputTypeEnum;
use Jiminny\Component\AskAnything\AskAnythingPromptService;
use Jiminny\Component\AskAnything\Dtos\AskAnythingPromptDto;
use Jiminny\Component\UrlGenerator\Webhook;
use Jiminny\Contracts\Repositories\PlaybookCategoryRepository;
use Jiminny\Contracts\Repositories\TeamRepository;
use Jiminny\Contracts\Repositories\UserRepository;
use Jiminny\Exceptions\ApplicationException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Exceptions\ModelNotFoundException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateReportJob;
use Jiminny\Models\Activity\Search;
use Jiminny\Models\AskAnything\AskAnythingPrompt;
use Jiminny\Models\AskAnything\AskAnythingPromptTarget;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Contracts\UserContract;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AskAnythingRepository;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Repositories\GroupRepository;
use Jiminny\Repositories\SearchRepository;
use Jiminny\Repositories\StageRepository;
use Throwable;
class AutomatedReportsService
{
public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';
public const string TYPE_ASK_JIMINNY = 'ask_jiminny';
/**
* Standard report types (used by kiosk for existing automated reports).
*/
// @TODO this will add filter, however if we need to control feature by FF we need conditional logic
public const array TYPES = [
['id' => 'exec_summary', 'name' => 'Exec Summary'],
['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],
['id' => 'product_feedback', 'name' => 'Product Feedback'],
['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],
// ['id' => 'questions', 'name' => 'Questions'],
// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],
];
public const array ALL_TYPES = [
...self::TYPES,
['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],
];
public const string FREQUENCY_DAILY = 'daily';
public const string FREQUENCY_WEEKLY = 'weekly';
public const string FREQUENCY_MONTHLY = 'monthly';
public const string FREQUENCY_QUARTERLY = 'quarterly';
public const string FREQUENCY_ONE_OFF = 'one_off';
/**
* Frequencies for standard (non-Ask Jiminny) reports.
*/
public const array FREQUENCIES = [
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
/**
* Frequencies for Ask Jiminny reports.
*/
public const array ASK_JIMINNY_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
];
public const string MEDIA_TYPE_PDF = 'pdf';
public const string MEDIA_TYPE_PODCAST = 'podcast';
public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];
public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];
public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];
public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];
public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];
public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];
public const int SENT_REPORT_AT_HOURS = 5;
public const string PDF_KEY = 'pdf';
public const string AUDIO_KEY = 'audio';
private const array ALL_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
private const string S3_DIR = 'reports';
private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];
private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];
public function __construct(
private readonly TeamRepository $teamRepository,
private readonly GroupRepository $groupRepository,
private readonly UserRepository $userRepository,
private readonly StageRepository $stageRepository,
private readonly DealStagesService $dealStagesService,
private readonly RecipientsService $recipientsService,
private readonly AutomatedReportsRepository $automatedReportsRepository,
private readonly Webhook $webhookService,
private readonly BusDispatcher $dispatcher,
private readonly ActivityTypeService $activityTypeService,
private readonly PlaybookCategoryRepository $playbookCategoryRepository,
private readonly AskAnythingPromptService $askAnythingPromptService,
private readonly SearchRepository $activitySearchRepository,
private readonly AskAnythingRepository $askAnythingRepository,
) {
}
public static function getTypes(): array
{
$types = self::TYPES;
return array_map(static function ($type) {
return $type['id'];
}, $types);
}
public static function getCallTypes(): array
{
return array_map(static function ($callType) {
return $callType['id'];
}, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);
}
public static function getFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::FREQUENCIES);
}
// front-facing structure
public function getReportEnabledFieldData(bool $value = false): array
{
return [
'id' => 'report_enabled',
'label' => '',
'inputType' => InputTypeEnum::TOGGLE,
'value' => $value,
];
}
// Organizations = Teams
public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array
{
$options = $this->getTeams();
if ($shortVersion) {
return [
'id' => 'organization',
'label' => 'Organization',
'options' => $options,
];
}
return [
'id' => 'organization',
'label' => 'Organization',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $options,
'value' => $value,
'dependencies' => [
'teams',
'deal_stage_at_call',
'current_deal_stage',
'recipients',
ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,
],
'dependsOn' => [],
];
}
// Teams = Groups
public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array
{
if ($shortVersion) {
return [
'id' => 'teams',
'label' => 'Team',
'options' => $options,
];
}
return [
'id' => 'teams',
'label' => 'Team',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => false,
'placeholder' => 'Select',
'options' => $options,
'value' => $value, // value should be an array of objects {id, name}
'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],
'dependsOn' => [],
];
}
public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array
{
$types = [];
if ($team instanceof Team) {
if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
$types = self::TYPES;
}
if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {
$types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];
}
} else {
$types = self::TYPES;
}
if ($shortVersion) {
return [
'id' => 'report_type',
'label' => 'Report Type',
'options' => $types,
];
}
return [
'id' => 'report_type',
'label' => 'Report Type',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $types,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getFrequencyFieldData(?string $value = null): array
{
return [
'id' => 'frequency',
'label' => 'Frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => self::FREQUENCIES,
'value' => $value,
'dependencies' => ['period'],
'dependsOn' => [],
];
}
public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array
{
return [
'id' => 'period',
'label' => 'Select one-off period',
'inputType' => InputTypeEnum::DATE_RANGE,
'required' => true,
'placeholder' => 'Select',
'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],
'queryParams' => [
'startDate' => 'start_date_period',
'endDate' => 'end_date_period',
],
'dependencies' => [],
'dependsOn' => ['frequency'],
];
}
public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array
{
return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);
}
public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);
}
public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);
}
public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'deal_value',
'label' => 'Deal Value',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_deal_value',
'max' => 'max_deal_value',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array
{
$value = [];
$conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;
$dialerOn && $value[] = self::CALL_TYPE_DIALER;
return [
'id' => 'call_type',
'label' => 'Call Type',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => [
self::CALL_TYPE_CONFERENCE,
self::CALL_TYPE_DIALER,
],
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getMediaTypeFieldData(?AutomatedReport $report = null): array
{
$value = [];
if ($report) {
$value = $this->transformMediaTypes($report);
}
return [
'id' => 'media_types',
'label' => 'Export as',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => self::MEDIA_TYPE_OBJECTS,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'call_duration',
'label' => 'Call Duration',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_call_duration',
'max' => 'max_call_duration',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getRecipientsFieldData(?Team $team = null, array $value = []): array
{
return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);
}
public function getJiminnyRecipientsFieldData(array $value = []): array
{
return $this->recipientsService->getJiminnyRecipientsFieldData($value);
}
public function getAdditionalPromptInputFieldData(?string $value = null): array
{
return [
'id' => 'additional_prompt_input',
'label' => 'Special requirements',
'inputType' => InputTypeEnum::TEXTAREA,
'required' => false,
'placeholder' => 'What should be the focus of the report?',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCustomReportNameFieldData(?string $value = null): array
{
return [
'id' => 'custom_name',
'label' => 'Custom report name',
'inputType' => InputTypeEnum::TEXT,
'required' => false,
'placeholder' => 'Enter custom name',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
// data providers
public function getTeams(): array
{
$teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);
$teamData = [];
foreach ($teams as $team) {
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
continue;
}
$teamData[] = $this->transformTeam($team);
}
return $teamData;
}
public function getTeamGroups(string $teamUuid): array
{
$data = [];
$team = $this->getTeam($teamUuid);
if ($team !== null) {
$groups = $team->groups()->get();
foreach ($groups as $group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
];
}
}
return $data;
}
public function getTeamsGroupsOptions(array $filterTeamUuids = []): array
{
$data = [];
$teams = $this->getTeams();
foreach ($teams as $team) {
if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {
continue;
}
$data[] = [
'label' => $team['name'],
'groups' => $this->getTeamGroups($team['id']),
];
}
return $data;
}
public function getTeam(string $teamUuid): ?Team
{
return $this->teamRepository->idOrUuid($teamUuid);
}
public function getTeamById(int $teamId): ?Team
{
return $this->teamRepository->find($teamId);
}
public function getGroupsUuids(AutomatedReport $report): array
{
$uuids = [];
$reportGroups = $report->getGroups();
foreach ($reportGroups as $groupId) {
if ($group = $this->groupRepository->find($groupId)) {
$uuids[] = $group->getUuid();
}
}
return $uuids;
}
public function getPlaybookCategoriesUuids(AutomatedReport $report): array
{
$uuids = [];
$playbookCategories = $report->getPlaybookCategories();
foreach ($playbookCategories as $id) {
if ($category = $this->playbookCategoryRepository->find($id)) {
$uuids[] = $category->getUuid();
}
}
return $uuids;
}
public function getDealAtCallStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getDealAtCallStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getCurrentDealStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getCurrentDealStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getRecipients());
}
public function getJiminnyUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function extractUserUuids(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => $user->getUuid())
->values()
->all();
}
// get mail data
public function getRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getRecipients());
}
/**
* @return array<UserContract>
*/
public function getRecipientUserObjects(AutomatedReport $report): array
{
$userIds = $report->getRecipients()['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->values()
->all();
}
private function getJiminnyRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function buildRecipientUsers(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => [
'email' => $user->getEmailAddress(),
'name' => $user->getName(),
'timezone' => $user->getTimezone()->getName(),
])
->values()
->all();
}
public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array
{
if ($report->isAskJiminnyReport()) {
$recipients = $this->resolveAskJiminnyRecipients($report);
} else {
$recipients = $this->getRecipientUsers($report);
if ($includeJiminny) {
$recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));
}
}
$emails = [];
return array_values(array_filter(
$recipients,
static function ($recipient) use (&$emails) {
if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {
return false;
}
$emails[] = $recipient['email'];
return true;
}
));
}
private function resolveAskJiminnyRecipients(AutomatedReport $report): array
{
$recipients = [];
$creator = $report->getCreator();
if ($creator !== null) {
$recipients[] = [
'email' => $creator->getEmailAddress(),
'name' => $creator->getName(),
'timezone' => $creator->getTimezone()->getName(),
];
}
return array_merge(
$recipients,
$this->buildRecipientUsers($report->getRecipients()),
$this->getGroupRecipientUsers($report),
);
}
private function getGroupRecipientUsers(AutomatedReport $report): array
{
$users = [];
foreach ($report->getGroups() as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group === null) {
continue;
}
foreach ($group->getMembers() as $member) {
$users[] = [
'email' => $member->getEmailAddress(),
'name' => $member->getName(),
'timezone' => $member->getTimezone()->getName(),
];
}
}
return $users;
}
public function getReportTypeName(AutomatedReportResult $report): string
{
$type = $report->getReport()->getType();
$getType = $this->transformReportType($type);
return $getType['name'];
}
public function getReportPeriodName(AutomatedReportResult $report): string
{
$from = $report->getFromDate();
$to = $report->getToDate();
$frequency = $report->getReport()->getFrequency();
if ($from === null || $to === null) {
if (! $report->getReport()->isAskJiminnyReport()) {
$invalidPeriod = $from === null ? 'from' : 'to';
throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);
}
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
}
return $this->formatReportPeriodName($frequency, $from, $to);
}
private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string
{
$fromYear = $from->format('Y');
$toYear = $to->format('Y');
$differentYears = $fromYear !== $toYear;
switch ($frequency) {
case self::FREQUENCY_DAILY:
return $from->format('j M Y');
case self::FREQUENCY_QUARTERLY:
// 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ
$startMonth = $from->format('M');
$endMonth = $to->copy()->subMonth();
$endMonthName = $endMonth->format('M');
$endMonthYear = $endMonth->format('Y');
if ($differentYears) {
return "{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}";
}
return "{$startMonth} - {$endMonthName} {$toYear}";
case self::FREQUENCY_MONTHLY:
// 'May 2025' - monthly reports are always within the same year
return $from->format('M Y');
case self::FREQUENCY_WEEKLY:
// '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ
$startDay = $from->format('j');
$endDay = $to->format('j');
$startMonth = $from->format('M');
$endMonth = $to->format('M');
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
if ($startMonth !== $endMonth) {
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
}
return "{$startDay} - {$endDay} {$endMonth} {$toYear}";
case self::FREQUENCY_ONE_OFF:
// '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ
$startDay = $from->format('j');
$startMonth = $from->format('M');
$endDay = $to->format('j');
$endMonth = $to->format('M');
// If same month and year, use a format like '2-31 May 2025'
if ($startMonth === $endMonth && ! $differentYears) {
return "{$startDay} - {$endDay} {$startMonth} {$toYear}";
}
// If different years, include both years
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
// Same year but different months
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
default:
// Default format for unknown frequencies
return $from->format('j M Y') . ' - ' . $to->format('j M Y');
}
}
public function getReportTeamsName(AutomatedReportResult $report): string
{
$groups = $report->getGroups();
if (empty($groups)) {
return 'All';
}
// Get group names from repository
$groupNames = [];
foreach ($groups as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group) {
$groupNames[] = $group->getName();
}
}
if (count($groupNames) === 1) {
// Single team format
$teamsName = $groupNames[0];
} else {
// Multiple teams format
$teamsName = implode(', ', $groupNames);
}
return $teamsName;
}
public function getReportFileName(AutomatedReportResult $report): string
{
$customName = $report->getReport()->getCustomName();
$periodName = $this->getReportPeriodName($report);
$filenameSuffix = $this->getFilenameSuffix($report);
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$customName} - {$periodName}");
}
$baseName = $this->getReportTypeName($report);
if ($filenameSuffix) {
$baseName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}");
}
public function getReportFileNameWithExtension(AutomatedReportResult $result): string
{
$extension = $this->getMediaTypeMetadata($result)['extension'];
return $this->getReportFileName($result) . '.' . $extension;
}
public function sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool
{
$recipients = array_map('intval', $report->getRecipients()['users'] ?? []);
return in_array($user->getId(), $recipients);
}
public function transformReportResults(Collection $automatedReportResults): array
{
$data = [];
foreach ($automatedReportResults as $automatedReportResult) {
/** @var AutomatedReportResult $automatedReportResult */
$report = $automatedReportResult->getReport();
$createdBy = $report->getCreator();
$creator = [
'id' => $createdBy?->getUuid(),
'name' => $createdBy?->getName(),
'email' => $createdBy?->getEmailAddress(),
'photoUrl' => $createdBy?->getPhotoUrl(),
];
$data[] = [
'id' => $automatedReportResult->getUuid(),
'name' => $automatedReportResult->getName(),
'frequency' => $this->transformFrequency($report->getFrequency()),
'recipients' => $this->buildRecipients($report),
'report_type' => $this->transformReportType($report->getType()),
'media_type' => $automatedReportResult->getMediaType(),
'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),
'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),
'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),
'creator' => $creator,
];
}
return $data;
}
private function buildRecipients(AutomatedReport $report): array
{
$creatorUuid = $report->getCreator()?->getUuid();
$recipients = array_values(array_filter(
$this->transformRecipients($report->getRecipients()),
static fn (array $recipient): bool => $recipient['id'] !== $creatorUuid,
));
if (! $report->isAskJiminnyReport()) {
return $recipients;
}
return [
...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),
...$recipients,
];
}
public function hasCallTypeConference(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);
}
public function hasCallTypeDialer(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);
}
// transformers
private function transformTeam(Team $team): array
{
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
return [];
}
return [
'id' => $team->getUuid(),
'name' => $team->getName(),
];
}
private function transformReportFullView(AutomatedReport $report): array
{
$base = $this->transformReportBase($report);
return $report->getType() === self::TYPE_ASK_JIMINNY
? $base + $this->transformAskJiminnyFields($report)
: $base + $this->transformStandardReportFields($report);
}
private function transformReportBase(AutomatedReport $report): array
{
return [
'id' => $report->getUuid(),
'organization' => $this->transformOrganization(team: $report->getTeam()),
'report_type' => $this->transformReportType($report->getType()),
'frequency' => $this->transformFrequency($report->getFrequency()),
];
}
private function transformStandardReportFields(AutomatedReport $report): array
{
$team = $report->getTeam();
return [
'report_enabled' => $report->getStatus(),
'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),
'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),
'deal_value_min' => $report->getDealValueMin(),
'deal_value_max' => $report->getDealValueMax(),
'call_types' => $this->transformCallType($report->getCallTypes()),
'media_types' => $this->transformMediaTypes($report),
'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),
'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),
'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),
'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),
'recipients' => $this->transformRecipients($report->getRecipients()),
'created_by' => $this->transformCreator($report->getCreator()),
'additional_prompt_input' => $report->getAdditionalPromptInput(),
'custom_name' => $report->getCustomName(),
'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),
'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),
'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),
];
}
private function transformAskJiminnyFields(AutomatedReport $report): array
{
$team = $report->getTeam();
$creatorId = $report->getAttribute('created_by');
$explicitUserIds = array_values(array_filter(
$report->getRecipients()['users'] ?? [],
static fn ($id) => $id !== $creatorId
));
return [
'report_name' => $report->getCustomName(),
'enabled' => $report->getStatus(),
'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),
'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),
'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),
'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),
];
}
private function transformOrganization(?Team $team): array
{
return [
'id' => $team?->getUuid(),
'name' => $team?->getName(),
];
}
private function transformReportType(string $type): array
{
foreach (self::ALL_TYPES as $typeItem) {
if ($typeItem['id'] === $type) {
return $typeItem;
}
}
return [];
}
private function transformCallType(array $types): array
{
$result = [];
$callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];
foreach ($types as $type) {
foreach ($callTypes as $callTypeItem) {
if ($callTypeItem['id'] === $type) {
$result[] = $callTypeItem;
break;
}
}
}
return $result;
}
private function transformMediaTypes(AutomatedReport $report): array
{
$values = [];
foreach ($report->getMediaTypes() as $mediaType) {
if (! in_array($mediaType, self::MEDIA_TYPES, true)) {
continue;
}
$values[] = match ($mediaType) {
self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,
self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,
};
}
return $values;
}
private function transformFrequency(string $frequency): array
{
foreach (self::ALL_FREQUENCIES as $frequencyItem) {
if ($frequencyItem['id'] === $frequency) {
return $frequencyItem;
}
}
return [];
}
public function transformDurationToMinutes(?int $duration): ?int
{
if (! $duration) {
return null;
}
return (int) ($duration / 60);
}
private function transformGroups(?Team $team, array $groupsIds): array
{
if (empty($groupsIds) || ! $team) {
return [];
}
$data = [];
foreach ($groupsIds as $groupId) {
$group = $team->groups()->where('id', $groupId)->first();
if ($group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
'photoUrl' => $group->getPhotoUrl(),
];
}
}
return $data;
}
private function transformStages(?Team $team, array $stagesIds): array
{
if (empty($stagesIds) || ! $team) {
return [];
}
$data = [];
foreach ($stagesIds as $stageId) {
$stage = $team->stages()->where('id', $stageId)->first();
if ($stage) {
$data[] = [
'id' => $stage->getUuid(),
'name' => $stage->getName(),
];
}
}
return $data;
}
private function transformRecipients(array $recipients): array
{
$users = [];
foreach ($recipients['users'] ?? [] as $userId) {
$users[] = $this->transformUser($userId);
}
return $users;
}
private function transformCreator(?User $user): ?array
{
if ($user === null) {
return null;
}
return $this->transformUser($user->getId());
}
private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array
{
if ($prompt === null) {
return null;
}
return [
'id' => $prompt->getUuid(),
'name' => $prompt->getTitle(),
];
}
private function transformSafeSearch(?Search $search): ?array
{
if ($search === null) {
return null;
}
return [
'id' => $search->getUuid(),
'name' => $search->getName(),
];
}
private function transformUser(int $userId): array
{
/* @var ?User $user */
$user = $this->userRepository->find($userId);
return [
'id' => $user?->getUuid(),
'name' => $user?->getName(),
'email' => $user?->getEmailAddress(),
'photoUrl' => $user?->getPhotoUrl(),
];
}
public function create(array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$validatedData['created_by'] = auth()->id();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
public function update(string $uuid, array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$report = $this->automatedReportsRepository->findByUuid($uuid);
if (! $report) {
throw new InvalidArgumentException('Report not found');
}
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
/**
* Create an Ask Jiminny report.
*/
public function createAskJiminnyReport(array $data, User $creator): array
{
$validatedData = $this->validateAskJiminnyReportData($data, $creator);
$validatedData['created_by'] = $creator->getId();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
return $this->transformReportFullView($automatedReport);
}
/**
* Update an Ask Jiminny report.
*/
public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array
{
if (! $report->isAskJiminnyReport()) {
throw new InvalidArgumentException('Report is not an Ask Jiminny report');
}
$validatedData = $this->validateAskJiminnyReportData($data, $user);
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
return $this->transformReportFullView($automatedReport);
}
public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array
{
$this->automatedReportsRepository->update($report, ['status' => $status]);
return $this->transformReportFullView($report->fresh());
}
/**
* Validate and transform data for Ask Jiminny reports.
*/
private function validateAskJiminnyReportData(array $data, User $user): array
{
// Validate name
$name = trim($data['report_name'] ?? '');
if (empty($name)) {
throw new InvalidArgumentException('Report name is required');
}
if (mb_strlen($name) > 50) {
throw new InvalidArgumentException('Report name must be 50 characters or less');
}
// Validate frequency (only daily, weekly, monthly for Ask Jiminny)
$frequency = $data['frequency'] ?? null;
$askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];
if (! in_array($frequency, $askJiminnyFrequencies, true)) {
throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');
}
// Validate expiration date
$expiresAt = $data['expires_on'] ?? null;
if (empty($expiresAt)) {
throw new InvalidArgumentException('Expiration date is required');
}
try {
$expiresAtDate = Carbon::parse($expiresAt);
} catch (InvalidFormatException $e) {
throw new InvalidArgumentException('Expiration date format is invalid');
}
$maxExpiration = Carbon::now()->addYear()->endOfDay();
if ($expiresAtDate->gt($maxExpiration)) {
throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');
}
if ($expiresAtDate->isPast()) {
throw new InvalidArgumentException('Expiration date cannot be in the past');
}
// Validate saved search
$activitySearchId = $data['saved_search'] ?? null;
if (empty($activitySearchId)) {
throw new InvalidArgumentException('Saved search is required');
}
$savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);
if (! $savedSearch) {
throw new InvalidArgumentException('Saved search not found or does not belong to you');
}
// Validate saved prompt
$askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;
if (empty($askAnythingPromptId)) {
throw new InvalidArgumentException('Ask Jiminny prompt is required');
}
$prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);
if (! $prompt) {
throw new InvalidArgumentException('Ask Jiminny prompt not found');
}
// Validate status
$status = $data['enabled'] ?? false;
$recipientUserIds = [$user->getId()];
if (! empty($data['share_users'])) {
$sharedUserIds = $this->validateAndGetUserIdsByTeam(
$user->team,
(array) $data['share_users']
);
$recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);
}
$sharedGroupIds = [];
if (! empty($data['share_teams'])) {
$sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);
}
$recipientUserIds = array_values(array_unique($recipientUserIds));
return [
'team_id' => $user->getTeamId(),
'type' => self::TYPE_ASK_JIMINNY,
'status' => (bool) $status,
'frequency' => $frequency,
'custom_name' => $name,
'activity_search_id' => $savedSearch->getId(),
'ask_anything_prompt_id' => $prompt->getId(),
'expires_at' => $expiresAtDate->toDateString(),
'media_types' => [self::MEDIA_TYPE_PDF],
'call_types' => [],
'recipients' => ['users' => $recipientUserIds],
'groups' => $sharedGroupIds,
];
}
public static function getAskJiminnyFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::ASK_JIMINNY_FREQUENCIES);
}
public function getAskJiminnyReportFilters(User $user): array
{
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
return [
[
'id' => 'prompt',
'label' => 'Prompt',
'options' => $prompts,
],
[
'id' => 'saved_search',
'label' => 'Saved Search',
'options' => $savedSearches,
],
];
}
public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array
{
$team = $user->getTeam();
$userTimezone = $user->getTimezone();
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
$teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [
'id' => $group->getUuid(),
'name' => $group->getName(),
])->values()->all();
$shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];
$sharedTeamsValue = [];
$sharedUsersValue = [];
if ($report) {
$sharedTeamsValue = $this->transformGroups($team, $report->getGroups());
$recipientUserIds = $report->getRecipients()['users'] ?? [];
$creatorId = $report->getAttribute('created_by');
$sharedUserIds = array_values(array_filter(
$recipientUserIds,
static fn ($id) => $id !== $creatorId
));
$sharedUsersValue = collect($sharedUserIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (User $u) => [
'id' => $u->getUuid(),
'name' => $u->getName(),
])
->values()
->all();
}
return [
'fields' => [
[
'id' => 'enabled',
'inputType' => InputTypeEnum::TOGGLE,
'label' => '',
'value' => $report?->getStatus() ?? false,
],
[
'id' => 'report_name',
'inputType' => InputTypeEnum::TEXT,
'label' => 'Name',
'placeholder' => 'Enter name',
'required' => true,
'validation' => ['maxLength' => 50],
'value' => $report?->getCustomName() ?? '',
],
[
'id' => 'frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'label' => 'Frequency',
'required' => true,
'placeholder' => 'Select',
'options' => self::ASK_JIMINNY_FREQUENCIES,
'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,
],
[
'id' => 'expires_on',
'inputType' => InputTypeEnum::DATE,
'label' => 'Expires on',
'required' => true,
'placeholder' => 'Select',
'validation' => [
'minDate' => now($userTimezone)->toDateString(),
'maxDate' => n...
|
66791
|
|
66794
|
1503
|
0
|
2026-04-21T15:05:06.044498+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776783906044_m1.jpg...
|
PhpStorm
|
faVsco.js – AutomatedReportsService.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsRepositoryTest
Run 'AutomatedReportsRepositoryTest'
Debug 'AutomatedReportsRepositoryTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
102
3
34
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Kiosk\AutomatedReports;
use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Carbon\Exceptions\InvalidFormatException;
use DateTime;
use DateTimeInterface;
use DateTimeZone;
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcher;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Jiminny\Component\ActivitySearch\FilterDefinition\InputTypeEnum;
use Jiminny\Component\AskAnything\AskAnythingPromptService;
use Jiminny\Component\AskAnything\Dtos\AskAnythingPromptDto;
use Jiminny\Component\UrlGenerator\Webhook;
use Jiminny\Contracts\Repositories\PlaybookCategoryRepository;
use Jiminny\Contracts\Repositories\TeamRepository;
use Jiminny\Contracts\Repositories\UserRepository;
use Jiminny\Exceptions\ApplicationException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Exceptions\ModelNotFoundException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateReportJob;
use Jiminny\Models\Activity\Search;
use Jiminny\Models\AskAnything\AskAnythingPrompt;
use Jiminny\Models\AskAnything\AskAnythingPromptTarget;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Contracts\UserContract;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AskAnythingRepository;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Repositories\GroupRepository;
use Jiminny\Repositories\SearchRepository;
use Jiminny\Repositories\StageRepository;
use Throwable;
class AutomatedReportsService
{
public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';
public const string TYPE_ASK_JIMINNY = 'ask_jiminny';
/**
* Standard report types (used by kiosk for existing automated reports).
*/
// @TODO this will add filter, however if we need to control feature by FF we need conditional logic
public const array TYPES = [
['id' => 'exec_summary', 'name' => 'Exec Summary'],
['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],
['id' => 'product_feedback', 'name' => 'Product Feedback'],
['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],
// ['id' => 'questions', 'name' => 'Questions'],
// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],
];
public const array ALL_TYPES = [
...self::TYPES,
['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],
];
public const string FREQUENCY_DAILY = 'daily';
public const string FREQUENCY_WEEKLY = 'weekly';
public const string FREQUENCY_MONTHLY = 'monthly';
public const string FREQUENCY_QUARTERLY = 'quarterly';
public const string FREQUENCY_ONE_OFF = 'one_off';
/**
* Frequencies for standard (non-Ask Jiminny) reports.
*/
public const array FREQUENCIES = [
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
/**
* Frequencies for Ask Jiminny reports.
*/
public const array ASK_JIMINNY_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
];
public const string MEDIA_TYPE_PDF = 'pdf';
public const string MEDIA_TYPE_PODCAST = 'podcast';
public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];
public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];
public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];
public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];
public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];
public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];
public const int SENT_REPORT_AT_HOURS = 5;
public const string PDF_KEY = 'pdf';
public const string AUDIO_KEY = 'audio';
private const array ALL_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
private const string S3_DIR = 'reports';
private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];
private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];
public function __construct(
private readonly TeamRepository $teamRepository,
private readonly GroupRepository $groupRepository,
private readonly UserRepository $userRepository,
private readonly StageRepository $stageRepository,
private readonly DealStagesService $dealStagesService,
private readonly RecipientsService $recipientsService,
private readonly AutomatedReportsRepository $automatedReportsRepository,
private readonly Webhook $webhookService,
private readonly BusDispatcher $dispatcher,
private readonly ActivityTypeService $activityTypeService,
private readonly PlaybookCategoryRepository $playbookCategoryRepository,
private readonly AskAnythingPromptService $askAnythingPromptService,
private readonly SearchRepository $activitySearchRepository,
private readonly AskAnythingRepository $askAnythingRepository,
) {
}
public static function getTypes(): array
{
$types = self::TYPES;
return array_map(static function ($type) {
return $type['id'];
}, $types);
}
public static function getCallTypes(): array
{
return array_map(static function ($callType) {
return $callType['id'];
}, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);
}
public static function getFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::FREQUENCIES);
}
// front-facing structure
public function getReportEnabledFieldData(bool $value = false): array
{
return [
'id' => 'report_enabled',
'label' => '',
'inputType' => InputTypeEnum::TOGGLE,
'value' => $value,
];
}
// Organizations = Teams
public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array
{
$options = $this->getTeams();
if ($shortVersion) {
return [
'id' => 'organization',
'label' => 'Organization',
'options' => $options,
];
}
return [
'id' => 'organization',
'label' => 'Organization',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $options,
'value' => $value,
'dependencies' => [
'teams',
'deal_stage_at_call',
'current_deal_stage',
'recipients',
ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,
],
'dependsOn' => [],
];
}
// Teams = Groups
public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array
{
if ($shortVersion) {
return [
'id' => 'teams',
'label' => 'Team',
'options' => $options,
];
}
return [
'id' => 'teams',
'label' => 'Team',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => false,
'placeholder' => 'Select',
'options' => $options,
'value' => $value, // value should be an array of objects {id, name}
'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],
'dependsOn' => [],
];
}
public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array
{
$types = [];
if ($team instanceof Team) {
if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
$types = self::TYPES;
}
if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {
$types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];
}
} else {
$types = self::TYPES;
}
if ($shortVersion) {
return [
'id' => 'report_type',
'label' => 'Report Type',
'options' => $types,
];
}
return [
'id' => 'report_type',
'label' => 'Report Type',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $types,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getFrequencyFieldData(?string $value = null): array
{
return [
'id' => 'frequency',
'label' => 'Frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => self::FREQUENCIES,
'value' => $value,
'dependencies' => ['period'],
'dependsOn' => [],
];
}
public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array
{
return [
'id' => 'period',
'label' => 'Select one-off period',
'inputType' => InputTypeEnum::DATE_RANGE,
'required' => true,
'placeholder' => 'Select',
'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],
'queryParams' => [
'startDate' => 'start_date_period',
'endDate' => 'end_date_period',
],
'dependencies' => [],
'dependsOn' => ['frequency'],
];
}
public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array
{
return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);
}
public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);
}
public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);
}
public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'deal_value',
'label' => 'Deal Value',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_deal_value',
'max' => 'max_deal_value',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array
{
$value = [];
$conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;
$dialerOn && $value[] = self::CALL_TYPE_DIALER;
return [
'id' => 'call_type',
'label' => 'Call Type',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => [
self::CALL_TYPE_CONFERENCE,
self::CALL_TYPE_DIALER,
],
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getMediaTypeFieldData(?AutomatedReport $report = null): array
{
$value = [];
if ($report) {
$value = $this->transformMediaTypes($report);
}
return [
'id' => 'media_types',
'label' => 'Export as',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => self::MEDIA_TYPE_OBJECTS,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'call_duration',
'label' => 'Call Duration',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_call_duration',
'max' => 'max_call_duration',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getRecipientsFieldData(?Team $team = null, array $value = []): array
{
return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);
}
public function getJiminnyRecipientsFieldData(array $value = []): array
{
return $this->recipientsService->getJiminnyRecipientsFieldData($value);
}
public function getAdditionalPromptInputFieldData(?string $value = null): array
{
return [
'id' => 'additional_prompt_input',
'label' => 'Special requirements',
'inputType' => InputTypeEnum::TEXTAREA,
'required' => false,
'placeholder' => 'What should be the focus of the report?',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCustomReportNameFieldData(?string $value = null): array
{
return [
'id' => 'custom_name',
'label' => 'Custom report name',
'inputType' => InputTypeEnum::TEXT,
'required' => false,
'placeholder' => 'Enter custom name',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
// data providers
public function getTeams(): array
{
$teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);
$teamData = [];
foreach ($teams as $team) {
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
continue;
}
$teamData[] = $this->transformTeam($team);
}
return $teamData;
}
public function getTeamGroups(string $teamUuid): array
{
$data = [];
$team = $this->getTeam($teamUuid);
if ($team !== null) {
$groups = $team->groups()->get();
foreach ($groups as $group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
];
}
}
return $data;
}
public function getTeamsGroupsOptions(array $filterTeamUuids = []): array
{
$data = [];
$teams = $this->getTeams();
foreach ($teams as $team) {
if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {
continue;
}
$data[] = [
'label' => $team['name'],
'groups' => $this->getTeamGroups($team['id']),
];
}
return $data;
}
public function getTeam(string $teamUuid): ?Team
{
return $this->teamRepository->idOrUuid($teamUuid);
}
public function getTeamById(int $teamId): ?Team
{
return $this->teamRepository->find($teamId);
}
public function getGroupsUuids(AutomatedReport $report): array
{
$uuids = [];
$reportGroups = $report->getGroups();
foreach ($reportGroups as $groupId) {
if ($group = $this->groupRepository->find($groupId)) {
$uuids[] = $group->getUuid();
}
}
return $uuids;
}
public function getPlaybookCategoriesUuids(AutomatedReport $report): array
{
$uuids = [];
$playbookCategories = $report->getPlaybookCategories();
foreach ($playbookCategories as $id) {
if ($category = $this->playbookCategoryRepository->find($id)) {
$uuids[] = $category->getUuid();
}
}
return $uuids;
}
public function getDealAtCallStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getDealAtCallStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getCurrentDealStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getCurrentDealStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getRecipients());
}
public function getJiminnyUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function extractUserUuids(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => $user->getUuid())
->values()
->all();
}
// get mail data
public function getRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getRecipients());
}
/**
* @return array<UserContract>
*/
public function getRecipientUserObjects(AutomatedReport $report): array
{
$userIds = $report->getRecipients()['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->values()
->all();
}
private function getJiminnyRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function buildRecipientUsers(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => [
'email' => $user->getEmailAddress(),
'name' => $user->getName(),
'timezone' => $user->getTimezone()->getName(),
])
->values()
->all();
}
public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array
{
if ($report->isAskJiminnyReport()) {
$recipients = $this->resolveAskJiminnyRecipients($report);
} else {
$recipients = $this->getRecipientUsers($report);
if ($includeJiminny) {
$recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));
}
}
$emails = [];
return array_values(array_filter(
$recipients,
static function ($recipient) use (&$emails) {
if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {
return false;
}
$emails[] = $recipient['email'];
return true;
}
));
}
private function resolveAskJiminnyRecipients(AutomatedReport $report): array
{
$recipients = [];
$creator = $report->getCreator();
if ($creator !== null) {
$recipients[] = [
'email' => $creator->getEmailAddress(),
'name' => $creator->getName(),
'timezone' => $creator->getTimezone()->getName(),
];
}
return array_merge(
$recipients,
$this->buildRecipientUsers($report->getRecipients()),
$this->getGroupRecipientUsers($report),
);
}
private function getGroupRecipientUsers(AutomatedReport $report): array
{
$users = [];
foreach ($report->getGroups() as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group === null) {
continue;
}
foreach ($group->getMembers() as $member) {
$users[] = [
'email' => $member->getEmailAddress(),
'name' => $member->getName(),
'timezone' => $member->getTimezone()->getName(),
];
}
}
return $users;
}
public function getReportTypeName(AutomatedReportResult $report): string
{
$type = $report->getReport()->getType();
$getType = $this->transformReportType($type);
return $getType['name'];
}
public function getReportPeriodName(AutomatedReportResult $report): string
{
$from = $report->getFromDate();
$to = $report->getToDate();
$frequency = $report->getReport()->getFrequency();
if ($from === null || $to === null) {
if (! $report->getReport()->isAskJiminnyReport()) {
$invalidPeriod = $from === null ? 'from' : 'to';
throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);
}
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
}
return $this->formatReportPeriodName($frequency, $from, $to);
}
private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string
{
$fromYear = $from->format('Y');
$toYear = $to->format('Y');
$differentYears = $fromYear !== $toYear;
switch ($frequency) {
case self::FREQUENCY_DAILY:
return $from->format('j M Y');
case self::FREQUENCY_QUARTERLY:
// 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ
$startMonth = $from->format('M');
$endMonth = $to->copy()->subMonth();
$endMonthName = $endMonth->format('M');
$endMonthYear = $endMonth->format('Y');
if ($differentYears) {
return "{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}";
}
return "{$startMonth} - {$endMonthName} {$toYear}";
case self::FREQUENCY_MONTHLY:
// 'May 2025' - monthly reports are always within the same year
return $from->format('M Y');
case self::FREQUENCY_WEEKLY:
// '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ
$startDay = $from->format('j');
$endDay = $to->format('j');
$startMonth = $from->format('M');
$endMonth = $to->format('M');
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
if ($startMonth !== $endMonth) {
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
}
return "{$startDay} - {$endDay} {$endMonth} {$toYear}";
case self::FREQUENCY_ONE_OFF:
// '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ
$startDay = $from->format('j');
$startMonth = $from->format('M');
$endDay = $to->format('j');
$endMonth = $to->format('M');
// If same month and year, use a format like '2-31 May 2025'
if ($startMonth === $endMonth && ! $differentYears) {
return "{$startDay} - {$endDay} {$startMonth} {$toYear}";
}
// If different years, include both years
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
// Same year but different months
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
default:
// Default format for unknown frequencies
return $from->format('j M Y') . ' - ' . $to->format('j M Y');
}
}
public function getReportTeamsName(AutomatedReportResult $report): string
{
$groups = $report->getGroups();
if (empty($groups)) {
return 'All';
}
// Get group names from repository
$groupNames = [];
foreach ($groups as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group) {
$groupNames[] = $group->getName();
}
}
if (count($groupNames) === 1) {
// Single team format
$teamsName = $groupNames[0];
} else {
// Multiple teams format
$teamsName = implode(', ', $groupNames);
}
return $teamsName;
}
public function getReportFileName(AutomatedReportResult $report): string
{
$customName = $report->getReport()->getCustomName();
$periodName = $this->getReportPeriodName($report);
$filenameSuffix = $this->getFilenameSuffix($report);
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$customName} - {$periodName}");
}
$baseName = $this->getReportTypeName($report);
if ($filenameSuffix) {
$baseName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}");
}
public function getReportFileNameWithExtension(AutomatedReportResult $result): string
{
$extension = $this->getMediaTypeMetadata($result)['extension'];
return $this->getReportFileName($result) . '.' . $extension;
}
public function sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool
{
$recipients = array_map('intval', $report->getRecipients()['users'] ?? []);
return in_array($user->getId(), $recipients);
}
public function transformReportResults(Collection $automatedReportResults): array
{
$data = [];
foreach ($automatedReportResults as $automatedReportResult) {
/** @var AutomatedReportResult $automatedReportResult */
$report = $automatedReportResult->getReport();
$createdBy = $report->getCreator();
$creator = [
'id' => $createdBy?->getUuid(),
'name' => $createdBy?->getName(),
'email' => $createdBy?->getEmailAddress(),
'photoUrl' => $createdBy?->getPhotoUrl(),
];
$data[] = [
'id' => $automatedReportResult->getUuid(),
'name' => $automatedReportResult->getName(),
'frequency' => $this->transformFrequency($report->getFrequency()),
'recipients' => $this->buildRecipients($report),
'report_type' => $this->transformReportType($report->getType()),
'media_type' => $automatedReportResult->getMediaType(),
'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),
'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),
'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),
'creator' => $creator,
];
}
return $data;
}
private function buildRecipients(AutomatedReport $report): array
{
$creatorUuid = $report->getCreator()?->getUuid();
$recipients = array_values(array_filter(
$this->transformRecipients($report->getRecipients()),
static fn (array $recipient): bool => $recipient['id'] !== $creatorUuid,
));
if (! $report->isAskJiminnyReport()) {
return $recipients;
}
return [
...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),
...$recipients,
];
}
public function hasCallTypeConference(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);
}
public function hasCallTypeDialer(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);
}
// transformers
private function transformTeam(Team $team): array
{
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
return [];
}
return [
'id' => $team->getUuid(),
'name' => $team->getName(),
];
}
private function transformReportFullView(AutomatedReport $report): array
{
$base = $this->transformReportBase($report);
return $report->getType() === self::TYPE_ASK_JIMINNY
? $base + $this->transformAskJiminnyFields($report)
: $base + $this->transformStandardReportFields($report);
}
private function transformReportBase(AutomatedReport $report): array
{
return [
'id' => $report->getUuid(),
'organization' => $this->transformOrganization(team: $report->getTeam()),
'report_type' => $this->transformReportType($report->getType()),
'frequency' => $this->transformFrequency($report->getFrequency()),
];
}
private function transformStandardReportFields(AutomatedReport $report): array
{
$team = $report->getTeam();
return [
'report_enabled' => $report->getStatus(),
'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),
'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),
'deal_value_min' => $report->getDealValueMin(),
'deal_value_max' => $report->getDealValueMax(),
'call_types' => $this->transformCallType($report->getCallTypes()),
'media_types' => $this->transformMediaTypes($report),
'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),
'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),
'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),
'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),
'recipients' => $this->transformRecipients($report->getRecipients()),
'created_by' => $this->transformCreator($report->getCreator()),
'additional_prompt_input' => $report->getAdditionalPromptInput(),
'custom_name' => $report->getCustomName(),
'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),
'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),
'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),
];
}
private function transformAskJiminnyFields(AutomatedReport $report): array
{
$team = $report->getTeam();
$creatorId = $report->getAttribute('created_by');
$explicitUserIds = array_values(array_filter(
$report->getRecipients()['users'] ?? [],
static fn ($id) => $id !== $creatorId
));
return [
'report_name' => $report->getCustomName(),
'enabled' => $report->getStatus(),
'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),
'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),
'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),
'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),
];
}
private function transformOrganization(?Team $team): array
{
return [
'id' => $team?->getUuid(),
'name' => $team?->getName(),
];
}
private function transformReportType(string $type): array
{
foreach (self::ALL_TYPES as $typeItem) {
if ($typeItem['id'] === $type) {
return $typeItem;
}
}
return [];
}
private function transformCallType(array $types): array
{
$result = [];
$callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];
foreach ($types as $type) {
foreach ($callTypes as $callTypeItem) {
if ($callTypeItem['id'] === $type) {
$result[] = $callTypeItem;
break;
}
}
}
return $result;
}
private function transformMediaTypes(AutomatedReport $report): array
{
$values = [];
foreach ($report->getMediaTypes() as $mediaType) {
if (! in_array($mediaType, self::MEDIA_TYPES, true)) {
continue;
}
$values[] = match ($mediaType) {
self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,
self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,
};
}
return $values;
}
private function transformFrequency(string $frequency): array
{
foreach (self::ALL_FREQUENCIES as $frequencyItem) {
if ($frequencyItem['id'] === $frequency) {
return $frequencyItem;
}
}
return [];
}
public function transformDurationToMinutes(?int $duration): ?int
{
if (! $duration) {
return null;
}
return (int) ($duration / 60);
}
private function transformGroups(?Team $team, array $groupsIds): array
{
if (empty($groupsIds) || ! $team) {
return [];
}
$data = [];
foreach ($groupsIds as $groupId) {
$group = $team->groups()->where('id', $groupId)->first();
if ($group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
'photoUrl' => $group->getPhotoUrl(),
];
}
}
return $data;
}
private function transformStages(?Team $team, array $stagesIds): array
{
if (empty($stagesIds) || ! $team) {
return [];
}
$data = [];
foreach ($stagesIds as $stageId) {
$stage = $team->stages()->where('id', $stageId)->first();
if ($stage) {
$data[] = [
'id' => $stage->getUuid(),
'name' => $stage->getName(),
];
}
}
return $data;
}
private function transformRecipients(array $recipients): array
{
$users = [];
foreach ($recipients['users'] ?? [] as $userId) {
$users[] = $this->transformUser($userId);
}
return $users;
}
private function transformCreator(?User $user): ?array
{
if ($user === null) {
return null;
}
return $this->transformUser($user->getId());
}
private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array
{
if ($prompt === null) {
return null;
}
return [
'id' => $prompt->getUuid(),
'name' => $prompt->getTitle(),
];
}
private function transformSafeSearch(?Search $search): ?array
{
if ($search === null) {
return null;
}
return [
'id' => $search->getUuid(),
'name' => $search->getName(),
];
}
private function transformUser(int $userId): array
{
/* @var ?User $user */
$user = $this->userRepository->find($userId);
return [
'id' => $user?->getUuid(),
'name' => $user?->getName(),
'email' => $user?->getEmailAddress(),
'photoUrl' => $user?->getPhotoUrl(),
];
}
public function create(array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$validatedData['created_by'] = auth()->id();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
public function update(string $uuid, array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$report = $this->automatedReportsRepository->findByUuid($uuid);
if (! $report) {
throw new InvalidArgumentException('Report not found');
}
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
/**
* Create an Ask Jiminny report.
*/
public function createAskJiminnyReport(array $data, User $creator): array
{
$validatedData = $this->validateAskJiminnyReportData($data, $creator);
$validatedData['created_by'] = $creator->getId();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
return $this->transformReportFullView($automatedReport);
}
/**
* Update an Ask Jiminny report.
*/
public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array
{
if (! $report->isAskJiminnyReport()) {
throw new InvalidArgumentException('Report is not an Ask Jiminny report');
}
$validatedData = $this->validateAskJiminnyReportData($data, $user);
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
return $this->transformReportFullView($automatedReport);
}
public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array
{
$this->automatedReportsRepository->update($report, ['status' => $status]);
return $this->transformReportFullView($report->fresh());
}
/**
* Validate and transform data for Ask Jiminny reports.
*/
private function validateAskJiminnyReportData(array $data, User $user): array
{
// Validate name
$name = trim($data['report_name'] ?? '');
if (empty($name)) {
throw new InvalidArgumentException('Report name is required');
}
if (mb_strlen($name) > 50) {
throw new InvalidArgumentException('Report name must be 50 characters or less');
}
// Validate frequency (only daily, weekly, monthly for Ask Jiminny)
$frequency = $data['frequency'] ?? null;
$askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];
if (! in_array($frequency, $askJiminnyFrequencies, true)) {
throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');
}
// Validate expiration date
$expiresAt = $data['expires_on'] ?? null;
if (empty($expiresAt)) {
throw new InvalidArgumentException('Expiration date is required');
}
try {
$expiresAtDate = Carbon::parse($expiresAt);
} catch (InvalidFormatException $e) {
throw new InvalidArgumentException('Expiration date format is invalid');
}
$maxExpiration = Carbon::now()->addYear()->endOfDay();
if ($expiresAtDate->gt($maxExpiration)) {
throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');
}
if ($expiresAtDate->isPast()) {
throw new InvalidArgumentException('Expiration date cannot be in the past');
}
// Validate saved search
$activitySearchId = $data['saved_search'] ?? null;
if (empty($activitySearchId)) {
throw new InvalidArgumentException('Saved search is required');
}
$savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);
if (! $savedSearch) {
throw new InvalidArgumentException('Saved search not found or does not belong to you');
}
// Validate saved prompt
$askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;
if (empty($askAnythingPromptId)) {
throw new InvalidArgumentException('Ask Jiminny prompt is required');
}
$prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);
if (! $prompt) {
throw new InvalidArgumentException('Ask Jiminny prompt not found');
}
// Validate status
$status = $data['enabled'] ?? false;
$recipientUserIds = [$user->getId()];
if (! empty($data['share_users'])) {
$sharedUserIds = $this->validateAndGetUserIdsByTeam(
$user->team,
(array) $data['share_users']
);
$recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);
}
$sharedGroupIds = [];
if (! empty($data['share_teams'])) {
$sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);
}
$recipientUserIds = array_values(array_unique($recipientUserIds));
return [
'team_id' => $user->getTeamId(),
'type' => self::TYPE_ASK_JIMINNY,
'status' => (bool) $status,
'frequency' => $frequency,
'custom_name' => $name,
'activity_search_id' => $savedSearch->getId(),
'ask_anything_prompt_id' => $prompt->getId(),
'expires_at' => $expiresAtDate->toDateString(),
'media_types' => [self::MEDIA_TYPE_PDF],
'call_types' => [],
'recipients' => ['users' => $recipientUserIds],
'groups' => $sharedGroupIds,
];
}
public static function getAskJiminnyFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::ASK_JIMINNY_FREQUENCIES);
}
public function getAskJiminnyReportFilters(User $user): array
{
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
return [
[
'id' => 'prompt',
'label' => 'Prompt',
'options' => $prompts,
],
[
'id' => 'saved_search',
'label' => 'Saved Search',
'options' => $savedSearches,
],
];
}
public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array
{
$team = $user->getTeam();
$userTimezone = $user->getTimezone();
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
$teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [
'id' => $group->getUuid(),
'name' => $group->getName(),
])->values()->all();
$shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];
$sharedTeamsValue = [];
$sharedUsersValue = [];
if ($report) {
$sharedTeamsValue = $this->transformGroups($team, $report->getGroups());
$recipientUserIds = $report->getRecipients()['users'] ?? [];
$creatorId = $report->getAttribute('created_by');
$sharedUserIds = array_values(array_filter(
$recipientUserIds,
static fn ($id) => $id !== $creatorId
));
$sharedUsersValue = collect($sharedUserIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (User $u) => [
'id' => $u->getUuid(),
'name' => $u->getName(),
])
->values()
->all();
}
return [
'fields' => [
[
'id' => 'enabled',
'inputType' => InputTypeEnum::TOGGLE,
'label' => '',
'value' => $report?->getStatus() ?? false,
],
[
'id' => 'report_name',
'inputType' => InputTypeEnum::TEXT,
'label' => 'Name',
'placeholder' => 'Enter name',
'required' => true,
'validation' => ['maxLength' => 50],
'value' => $report?->getCustomName() ?? '',
],
[
'id' => 'frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'label' => 'Frequency',
'required' => true,
'placeholder' => 'Select',
'options' => self::ASK_JIMINNY_FREQUENCIES,
'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,
],
[
'id' => 'expires_on',
'inputType' => InputTypeEnum::DATE,
'label' => 'Expires on',
'required' => true,
'placeholder' => 'Select',
'validation' => [
'minDate' => now($userTimezone)->toDateString(),
'maxDate' => n...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"#11894 on JY-18909-automated-reports-ask-jiminny, menu","depth":5,"help_text":"Pull request #11894 exists for current branch JY-18909-automated-reports-ask-jiminny","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AutomatedReportsRepositoryTest","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AutomatedReportsRepositoryTest'","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AutomatedReportsRepositoryTest'","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"102","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"3","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"34","depth":4,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Kiosk\\AutomatedReports;\n\nuse Carbon\\CarbonImmutable;\nuse Carbon\\CarbonInterface;\nuse Carbon\\Exceptions\\InvalidFormatException;\nuse DateTime;\nuse DateTimeInterface;\nuse DateTimeZone;\nuse Illuminate\\Contracts\\Bus\\Dispatcher as BusDispatcher;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Support\\Facades\\Log;\nuse Illuminate\\Support\\Facades\\Storage;\nuse Jiminny\\Component\\ActivitySearch\\FilterDefinition\\InputTypeEnum;\nuse Jiminny\\Component\\AskAnything\\AskAnythingPromptService;\nuse Jiminny\\Component\\AskAnything\\Dtos\\AskAnythingPromptDto;\nuse Jiminny\\Component\\UrlGenerator\\Webhook;\nuse Jiminny\\Contracts\\Repositories\\PlaybookCategoryRepository;\nuse Jiminny\\Contracts\\Repositories\\TeamRepository;\nuse Jiminny\\Contracts\\Repositories\\UserRepository;\nuse Jiminny\\Exceptions\\ApplicationException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Exceptions\\ModelNotFoundException;\nuse Jiminny\\Jobs\\AutomatedReports\\RequestGenerateReportJob;\nuse Jiminny\\Models\\Activity\\Search;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPrompt;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPromptTarget;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Contracts\\UserContract;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Repositories\\AskAnythingRepository;\nuse Jiminny\\Repositories\\AutomatedReportsRepository;\nuse Jiminny\\Repositories\\GroupRepository;\nuse Jiminny\\Repositories\\SearchRepository;\nuse Jiminny\\Repositories\\StageRepository;\nuse Throwable;\n\nclass AutomatedReportsService\n{\n public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';\n public const string TYPE_ASK_JIMINNY = 'ask_jiminny';\n\n /**\n * Standard report types (used by kiosk for existing automated reports).\n */\n // @TODO this will add filter, however if we need to control feature by FF we need conditional logic\n public const array TYPES = [\n ['id' => 'exec_summary', 'name' => 'Exec Summary'],\n ['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],\n ['id' => 'product_feedback', 'name' => 'Product Feedback'],\n ['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],\n// ['id' => 'questions', 'name' => 'Questions'],\n// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],\n ];\n\n public const array ALL_TYPES = [\n ...self::TYPES,\n ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],\n ];\n\n public const string FREQUENCY_DAILY = 'daily';\n public const string FREQUENCY_WEEKLY = 'weekly';\n public const string FREQUENCY_MONTHLY = 'monthly';\n public const string FREQUENCY_QUARTERLY = 'quarterly';\n public const string FREQUENCY_ONE_OFF = 'one_off';\n\n /**\n * Frequencies for standard (non-Ask Jiminny) reports.\n */\n public const array FREQUENCIES = [\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n\n /**\n * Frequencies for Ask Jiminny reports.\n */\n public const array ASK_JIMINNY_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ];\n\n public const string MEDIA_TYPE_PDF = 'pdf';\n public const string MEDIA_TYPE_PODCAST = 'podcast';\n public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];\n public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];\n public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];\n public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];\n\n public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];\n public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];\n public const int SENT_REPORT_AT_HOURS = 5;\n public const string PDF_KEY = 'pdf';\n public const string AUDIO_KEY = 'audio';\n\n private const array ALL_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n private const string S3_DIR = 'reports';\n private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];\n private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];\n\n public function __construct(\n private readonly TeamRepository $teamRepository,\n private readonly GroupRepository $groupRepository,\n private readonly UserRepository $userRepository,\n private readonly StageRepository $stageRepository,\n private readonly DealStagesService $dealStagesService,\n private readonly RecipientsService $recipientsService,\n private readonly AutomatedReportsRepository $automatedReportsRepository,\n private readonly Webhook $webhookService,\n private readonly BusDispatcher $dispatcher,\n private readonly ActivityTypeService $activityTypeService,\n private readonly PlaybookCategoryRepository $playbookCategoryRepository,\n private readonly AskAnythingPromptService $askAnythingPromptService,\n private readonly SearchRepository $activitySearchRepository,\n private readonly AskAnythingRepository $askAnythingRepository,\n ) {\n }\n\n public static function getTypes(): array\n {\n $types = self::TYPES;\n\n return array_map(static function ($type) {\n return $type['id'];\n }, $types);\n }\n\n public static function getCallTypes(): array\n {\n return array_map(static function ($callType) {\n return $callType['id'];\n }, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);\n }\n\n public static function getFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::FREQUENCIES);\n }\n\n // front-facing structure\n public function getReportEnabledFieldData(bool $value = false): array\n {\n return [\n 'id' => 'report_enabled',\n 'label' => '',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'value' => $value,\n ];\n }\n\n // Organizations = Teams\n public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array\n {\n $options = $this->getTeams();\n\n if ($shortVersion) {\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value,\n 'dependencies' => [\n 'teams',\n 'deal_stage_at_call',\n 'current_deal_stage',\n 'recipients',\n ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,\n ],\n 'dependsOn' => [],\n ];\n }\n\n // Teams = Groups\n public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array\n {\n if ($shortVersion) {\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value, // value should be an array of objects {id, name}\n 'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],\n 'dependsOn' => [],\n ];\n }\n\n public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array\n {\n $types = [];\n if ($team instanceof Team) {\n if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n $types = self::TYPES;\n }\n if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {\n $types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];\n }\n } else {\n $types = self::TYPES;\n }\n\n if ($shortVersion) {\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'options' => $types,\n ];\n }\n\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $types,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getFrequencyFieldData(?string $value = null): array\n {\n return [\n 'id' => 'frequency',\n 'label' => 'Frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::FREQUENCIES,\n 'value' => $value,\n 'dependencies' => ['period'],\n 'dependsOn' => [],\n ];\n }\n\n public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array\n {\n return [\n 'id' => 'period',\n 'label' => 'Select one-off period',\n 'inputType' => InputTypeEnum::DATE_RANGE,\n 'required' => true,\n 'placeholder' => 'Select',\n 'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],\n 'queryParams' => [\n 'startDate' => 'start_date_period',\n 'endDate' => 'end_date_period',\n ],\n 'dependencies' => [],\n 'dependsOn' => ['frequency'],\n ];\n }\n\n public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array\n {\n return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);\n }\n\n public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);\n }\n\n public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);\n }\n\n public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'deal_value',\n 'label' => 'Deal Value',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_deal_value',\n 'max' => 'max_deal_value',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array\n {\n $value = [];\n $conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;\n $dialerOn && $value[] = self::CALL_TYPE_DIALER;\n\n return [\n 'id' => 'call_type',\n 'label' => 'Call Type',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => [\n self::CALL_TYPE_CONFERENCE,\n self::CALL_TYPE_DIALER,\n ],\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getMediaTypeFieldData(?AutomatedReport $report = null): array\n {\n $value = [];\n\n if ($report) {\n $value = $this->transformMediaTypes($report);\n }\n\n return [\n 'id' => 'media_types',\n 'label' => 'Export as',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => self::MEDIA_TYPE_OBJECTS,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'call_duration',\n 'label' => 'Call Duration',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_call_duration',\n 'max' => 'max_call_duration',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getRecipientsFieldData(?Team $team = null, array $value = []): array\n {\n return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);\n }\n\n public function getJiminnyRecipientsFieldData(array $value = []): array\n {\n return $this->recipientsService->getJiminnyRecipientsFieldData($value);\n }\n\n public function getAdditionalPromptInputFieldData(?string $value = null): array\n {\n return [\n 'id' => 'additional_prompt_input',\n 'label' => 'Special requirements',\n 'inputType' => InputTypeEnum::TEXTAREA,\n 'required' => false,\n 'placeholder' => 'What should be the focus of the report?',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCustomReportNameFieldData(?string $value = null): array\n {\n return [\n 'id' => 'custom_name',\n 'label' => 'Custom report name',\n 'inputType' => InputTypeEnum::TEXT,\n 'required' => false,\n 'placeholder' => 'Enter custom name',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n // data providers\n public function getTeams(): array\n {\n $teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);\n\n $teamData = [];\n foreach ($teams as $team) {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n continue;\n }\n\n $teamData[] = $this->transformTeam($team);\n }\n\n return $teamData;\n }\n\n public function getTeamGroups(string $teamUuid): array\n {\n $data = [];\n $team = $this->getTeam($teamUuid);\n\n if ($team !== null) {\n $groups = $team->groups()->get();\n\n foreach ($groups as $group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n public function getTeamsGroupsOptions(array $filterTeamUuids = []): array\n {\n $data = [];\n $teams = $this->getTeams();\n\n foreach ($teams as $team) {\n if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {\n continue;\n }\n\n $data[] = [\n 'label' => $team['name'],\n 'groups' => $this->getTeamGroups($team['id']),\n ];\n }\n\n return $data;\n }\n\n public function getTeam(string $teamUuid): ?Team\n {\n return $this->teamRepository->idOrUuid($teamUuid);\n }\n\n public function getTeamById(int $teamId): ?Team\n {\n return $this->teamRepository->find($teamId);\n }\n\n public function getGroupsUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportGroups = $report->getGroups();\n foreach ($reportGroups as $groupId) {\n if ($group = $this->groupRepository->find($groupId)) {\n $uuids[] = $group->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getPlaybookCategoriesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $playbookCategories = $report->getPlaybookCategories();\n foreach ($playbookCategories as $id) {\n if ($category = $this->playbookCategoryRepository->find($id)) {\n $uuids[] = $category->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getDealAtCallStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getDealAtCallStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getCurrentDealStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getCurrentDealStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getRecipients());\n }\n\n public function getJiminnyUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function extractUserUuids(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => $user->getUuid())\n ->values()\n ->all();\n }\n\n // get mail data\n public function getRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getRecipients());\n }\n\n /**\n * @return array<UserContract>\n */\n public function getRecipientUserObjects(AutomatedReport $report): array\n {\n $userIds = $report->getRecipients()['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->values()\n ->all();\n }\n\n private function getJiminnyRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function buildRecipientUsers(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => [\n 'email' => $user->getEmailAddress(),\n 'name' => $user->getName(),\n 'timezone' => $user->getTimezone()->getName(),\n ])\n ->values()\n ->all();\n }\n\n public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array\n {\n if ($report->isAskJiminnyReport()) {\n $recipients = $this->resolveAskJiminnyRecipients($report);\n } else {\n $recipients = $this->getRecipientUsers($report);\n if ($includeJiminny) {\n $recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));\n }\n }\n\n $emails = [];\n\n return array_values(array_filter(\n $recipients,\n static function ($recipient) use (&$emails) {\n if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {\n return false;\n }\n $emails[] = $recipient['email'];\n\n return true;\n }\n ));\n }\n\n private function resolveAskJiminnyRecipients(AutomatedReport $report): array\n {\n $recipients = [];\n\n $creator = $report->getCreator();\n if ($creator !== null) {\n $recipients[] = [\n 'email' => $creator->getEmailAddress(),\n 'name' => $creator->getName(),\n 'timezone' => $creator->getTimezone()->getName(),\n ];\n }\n\n return array_merge(\n $recipients,\n $this->buildRecipientUsers($report->getRecipients()),\n $this->getGroupRecipientUsers($report),\n );\n }\n\n private function getGroupRecipientUsers(AutomatedReport $report): array\n {\n $users = [];\n foreach ($report->getGroups() as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group === null) {\n continue;\n }\n foreach ($group->getMembers() as $member) {\n $users[] = [\n 'email' => $member->getEmailAddress(),\n 'name' => $member->getName(),\n 'timezone' => $member->getTimezone()->getName(),\n ];\n }\n }\n\n return $users;\n }\n\n public function getReportTypeName(AutomatedReportResult $report): string\n {\n $type = $report->getReport()->getType();\n\n $getType = $this->transformReportType($type);\n\n return $getType['name'];\n }\n\n public function getReportPeriodName(AutomatedReportResult $report): string\n {\n $from = $report->getFromDate();\n $to = $report->getToDate();\n $frequency = $report->getReport()->getFrequency();\n\n if ($from === null || $to === null) {\n if (! $report->getReport()->isAskJiminnyReport()) {\n $invalidPeriod = $from === null ? 'from' : 'to';\n\n throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);\n }\n\n $period = $this->calculateFromAndToDatePeriod($frequency);\n $from = $period['fromDate'];\n $to = $period['toDate'];\n }\n\n return $this->formatReportPeriodName($frequency, $from, $to);\n }\n\n private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string\n {\n $fromYear = $from->format('Y');\n $toYear = $to->format('Y');\n $differentYears = $fromYear !== $toYear;\n\n switch ($frequency) {\n case self::FREQUENCY_DAILY:\n return $from->format('j M Y');\n\n case self::FREQUENCY_QUARTERLY:\n // 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ\n $startMonth = $from->format('M');\n $endMonth = $to->copy()->subMonth();\n $endMonthName = $endMonth->format('M');\n $endMonthYear = $endMonth->format('Y');\n\n if ($differentYears) {\n return \"{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}\";\n }\n\n return \"{$startMonth} - {$endMonthName} {$toYear}\";\n\n case self::FREQUENCY_MONTHLY:\n // 'May 2025' - monthly reports are always within the same year\n return $from->format('M Y');\n\n case self::FREQUENCY_WEEKLY:\n // '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ\n $startDay = $from->format('j');\n $endDay = $to->format('j');\n $startMonth = $from->format('M');\n $endMonth = $to->format('M');\n\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n if ($startMonth !== $endMonth) {\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n return \"{$startDay} - {$endDay} {$endMonth} {$toYear}\";\n\n case self::FREQUENCY_ONE_OFF:\n // '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ\n $startDay = $from->format('j');\n $startMonth = $from->format('M');\n $endDay = $to->format('j');\n $endMonth = $to->format('M');\n\n // If same month and year, use a format like '2-31 May 2025'\n if ($startMonth === $endMonth && ! $differentYears) {\n return \"{$startDay} - {$endDay} {$startMonth} {$toYear}\";\n }\n\n // If different years, include both years\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n // Same year but different months\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n\n default:\n // Default format for unknown frequencies\n return $from->format('j M Y') . ' - ' . $to->format('j M Y');\n }\n }\n\n public function getReportTeamsName(AutomatedReportResult $report): string\n {\n $groups = $report->getGroups();\n\n if (empty($groups)) {\n return 'All';\n }\n\n // Get group names from repository\n $groupNames = [];\n foreach ($groups as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group) {\n $groupNames[] = $group->getName();\n }\n }\n\n if (count($groupNames) === 1) {\n // Single team format\n $teamsName = $groupNames[0];\n } else {\n // Multiple teams format\n $teamsName = implode(', ', $groupNames);\n }\n\n return $teamsName;\n }\n\n public function getReportFileName(AutomatedReportResult $report): string\n {\n $customName = $report->getReport()->getCustomName();\n $periodName = $this->getReportPeriodName($report);\n $filenameSuffix = $this->getFilenameSuffix($report);\n\n if ($customName) {\n if ($filenameSuffix) {\n $customName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$customName} - {$periodName}\");\n }\n\n $baseName = $this->getReportTypeName($report);\n\n if ($filenameSuffix) {\n $baseName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}\");\n }\n\n public function getReportFileNameWithExtension(AutomatedReportResult $result): string\n {\n $extension = $this->getMediaTypeMetadata($result)['extension'];\n\n return $this->getReportFileName($result) . '.' . $extension;\n }\n\n public function sanitizeFileName(string $fileName): string\n {\n return str_replace(['/', '\\\\'], '-', $fileName);\n }\n\n public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool\n {\n $recipients = array_map('intval', $report->getRecipients()['users'] ?? []);\n\n return in_array($user->getId(), $recipients);\n }\n\n public function transformReportResults(Collection $automatedReportResults): array\n {\n $data = [];\n foreach ($automatedReportResults as $automatedReportResult) {\n /** @var AutomatedReportResult $automatedReportResult */\n\n $report = $automatedReportResult->getReport();\n\n $createdBy = $report->getCreator();\n $creator = [\n 'id' => $createdBy?->getUuid(),\n 'name' => $createdBy?->getName(),\n 'email' => $createdBy?->getEmailAddress(),\n 'photoUrl' => $createdBy?->getPhotoUrl(),\n ];\n\n $data[] = [\n 'id' => $automatedReportResult->getUuid(),\n 'name' => $automatedReportResult->getName(),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n 'recipients' => $this->buildRecipients($report),\n 'report_type' => $this->transformReportType($report->getType()),\n 'media_type' => $automatedReportResult->getMediaType(),\n 'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),\n 'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),\n 'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),\n 'creator' => $creator,\n ];\n }\n\n return $data;\n }\n\n private function buildRecipients(AutomatedReport $report): array\n {\n $creatorUuid = $report->getCreator()?->getUuid();\n\n $recipients = array_values(array_filter(\n $this->transformRecipients($report->getRecipients()),\n static fn (array $recipient): bool => $recipient['id'] !== $creatorUuid,\n ));\n\n if (! $report->isAskJiminnyReport()) {\n return $recipients;\n }\n\n return [\n ...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),\n ...$recipients,\n ];\n }\n\n public function hasCallTypeConference(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);\n }\n\n public function hasCallTypeDialer(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);\n }\n\n // transformers\n private function transformTeam(Team $team): array\n {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n return [];\n }\n\n return [\n 'id' => $team->getUuid(),\n 'name' => $team->getName(),\n ];\n }\n\n private function transformReportFullView(AutomatedReport $report): array\n {\n $base = $this->transformReportBase($report);\n\n return $report->getType() === self::TYPE_ASK_JIMINNY\n ? $base + $this->transformAskJiminnyFields($report)\n : $base + $this->transformStandardReportFields($report);\n }\n\n private function transformReportBase(AutomatedReport $report): array\n {\n return [\n 'id' => $report->getUuid(),\n 'organization' => $this->transformOrganization(team: $report->getTeam()),\n 'report_type' => $this->transformReportType($report->getType()),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n ];\n }\n\n private function transformStandardReportFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n\n return [\n 'report_enabled' => $report->getStatus(),\n 'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),\n 'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),\n 'deal_value_min' => $report->getDealValueMin(),\n 'deal_value_max' => $report->getDealValueMax(),\n 'call_types' => $this->transformCallType($report->getCallTypes()),\n 'media_types' => $this->transformMediaTypes($report),\n 'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),\n 'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),\n 'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),\n 'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),\n 'recipients' => $this->transformRecipients($report->getRecipients()),\n 'created_by' => $this->transformCreator($report->getCreator()),\n 'additional_prompt_input' => $report->getAdditionalPromptInput(),\n 'custom_name' => $report->getCustomName(),\n 'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),\n 'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),\n 'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),\n ];\n }\n\n private function transformAskJiminnyFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n $creatorId = $report->getAttribute('created_by');\n $explicitUserIds = array_values(array_filter(\n $report->getRecipients()['users'] ?? [],\n static fn ($id) => $id !== $creatorId\n ));\n\n return [\n 'report_name' => $report->getCustomName(),\n 'enabled' => $report->getStatus(),\n 'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),\n 'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),\n 'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),\n 'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),\n ];\n }\n\n private function transformOrganization(?Team $team): array\n {\n return [\n 'id' => $team?->getUuid(),\n 'name' => $team?->getName(),\n ];\n }\n\n private function transformReportType(string $type): array\n {\n foreach (self::ALL_TYPES as $typeItem) {\n if ($typeItem['id'] === $type) {\n return $typeItem;\n }\n }\n\n return [];\n }\n\n private function transformCallType(array $types): array\n {\n $result = [];\n $callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];\n\n foreach ($types as $type) {\n foreach ($callTypes as $callTypeItem) {\n if ($callTypeItem['id'] === $type) {\n $result[] = $callTypeItem;\n\n break;\n }\n }\n }\n\n return $result;\n }\n\n private function transformMediaTypes(AutomatedReport $report): array\n {\n $values = [];\n\n foreach ($report->getMediaTypes() as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n continue;\n }\n\n $values[] = match ($mediaType) {\n self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,\n self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,\n };\n }\n\n return $values;\n }\n\n private function transformFrequency(string $frequency): array\n {\n foreach (self::ALL_FREQUENCIES as $frequencyItem) {\n if ($frequencyItem['id'] === $frequency) {\n return $frequencyItem;\n }\n }\n\n return [];\n }\n\n public function transformDurationToMinutes(?int $duration): ?int\n {\n if (! $duration) {\n return null;\n }\n\n return (int) ($duration / 60);\n }\n\n private function transformGroups(?Team $team, array $groupsIds): array\n {\n if (empty($groupsIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($groupsIds as $groupId) {\n $group = $team->groups()->where('id', $groupId)->first();\n\n if ($group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n 'photoUrl' => $group->getPhotoUrl(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformStages(?Team $team, array $stagesIds): array\n {\n if (empty($stagesIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($stagesIds as $stageId) {\n $stage = $team->stages()->where('id', $stageId)->first();\n\n if ($stage) {\n $data[] = [\n 'id' => $stage->getUuid(),\n 'name' => $stage->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformRecipients(array $recipients): array\n {\n $users = [];\n foreach ($recipients['users'] ?? [] as $userId) {\n $users[] = $this->transformUser($userId);\n }\n\n return $users;\n }\n\n private function transformCreator(?User $user): ?array\n {\n if ($user === null) {\n return null;\n }\n\n return $this->transformUser($user->getId());\n }\n\n private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array\n {\n if ($prompt === null) {\n return null;\n }\n\n return [\n 'id' => $prompt->getUuid(),\n 'name' => $prompt->getTitle(),\n ];\n }\n\n private function transformSafeSearch(?Search $search): ?array\n {\n if ($search === null) {\n return null;\n }\n\n return [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ];\n }\n\n private function transformUser(int $userId): array\n {\n /* @var ?User $user */\n $user = $this->userRepository->find($userId);\n\n return [\n 'id' => $user?->getUuid(),\n 'name' => $user?->getName(),\n 'email' => $user?->getEmailAddress(),\n 'photoUrl' => $user?->getPhotoUrl(),\n ];\n }\n\n public function create(array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $validatedData['created_by'] = auth()->id();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function update(string $uuid, array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $report = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $report) {\n throw new InvalidArgumentException('Report not found');\n }\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Create an Ask Jiminny report.\n */\n public function createAskJiminnyReport(array $data, User $creator): array\n {\n $validatedData = $this->validateAskJiminnyReportData($data, $creator);\n $validatedData['created_by'] = $creator->getId();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Update an Ask Jiminny report.\n */\n public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array\n {\n if (! $report->isAskJiminnyReport()) {\n throw new InvalidArgumentException('Report is not an Ask Jiminny report');\n }\n\n $validatedData = $this->validateAskJiminnyReportData($data, $user);\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array\n {\n $this->automatedReportsRepository->update($report, ['status' => $status]);\n\n return $this->transformReportFullView($report->fresh());\n }\n\n /**\n * Validate and transform data for Ask Jiminny reports.\n */\n private function validateAskJiminnyReportData(array $data, User $user): array\n {\n // Validate name\n $name = trim($data['report_name'] ?? '');\n if (empty($name)) {\n throw new InvalidArgumentException('Report name is required');\n }\n if (mb_strlen($name) > 50) {\n throw new InvalidArgumentException('Report name must be 50 characters or less');\n }\n\n // Validate frequency (only daily, weekly, monthly for Ask Jiminny)\n $frequency = $data['frequency'] ?? null;\n $askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];\n if (! in_array($frequency, $askJiminnyFrequencies, true)) {\n throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');\n }\n\n // Validate expiration date\n $expiresAt = $data['expires_on'] ?? null;\n if (empty($expiresAt)) {\n throw new InvalidArgumentException('Expiration date is required');\n }\n\n try {\n $expiresAtDate = Carbon::parse($expiresAt);\n } catch (InvalidFormatException $e) {\n throw new InvalidArgumentException('Expiration date format is invalid');\n }\n $maxExpiration = Carbon::now()->addYear()->endOfDay();\n if ($expiresAtDate->gt($maxExpiration)) {\n throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');\n }\n if ($expiresAtDate->isPast()) {\n throw new InvalidArgumentException('Expiration date cannot be in the past');\n }\n\n // Validate saved search\n $activitySearchId = $data['saved_search'] ?? null;\n if (empty($activitySearchId)) {\n throw new InvalidArgumentException('Saved search is required');\n }\n $savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);\n if (! $savedSearch) {\n throw new InvalidArgumentException('Saved search not found or does not belong to you');\n }\n\n // Validate saved prompt\n $askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;\n if (empty($askAnythingPromptId)) {\n throw new InvalidArgumentException('Ask Jiminny prompt is required');\n }\n $prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);\n if (! $prompt) {\n throw new InvalidArgumentException('Ask Jiminny prompt not found');\n }\n\n // Validate status\n $status = $data['enabled'] ?? false;\n\n $recipientUserIds = [$user->getId()];\n\n if (! empty($data['share_users'])) {\n $sharedUserIds = $this->validateAndGetUserIdsByTeam(\n $user->team,\n (array) $data['share_users']\n );\n $recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);\n }\n\n $sharedGroupIds = [];\n if (! empty($data['share_teams'])) {\n $sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);\n }\n\n $recipientUserIds = array_values(array_unique($recipientUserIds));\n\n return [\n 'team_id' => $user->getTeamId(),\n 'type' => self::TYPE_ASK_JIMINNY,\n 'status' => (bool) $status,\n 'frequency' => $frequency,\n 'custom_name' => $name,\n 'activity_search_id' => $savedSearch->getId(),\n 'ask_anything_prompt_id' => $prompt->getId(),\n 'expires_at' => $expiresAtDate->toDateString(),\n 'media_types' => [self::MEDIA_TYPE_PDF],\n 'call_types' => [],\n 'recipients' => ['users' => $recipientUserIds],\n 'groups' => $sharedGroupIds,\n ];\n }\n\n public static function getAskJiminnyFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::ASK_JIMINNY_FREQUENCIES);\n }\n\n public function getAskJiminnyReportFilters(User $user): array\n {\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n return [\n [\n 'id' => 'prompt',\n 'label' => 'Prompt',\n 'options' => $prompts,\n ],\n [\n 'id' => 'saved_search',\n 'label' => 'Saved Search',\n 'options' => $savedSearches,\n ],\n ];\n }\n\n public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array\n {\n $team = $user->getTeam();\n $userTimezone = $user->getTimezone();\n\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n $teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ])->values()->all();\n\n $shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];\n\n $sharedTeamsValue = [];\n $sharedUsersValue = [];\n if ($report) {\n $sharedTeamsValue = $this->transformGroups($team, $report->getGroups());\n\n $recipientUserIds = $report->getRecipients()['users'] ?? [];\n $creatorId = $report->getAttribute('created_by');\n $sharedUserIds = array_values(array_filter(\n $recipientUserIds,\n static fn ($id) => $id !== $creatorId\n ));\n $sharedUsersValue = collect($sharedUserIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (User $u) => [\n 'id' => $u->getUuid(),\n 'name' => $u->getName(),\n ])\n ->values()\n ->all();\n }\n\n return [\n 'fields' => [\n [\n 'id' => 'enabled',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'label' => '',\n 'value' => $report?->getStatus() ?? false,\n ],\n [\n 'id' => 'report_name',\n 'inputType' => InputTypeEnum::TEXT,\n 'label' => 'Name',\n 'placeholder' => 'Enter name',\n 'required' => true,\n 'validation' => ['maxLength' => 50],\n 'value' => $report?->getCustomName() ?? '',\n ],\n [\n 'id' => 'frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Frequency',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::ASK_JIMINNY_FREQUENCIES,\n 'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,\n ],\n [\n 'id' => 'expires_on',\n 'inputType' => InputTypeEnum::DATE,\n 'label' => 'Expires on',\n 'required' => true,\n 'placeholder' => 'Select',\n 'validation' => [\n 'minDate' => now($userTimezone)->toDateString(),\n 'maxDate' => now($userTimezone)->addYear()->toDateString(),\n ],\n 'value' => $report?->getExpiresAt()?->toDateString(),\n ],\n [\n 'id' => 'share_teams',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team',\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $teamGroups,\n 'value' => $sharedTeamsValue,\n ],\n [\n 'id' => 'share_users',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team member',\n 'required' => false,\n 'placeholder' => 'Select',\n 'groupLabelKey' => 'label',\n 'groupValuesKey' => 'users',\n 'optionLabelKey' => 'name',\n 'optionValueKey' => 'id',\n 'options' => $shareUsers,\n 'value' => $sharedUsersValue,\n ],\n [\n 'id' => 'saved_search',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Saved search',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $savedSearches,\n 'value' => $report && $report->getSavedSearch() ? [\n 'id' => $report->getSavedSearch()->getUuid(),\n 'name' => $report->getSavedSearch()->getName(),\n ] : null,\n ],\n [\n 'id' => 'ask_jiminny_prompt',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Ask Jiminny prompt',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $prompts,\n 'value' => $report && $report->getAskAnythingPrompt() ? [\n 'id' => $report->getAskAnythingPrompt()->getUuid(),\n 'name' => $report->getAskAnythingPrompt()->getTitle(),\n ] : null,\n ],\n ],\n ];\n }\n\n private function updateResultNames(AutomatedReport $automatedReport): void\n {\n $results = $this->automatedReportsRepository->getResultsByReport($automatedReport);\n\n foreach ($results as $result) {\n $result->update(['name' => $this->getReportFileName($result)]);\n }\n }\n\n public function updateStatus(string $uuid, array $data): array\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $automatedReport->update([\n 'status' => $status,\n ]);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n private function generateOneOffReport(AutomatedReport $automatedReport): void\n {\n // the scheduler handles all the other frequency types\n if ($automatedReport->getStatus() === false || $automatedReport->getFrequency() !== self::FREQUENCY_ONE_OFF) {\n return;\n }\n\n $this->dispatcher->dispatch(new RequestGenerateReportJob($automatedReport->getUuid()));\n }\n\n public function getReport(string $uuid): AutomatedReport\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n return $automatedReport;\n }\n\n public function get(string $uuid): array\n {\n $automatedReport = $this->getReport($uuid);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function list(string $sortColumn = 'created_at', string $sortDirection = 'desc'): array\n {\n $results = [];\n $collection = $this->automatedReportsRepository->getAllStandardReports($sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function listAskJiminnyReports(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): array {\n $results = [];\n $collection = $this->automatedReportsRepository->getAskJiminnyReportsByUser($user, $sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function delete(string $uuid): void\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $automatedReport->delete();\n }\n\n public function createReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n return $this->automatedReportsRepository->createResult(\n array_merge(\n [\n 'report_id' => $automatedReport->getId(),\n 'status' => AutomatedReportResult::STATUS_DEFAULT,\n ],\n $data\n )\n );\n }\n\n public function getOrCreateReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n $existing = $this->automatedReportsRepository->findLatestDefaultOrFailedResult($automatedReport);\n\n if ($existing !== null) {\n $existing->update(['status' => AutomatedReportResult::STATUS_DEFAULT]);\n\n return $existing;\n }\n\n return $this->createReportResult($automatedReport, $data);\n }\n\n public function getReportResult(string $resultUuid): AutomatedReportResult\n {\n $report = $this->automatedReportsRepository->findResultByUuid($resultUuid);\n\n if (! $report) {\n throw new ModelNotFoundException('Report Result not found');\n }\n\n return $report;\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return $this->automatedReportsRepository->findChildResult($result, $type);\n }\n\n // prophet API calls\n /**\n * @throws ApplicationException\n */\n public function getGenerateReportPayload(AutomatedReport $automatedReport, string $reportResultUuid): array\n {\n $period = $this->calculateFromAndToDate($automatedReport);\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n return [\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResultUuid,\n 'report_type' => $automatedReport->getType(),\n 'media_types' => $automatedReport->getMediaTypes(),\n 'from_date' => $fromDate->startOfDay()->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->endOfDay()->format(DateTimeInterface::RFC3339),\n 'group_ids' => $automatedReport->getGroups(),\n 'call_deal_stage' => $automatedReport->getDealAtCallStages(),\n 'current_deal_stage' => $automatedReport->getCurrentDealStages(),\n 'deal_min_value' => $automatedReport->getDealValueMin(),\n 'deal_max_value' => $automatedReport->getDealValueMax(),\n 'call_types' => $automatedReport->getCallTypes(),\n 'call_duration_min_seconds' => $automatedReport->getCallDurationMin(),\n 'call_duration_max_seconds' => $automatedReport->getCallDurationMax(),\n 'special_requirements' => $automatedReport->getAdditionalPromptInput(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->formatReportPeriodName(\n $automatedReport->getFrequency(),\n $fromDate,\n $toDate,\n ),\n 'playbook_categories' => $automatedReport->getPlaybookCategories(),\n 'custom_name' => $automatedReport->getCustomName(),\n ];\n }\n\n // $inputPayload - FE payload structure\n public function getActivitiesCountPayload(array $inputPayload): array\n {\n // Use validateAndTransformData to validate and normalize input\n $validatedData = $this->validateAndTransformData($inputPayload);\n $period = $this->calculateFromAndToDatePeriod(\n $validatedData['frequency'],\n Carbon::parse($validatedData['from']),\n Carbon::parse($validatedData['to']),\n );\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n // Create payload similar to getGenerateReportPayload\n return [\n 'team_id' => $validatedData['team_id'],\n 'group_ids' => $validatedData['groups'] ?? [],\n 'report_type' => $validatedData['type'],\n 'from_date' => $fromDate->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->format(DateTimeInterface::RFC3339),\n 'call_deal_stage' => $validatedData['deal_at_call_stages'] ?? [],\n 'current_deal_stage' => $validatedData['current_deal_stages'] ?? [],\n 'deal_min_value' => $validatedData['deal_value_min'] ?? null,\n 'deal_max_value' => $validatedData['deal_value_max'] ?? null,\n 'call_types' => $validatedData['call_types'],\n 'call_duration_min_seconds' => $validatedData['call_duration_min'] ?? null,\n 'call_duration_max_seconds' => $validatedData['call_duration_max'] ?? null,\n 'special_requirements' => $validatedData['additional_prompt_input'] ?? null,\n 'playbook_categories' => $validatedData['playbook_categories'] ?? [],\n 'request_id' => null,\n 'callback_url' => null,\n ];\n }\n\n public function shouldSendReport(array $users, ?CarbonInterface $generatedAt = null): bool\n {\n if (empty($users)) {\n return false;\n }\n\n $earliestTz = collect($users)\n ->mapWithKeys(function (array $user) {\n $tz = new DateTimeZone($user['timezone']);\n $nowUtc = new DateTime('now', new DateTimeZone('UTC'));\n $offset = $tz->getOffset($nowUtc);\n\n return [$user['timezone'] => $offset];\n })\n ->sortDesc()\n ->keys()\n ->first();\n\n $now = Carbon::now($earliestTz);\n $isScheduledTime = (int) $now->format('H') === self::SENT_REPORT_AT_HOURS;\n\n if ($isScheduledTime) {\n return true;\n }\n\n return $this->hasPassedScheduledTime($generatedAt, $earliestTz);\n }\n\n public function hasPassedScheduledTime(?CarbonInterface $generatedAt, string $timezone): bool\n {\n if ($generatedAt === null) {\n return false;\n }\n\n $now = Carbon::now($timezone);\n $scheduledTime = $now->copy()->setTime(self::SENT_REPORT_AT_HOURS, 0, 0);\n\n if ($now->hour < self::SENT_REPORT_AT_HOURS) {\n $scheduledTime = $scheduledTime->subDay();\n }\n\n $scheduledTimeUtc = $scheduledTime->copy()->utc();\n $generatedAtUtc = $generatedAt->copy()->utc();\n $nowUtc = $now->copy()->utc();\n\n return $generatedAtUtc->lt($scheduledTimeUtc) && $nowUtc->gt($scheduledTimeUtc);\n }\n\n public function calculateFromAndToDatePeriod(\n string $frequency,\n ?Carbon $fromDate = null,\n ?Carbon $toDate = null\n ): array {\n if ($frequency === self::FREQUENCY_ONE_OFF) {\n return [\n 'fromDate' => $fromDate,\n 'toDate' => $toDate,\n ];\n }\n\n $now = Carbon::now();\n\n return match ($frequency) {\n self::FREQUENCY_DAILY => [\n 'fromDate' => $now->copy()->subDay()->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_WEEKLY => [\n 'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_MONTHLY => [\n 'fromDate' => $now->copy()->subMonths(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_QUARTERLY => [\n 'fromDate' => $now->copy()->subMonths(3)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n default => throw new InvalidArgumentException(\"Unsupported frequency: {$frequency}\"),\n };\n }\n\n private function calculateFromAndToDate(AutomatedReport $automatedReport): array\n {\n return $this->calculateFromAndToDatePeriod(\n $automatedReport->getFrequency(),\n $automatedReport->getFrom(),\n $automatedReport->getTo()\n );\n }\n\n public function getAskJiminnyGenerateReportPayload(\n AutomatedReport $automatedReport,\n AutomatedReportResult $reportResult,\n array $activityIds,\n ): array {\n return [\n 'user_question' => $automatedReport->getAskAnythingPrompt()?->getContent(),\n 'call_ids' => array_map('strval', $activityIds),\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResult->getUuid(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->getReportPeriodName($reportResult),\n 'report_name' => $automatedReport->getCustomName(),\n ];\n }\n\n private function getCallbackUrl(): string\n {\n return $this->webhookService->route('jiminny.webhook.reports.ready');\n }\n\n /**\n * Validate and transform payload data for automated reports\n *\n * @param array $data\n *\n * @throws InvalidArgumentException\n *\n * @return array\n */\n private function validateAndTransformData(array $data): array\n {\n // Validate organization (team) and check feature\n $team = $this->validateOrganization($data['organization'] ?? null);\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $type = $this->validateReportType($data['report_type'] ?? null);\n $frequency = $this->validateFrequency($data['frequency'] ?? null);\n $additionalPromptInput = $this->validateAdditionalPromptInput(\n $data['additional_prompt_input'] ?? null\n );\n $customReportName = $this->validateCustomReportName($data['custom_name'] ?? null);\n\n // Prepare data for the database\n $reportData = [\n 'team_id' => $team->getId(),\n 'type' => $type,\n 'status' => $status,\n 'frequency' => $frequency,\n 'additional_prompt_input' => $additionalPromptInput,\n 'custom_name' => $customReportName,\n ];\n\n // Validate deal values\n $reportData = $this->validateDealValues($data, $reportData);\n\n // Validate date range\n $reportData = $this->validateDateRange($data, $reportData, $frequency);\n\n // Validate call durations\n $reportData = $this->validateCallDurations($data, $reportData);\n\n // Validate call types\n $reportData = $this->validateCallTypes($data, $reportData);\n\n // Validate media types\n $reportData = $this->validateMediaTypes($data, $reportData);\n\n // Validate groups\n if (isset($data['teams'])) {\n $reportData['groups'] = $this->validateAndGetGroupIds($team, $data['teams']);\n }\n\n // Validate deal stages\n $reportData = $this->validateDealStages($data, $reportData, $team, $type);\n\n // Validate playbook categories\n $reportData = $this->validatePlaybookCategories($data, $reportData, $team);\n\n // Validate recipients\n $reportData['recipients'] = [\n 'users' => $this->validateAndGetUserIdsByTeam($team, $data['recipients'] ?? []),\n ];\n\n if (isset($data['jiminny_recipients'])) {\n // Validate Jiminny recipients\n $reportData['jiminny_recipients'] = [\n 'users' => $this->validateAndGetJiminnyUserIds((array) $data['jiminny_recipients']),\n ];\n }\n\n return $reportData;\n }\n\n private function validateDealValues(array $data, array $reportData): array\n {\n if (isset($data['min_deal_value'])) {\n $reportData['deal_value_min'] = (int) $data['min_deal_value'];\n\n if ($reportData['deal_value_min'] > 4294967295 || $reportData['deal_value_min'] < 0) {\n throw new InvalidArgumentException('Min deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_deal_value'])) {\n $reportData['deal_value_max'] = (int) $data['max_deal_value'];\n\n if ($reportData['deal_value_max'] > 4294967295 || $reportData['deal_value_max'] < 0) {\n throw new InvalidArgumentException('Max deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['min_deal_value'], $data['max_deal_value'])\n && $data['min_deal_value'] > $data['max_deal_value']\n ) {\n throw new InvalidArgumentException('Min deal value cannot be greater than max deal value');\n }\n\n return $reportData;\n }\n\n private function validateDateRange(array $data, array $reportData, string $frequency): array\n {\n // Set date range only for one_off frequency\n if ($frequency === 'one_off') {\n if (isset($data['start_date_period'])) {\n $reportData['from'] = $this->parseDate($data['start_date_period']);\n }\n\n if (isset($data['end_date_period'])) {\n $reportData['to'] = $this->parseDate($data['end_date_period']);\n }\n\n if (empty($reportData['from']) || empty($reportData['to'])) {\n throw new InvalidArgumentException(\n 'Start date and end date are required for one_off frequency'\n );\n }\n } else {\n $reportData['from'] = null;\n $reportData['to'] = null;\n }\n\n return $reportData;\n }\n\n private function validateCallDurations(array $data, array $reportData): array\n {\n // Convert call durations from minutes to seconds\n if (isset($data['min_call_duration'])) {\n $reportData['call_duration_min'] = (int) $data['min_call_duration'] * 60;\n\n if ($reportData['call_duration_min'] > 4294967295 || $reportData['call_duration_min'] < 0) {\n throw new InvalidArgumentException('Min call duration should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_call_duration'])) {\n $reportData['call_duration_max'] = (int) $data['max_call_duration'] * 60;\n\n if ($reportData['call_duration_max'] > 4294967295 || $reportData['call_duration_max'] < 0) {\n throw new InvalidArgumentException('Max call duration should be between 0 and 4294967295');\n }\n }\n\n return $reportData;\n }\n\n private function validateCallTypes(array $data, array $reportData): array\n {\n // Set call types\n $reportData['call_types'] = $data['call_type'] ?? [];\n if (empty($reportData['call_types'])) {\n $reportData['call_types'] = self::getCallTypes();\n }\n\n foreach ($reportData['call_types'] as $callType) {\n if (! in_array($callType, self::getCallTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Call type %s is invalid', $callType));\n }\n }\n\n return $reportData;\n }\n\n private function validateMediaTypes(array $data, array $reportData): array\n {\n // Set media types from input data\n $reportData['media_types'] = $data['media_types'] ?? [];\n\n if (empty($reportData['media_types'])) {\n throw new InvalidArgumentException('Media types are required');\n }\n\n foreach ($reportData['media_types'] as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n throw new InvalidArgumentException(sprintf('Media type %s is invalid', $mediaType));\n }\n }\n\n return $reportData;\n }\n\n private function validateDealStages(array $data, array $reportData, Team $team, string $reportType): array\n {\n // Validate and set deal stages\n if (isset($data['deal_stage_at_call'])) {\n $reportData['deal_at_call_stages'] =\n $this->validateAndGetDealStageIds($team, $data['deal_stage_at_call'], 'Deal stage at call');\n }\n\n if (isset($data['current_deal_stage'])) {\n $reportData['current_deal_stages'] =\n $this->validateAndGetDealStageIds($team, $data['current_deal_stage'], 'Current deal stage');\n }\n\n // Ensure current_deal_stage is not provided for loss_analysis report type\n if ($reportType === self::TYPE_LOSS_ANALYSIS && ! empty($data['current_deal_stage'])) {\n throw new InvalidArgumentException('Current deal stage is not applicable for Loss Analysis reports');\n }\n\n return $reportData;\n }\n\n // transform uuid to id\n private function validatePlaybookCategories(array $data, array $reportData, Team $team): array\n {\n $key = 'playbook_categories';\n\n if (isset($data[$key])) {\n $payloadIds = $data[$key];\n $ids = [];\n\n foreach ($payloadIds as $uuid) {\n $uuid = (string) $uuid;\n\n try {\n $playbookCategory = $this->playbookCategoryRepository->findByUuid($uuid);\n } catch (Throwable $throwable) {\n Log::error(__METHOD__ . ' ' . $throwable->getMessage());\n\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory) {\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory->hasPlaybook()) {\n throw new InvalidArgumentException(sprintf('Playbook category %s has no playbook', $uuid));\n }\n\n if ($playbookCategory->getPlaybook()->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Playbook category %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $ids[] = $playbookCategory->getId();\n }\n\n $reportData[$key] = $ids;\n }\n\n return $reportData;\n }\n\n private function validateReportStatus($status): bool\n {\n if (! in_array($status, [true, false], true)) {\n throw new InvalidArgumentException('Report status is invalid');\n }\n\n return $status;\n }\n\n private function validateReportType($type): string\n {\n if (! in_array($type, self::getTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Report type is invalid: %s', $type));\n }\n\n return $type;\n }\n\n private function validateFrequency($frequency): string\n {\n if (! in_array($frequency, self::getFrequencies(), true)) {\n throw new InvalidArgumentException('Frequency is invalid');\n }\n\n return $frequency;\n }\n\n private function validateAdditionalPromptInput(?string $additionalPromptInput): ?string\n {\n if ($additionalPromptInput && strlen($additionalPromptInput) > 5000) {\n throw new InvalidArgumentException('Additional Prompt Input should be less than 5000 characters');\n }\n\n return $additionalPromptInput;\n }\n\n private function validateCustomReportName(?string $customReportName): ?string\n {\n if ($customReportName === null || $customReportName === '') {\n return null;\n }\n\n if (strlen($customReportName) > 70) {\n throw new InvalidArgumentException('Custom report name should be less than 70 characters');\n }\n\n return $customReportName;\n }\n\n private function validateOrganization(?string $organizationUuid): Team\n {\n if (! $organizationUuid) {\n throw new InvalidArgumentException('Organization is required');\n }\n\n $team = $this->teamRepository->idOrUuid($organizationUuid);\n\n if (! $team) {\n throw new InvalidArgumentException('Organization not found');\n }\n\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n throw new InvalidArgumentException('Organization does not have the Automated Reports feature');\n }\n\n return $team;\n }\n\n private function validateAndGetGroupIds(Team $team, array $teamUuids): array\n {\n $groupIds = [];\n\n foreach ($teamUuids as $uuid) {\n $group = $this->groupRepository->findByUuid($uuid);\n\n if ($group === null || $group->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Group %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $groupIds[] = $group->getId();\n\n }\n\n return $groupIds;\n }\n\n private function validateAndGetDealStageIds(Team $team, array $stageUuids, string $propertyLabel): array\n {\n $stageIds = [];\n\n foreach ($stageUuids as $uuid) {\n $stage = $this->stageRepository->findByUuid($uuid);\n\n if ($stage === null || $stage->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Stage %s not found for team %s for %s', $uuid, $team->getUuid(), $propertyLabel)\n );\n }\n\n $stageIds[] = $stage->getId();\n }\n\n return $stageIds;\n }\n\n private function validateAndGetUserIds(array $userUuids, callable $teamCheck): array\n {\n if (empty($userUuids)) {\n return [];\n }\n\n $userIds = [];\n\n foreach ($userUuids as $uuid) {\n $user = $this->userRepository->findByUuid($uuid);\n\n if (! $user || ! $user->isStatusActive()) {\n throw new InvalidArgumentException(\n sprintf('User %s not found or is not active', $uuid)\n );\n }\n\n if (! $teamCheck($user)) {\n throw new InvalidArgumentException(\n sprintf('User %s does not belong to the allowed team(s)', $uuid)\n );\n }\n\n $userIds[] = $user->getId();\n }\n\n return $userIds;\n }\n\n private function validateAndGetUserIdsByTeam(Team $team, array $userUuids): array\n {\n return $this->validateAndGetUserIds($userUuids, fn ($user) => $user->getTeamId() === $team->getId());\n }\n\n private function validateAndGetJiminnyUserIds(array $userUuids): array\n {\n $allowedTeamIds = config('kiosk.teamIds', []);\n\n return $this->validateAndGetUserIds($userUuids, fn ($user) => in_array($user->getTeamId(), $allowedTeamIds, true));\n }\n\n private function parseDate(string $dateString): string\n {\n return date('Y-m-d H:i:s', strtotime($dateString));\n }\n\n private function generateReportResultViewUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.view', ['uuid' => $result->getUuid()]);\n }\n\n private function generateReportResultDownloadUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.download', ['uuid' => $result->getUuid()]);\n }\n\n private function getReportMediaRouteResource(AutomatedReportResult $result): string\n {\n if ($result->getMediaType() === self::MEDIA_TYPE_PDF) {\n return self::PDF_KEY;\n } elseif ($result->getMediaType() === self::MEDIA_TYPE_PODCAST) {\n return self::AUDIO_KEY;\n }\n\n throw new \\InvalidArgumentException('Unknown media type.');\n }\n\n public function getMediaPath(AutomatedReportResult $result): ?string\n {\n $url = match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => $result->getPdfUrl(),\n self::MEDIA_TYPE_PODCAST => $result->getPodcastAudioUrl(),\n default => null,\n };\n\n if ($url === null) {\n return null;\n }\n\n $path = parse_url(trim($url, '\"\\''), PHP_URL_PATH);\n\n return $path ?: null;\n }\n\n public function getFilenameSuffix(AutomatedReportResult $result): ?string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => 'Podcast',\n default => null,\n };\n }\n\n public function getMailSubjectSuffix(AutomatedReportResult $result): string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => 'report',\n self::MEDIA_TYPE_PODCAST => 'podcast',\n default => '',\n };\n }\n\n public function getMediaTypeMetadata(AutomatedReportResult $result): array\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => ['extension' => 'mp3', 'mime' => 'audio/mpeg'],\n self::MEDIA_TYPE_PDF => ['extension' => 'pdf', 'mime' => 'application/pdf'],\n default => ['extension' => null, 'mime' => null],\n };\n }\n\n public function deleteS3Files(AutomatedReportResult $result): void\n {\n $teamUuid = $result->getReport()->getTeam()->getUuid();\n $reportUuid = $result->getUuid();\n\n // delete all files for a report uuid no mather of pdf, podcast, or both\n // in case of both - the podcast files are linked to the pdf (parent) uuid\n // pdf and podcast date times should be close\n $path = sprintf('%s/%s/%s', $teamUuid, self::S3_DIR, $reportUuid);\n\n foreach (self::FILE_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted S3 file', [\n 'path' => $file,\n ]);\n }\n }\n\n foreach (self::FILE_PODCAST_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '_podcast.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted Podcast S3 file', [\n 'path' => $file,\n ]);\n }\n }\n }\n\n /**\n *\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): Collection\n {\n return $this->automatedReportsRepository->getTeamIdsWithReportsResults($teamId);\n }\n\n /**\n * Core delete logic for report results using a query\n *\n * @param Builder $query\n * @param array $logContext\n *\n * @return int\n */\n private function deleteReportResultsByQuery(Builder $query, array $logContext = []): int\n {\n $deletedCount = 0;\n\n if ($query->exists()) {\n Log::info(\n 'Run delete report results',\n array_merge(\n $logContext,\n [\n 'service' => 'AutomatedReportsService',\n ]\n )\n );\n\n $query->chunkById(50, function ($results) use (&$deletedCount, $logContext) {\n foreach ($results as $result) {\n $this->deleteReportResult($result);\n $deletedCount++;\n\n Log::info(\n 'Deleted a report result',\n array_merge(\n $logContext,\n [\n 'result_id' => $result->getId(),\n 'report_id' => $result->getReportId(),\n ]\n )\n );\n }\n });\n }\n\n return $deletedCount;\n }\n\n /**\n * Delete report results for a team by retention period\n *\n * @param Team $team\n * @param CarbonImmutable $retentionDate\n *\n * @return int Number of deleted report results\n */\n public function deleteReportsResultsInRetentionPeriod(Team $team, CarbonImmutable $retentionDate): int\n {\n $reportIds = $this->automatedReportsRepository->getReportIdsByTeam($team);\n\n if ($reportIds->isEmpty()) {\n return 0;\n }\n\n $query = $this->automatedReportsRepository\n ->getReportResultsQueryForRetention($team, $retentionDate);\n\n return $this->deleteReportResultsByQuery($query, [\n 'team_id' => $team->getId(),\n 'retention_date' => $retentionDate->toDateTimeString(),\n ]);\n }\n\n /**\n * Delete ALL report results for a specific automated report\n *\n * @param string $uuid\n *\n * @return int\n */\n public function deleteReportResults(string $uuid): int\n {\n $report = $this->getReport($uuid);\n\n $query = $this->automatedReportsRepository->getResultsByReportQuery($report);\n\n return $this->deleteReportResultsByQuery($query, [\n 'report_uuid' => $uuid,\n 'report_id' => $report->getId(),\n ]);\n }\n\n public function deleteReportResult(AutomatedReportResult $result): void\n {\n $this->deleteS3Files($result);\n\n $result->delete();\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getTeamReports(Team $team): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getReportsByTeam($team);\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getReportResults(AutomatedReport $report): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getResultsByReport($report);\n }\n\n public function deleteAllReportResults(AutomatedReport $report): void\n {\n $results = $this->getReportResults($report);\n\n /** @var AutomatedReportResult $result */\n foreach ($results as $result) {\n Log::info('Deleting result', [\n 'report' => $report->getId(),\n 'result' => $result->getId(),\n ]);\n\n $this->deleteReportResult($result);\n }\n }\n\n public function deleteAllData(Team $team): void\n {\n Log::info('Deleting automated report and results for team', [\n 'team' => $team->getId(),\n ]);\n\n $reports = $this->getTeamReports($team);\n\n /** @var AutomatedReport $report */\n foreach ($reports as $report) {\n Log::info('Deleting report', [\n 'team' => $team->getId(),\n 'report' => $report->getId(),\n ]);\n\n $this->deleteAllReportResults($report);\n\n $report->delete();\n }\n }\n}","depth":4,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Kiosk\\AutomatedReports;\n\nuse Carbon\\CarbonImmutable;\nuse Carbon\\CarbonInterface;\nuse Carbon\\Exceptions\\InvalidFormatException;\nuse DateTime;\nuse DateTimeInterface;\nuse DateTimeZone;\nuse Illuminate\\Contracts\\Bus\\Dispatcher as BusDispatcher;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Support\\Facades\\Log;\nuse Illuminate\\Support\\Facades\\Storage;\nuse Jiminny\\Component\\ActivitySearch\\FilterDefinition\\InputTypeEnum;\nuse Jiminny\\Component\\AskAnything\\AskAnythingPromptService;\nuse Jiminny\\Component\\AskAnything\\Dtos\\AskAnythingPromptDto;\nuse Jiminny\\Component\\UrlGenerator\\Webhook;\nuse Jiminny\\Contracts\\Repositories\\PlaybookCategoryRepository;\nuse Jiminny\\Contracts\\Repositories\\TeamRepository;\nuse Jiminny\\Contracts\\Repositories\\UserRepository;\nuse Jiminny\\Exceptions\\ApplicationException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Exceptions\\ModelNotFoundException;\nuse Jiminny\\Jobs\\AutomatedReports\\RequestGenerateReportJob;\nuse Jiminny\\Models\\Activity\\Search;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPrompt;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPromptTarget;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Contracts\\UserContract;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Repositories\\AskAnythingRepository;\nuse Jiminny\\Repositories\\AutomatedReportsRepository;\nuse Jiminny\\Repositories\\GroupRepository;\nuse Jiminny\\Repositories\\SearchRepository;\nuse Jiminny\\Repositories\\StageRepository;\nuse Throwable;\n\nclass AutomatedReportsService\n{\n public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';\n public const string TYPE_ASK_JIMINNY = 'ask_jiminny';\n\n /**\n * Standard report types (used by kiosk for existing automated reports).\n */\n // @TODO this will add filter, however if we need to control feature by FF we need conditional logic\n public const array TYPES = [\n ['id' => 'exec_summary', 'name' => 'Exec Summary'],\n ['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],\n ['id' => 'product_feedback', 'name' => 'Product Feedback'],\n ['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],\n// ['id' => 'questions', 'name' => 'Questions'],\n// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],\n ];\n\n public const array ALL_TYPES = [\n ...self::TYPES,\n ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],\n ];\n\n public const string FREQUENCY_DAILY = 'daily';\n public const string FREQUENCY_WEEKLY = 'weekly';\n public const string FREQUENCY_MONTHLY = 'monthly';\n public const string FREQUENCY_QUARTERLY = 'quarterly';\n public const string FREQUENCY_ONE_OFF = 'one_off';\n\n /**\n * Frequencies for standard (non-Ask Jiminny) reports.\n */\n public const array FREQUENCIES = [\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n\n /**\n * Frequencies for Ask Jiminny reports.\n */\n public const array ASK_JIMINNY_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ];\n\n public const string MEDIA_TYPE_PDF = 'pdf';\n public const string MEDIA_TYPE_PODCAST = 'podcast';\n public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];\n public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];\n public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];\n public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];\n\n public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];\n public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];\n public const int SENT_REPORT_AT_HOURS = 5;\n public const string PDF_KEY = 'pdf';\n public const string AUDIO_KEY = 'audio';\n\n private const array ALL_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n private const string S3_DIR = 'reports';\n private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];\n private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];\n\n public function __construct(\n private readonly TeamRepository $teamRepository,\n private readonly GroupRepository $groupRepository,\n private readonly UserRepository $userRepository,\n private readonly StageRepository $stageRepository,\n private readonly DealStagesService $dealStagesService,\n private readonly RecipientsService $recipientsService,\n private readonly AutomatedReportsRepository $automatedReportsRepository,\n private readonly Webhook $webhookService,\n private readonly BusDispatcher $dispatcher,\n private readonly ActivityTypeService $activityTypeService,\n private readonly PlaybookCategoryRepository $playbookCategoryRepository,\n private readonly AskAnythingPromptService $askAnythingPromptService,\n private readonly SearchRepository $activitySearchRepository,\n private readonly AskAnythingRepository $askAnythingRepository,\n ) {\n }\n\n public static function getTypes(): array\n {\n $types = self::TYPES;\n\n return array_map(static function ($type) {\n return $type['id'];\n }, $types);\n }\n\n public static function getCallTypes(): array\n {\n return array_map(static function ($callType) {\n return $callType['id'];\n }, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);\n }\n\n public static function getFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::FREQUENCIES);\n }\n\n // front-facing structure\n public function getReportEnabledFieldData(bool $value = false): array\n {\n return [\n 'id' => 'report_enabled',\n 'label' => '',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'value' => $value,\n ];\n }\n\n // Organizations = Teams\n public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array\n {\n $options = $this->getTeams();\n\n if ($shortVersion) {\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value,\n 'dependencies' => [\n 'teams',\n 'deal_stage_at_call',\n 'current_deal_stage',\n 'recipients',\n ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,\n ],\n 'dependsOn' => [],\n ];\n }\n\n // Teams = Groups\n public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array\n {\n if ($shortVersion) {\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value, // value should be an array of objects {id, name}\n 'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],\n 'dependsOn' => [],\n ];\n }\n\n public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array\n {\n $types = [];\n if ($team instanceof Team) {\n if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n $types = self::TYPES;\n }\n if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {\n $types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];\n }\n } else {\n $types = self::TYPES;\n }\n\n if ($shortVersion) {\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'options' => $types,\n ];\n }\n\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $types,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getFrequencyFieldData(?string $value = null): array\n {\n return [\n 'id' => 'frequency',\n 'label' => 'Frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::FREQUENCIES,\n 'value' => $value,\n 'dependencies' => ['period'],\n 'dependsOn' => [],\n ];\n }\n\n public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array\n {\n return [\n 'id' => 'period',\n 'label' => 'Select one-off period',\n 'inputType' => InputTypeEnum::DATE_RANGE,\n 'required' => true,\n 'placeholder' => 'Select',\n 'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],\n 'queryParams' => [\n 'startDate' => 'start_date_period',\n 'endDate' => 'end_date_period',\n ],\n 'dependencies' => [],\n 'dependsOn' => ['frequency'],\n ];\n }\n\n public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array\n {\n return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);\n }\n\n public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);\n }\n\n public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);\n }\n\n public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'deal_value',\n 'label' => 'Deal Value',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_deal_value',\n 'max' => 'max_deal_value',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array\n {\n $value = [];\n $conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;\n $dialerOn && $value[] = self::CALL_TYPE_DIALER;\n\n return [\n 'id' => 'call_type',\n 'label' => 'Call Type',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => [\n self::CALL_TYPE_CONFERENCE,\n self::CALL_TYPE_DIALER,\n ],\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getMediaTypeFieldData(?AutomatedReport $report = null): array\n {\n $value = [];\n\n if ($report) {\n $value = $this->transformMediaTypes($report);\n }\n\n return [\n 'id' => 'media_types',\n 'label' => 'Export as',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => self::MEDIA_TYPE_OBJECTS,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'call_duration',\n 'label' => 'Call Duration',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_call_duration',\n 'max' => 'max_call_duration',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getRecipientsFieldData(?Team $team = null, array $value = []): array\n {\n return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);\n }\n\n public function getJiminnyRecipientsFieldData(array $value = []): array\n {\n return $this->recipientsService->getJiminnyRecipientsFieldData($value);\n }\n\n public function getAdditionalPromptInputFieldData(?string $value = null): array\n {\n return [\n 'id' => 'additional_prompt_input',\n 'label' => 'Special requirements',\n 'inputType' => InputTypeEnum::TEXTAREA,\n 'required' => false,\n 'placeholder' => 'What should be the focus of the report?',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCustomReportNameFieldData(?string $value = null): array\n {\n return [\n 'id' => 'custom_name',\n 'label' => 'Custom report name',\n 'inputType' => InputTypeEnum::TEXT,\n 'required' => false,\n 'placeholder' => 'Enter custom name',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n // data providers\n public function getTeams(): array\n {\n $teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);\n\n $teamData = [];\n foreach ($teams as $team) {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n continue;\n }\n\n $teamData[] = $this->transformTeam($team);\n }\n\n return $teamData;\n }\n\n public function getTeamGroups(string $teamUuid): array\n {\n $data = [];\n $team = $this->getTeam($teamUuid);\n\n if ($team !== null) {\n $groups = $team->groups()->get();\n\n foreach ($groups as $group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n public function getTeamsGroupsOptions(array $filterTeamUuids = []): array\n {\n $data = [];\n $teams = $this->getTeams();\n\n foreach ($teams as $team) {\n if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {\n continue;\n }\n\n $data[] = [\n 'label' => $team['name'],\n 'groups' => $this->getTeamGroups($team['id']),\n ];\n }\n\n return $data;\n }\n\n public function getTeam(string $teamUuid): ?Team\n {\n return $this->teamRepository->idOrUuid($teamUuid);\n }\n\n public function getTeamById(int $teamId): ?Team\n {\n return $this->teamRepository->find($teamId);\n }\n\n public function getGroupsUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportGroups = $report->getGroups();\n foreach ($reportGroups as $groupId) {\n if ($group = $this->groupRepository->find($groupId)) {\n $uuids[] = $group->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getPlaybookCategoriesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $playbookCategories = $report->getPlaybookCategories();\n foreach ($playbookCategories as $id) {\n if ($category = $this->playbookCategoryRepository->find($id)) {\n $uuids[] = $category->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getDealAtCallStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getDealAtCallStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getCurrentDealStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getCurrentDealStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getRecipients());\n }\n\n public function getJiminnyUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function extractUserUuids(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => $user->getUuid())\n ->values()\n ->all();\n }\n\n // get mail data\n public function getRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getRecipients());\n }\n\n /**\n * @return array<UserContract>\n */\n public function getRecipientUserObjects(AutomatedReport $report): array\n {\n $userIds = $report->getRecipients()['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->values()\n ->all();\n }\n\n private function getJiminnyRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function buildRecipientUsers(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => [\n 'email' => $user->getEmailAddress(),\n 'name' => $user->getName(),\n 'timezone' => $user->getTimezone()->getName(),\n ])\n ->values()\n ->all();\n }\n\n public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array\n {\n if ($report->isAskJiminnyReport()) {\n $recipients = $this->resolveAskJiminnyRecipients($report);\n } else {\n $recipients = $this->getRecipientUsers($report);\n if ($includeJiminny) {\n $recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));\n }\n }\n\n $emails = [];\n\n return array_values(array_filter(\n $recipients,\n static function ($recipient) use (&$emails) {\n if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {\n return false;\n }\n $emails[] = $recipient['email'];\n\n return true;\n }\n ));\n }\n\n private function resolveAskJiminnyRecipients(AutomatedReport $report): array\n {\n $recipients = [];\n\n $creator = $report->getCreator();\n if ($creator !== null) {\n $recipients[] = [\n 'email' => $creator->getEmailAddress(),\n 'name' => $creator->getName(),\n 'timezone' => $creator->getTimezone()->getName(),\n ];\n }\n\n return array_merge(\n $recipients,\n $this->buildRecipientUsers($report->getRecipients()),\n $this->getGroupRecipientUsers($report),\n );\n }\n\n private function getGroupRecipientUsers(AutomatedReport $report): array\n {\n $users = [];\n foreach ($report->getGroups() as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group === null) {\n continue;\n }\n foreach ($group->getMembers() as $member) {\n $users[] = [\n 'email' => $member->getEmailAddress(),\n 'name' => $member->getName(),\n 'timezone' => $member->getTimezone()->getName(),\n ];\n }\n }\n\n return $users;\n }\n\n public function getReportTypeName(AutomatedReportResult $report): string\n {\n $type = $report->getReport()->getType();\n\n $getType = $this->transformReportType($type);\n\n return $getType['name'];\n }\n\n public function getReportPeriodName(AutomatedReportResult $report): string\n {\n $from = $report->getFromDate();\n $to = $report->getToDate();\n $frequency = $report->getReport()->getFrequency();\n\n if ($from === null || $to === null) {\n if (! $report->getReport()->isAskJiminnyReport()) {\n $invalidPeriod = $from === null ? 'from' : 'to';\n\n throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);\n }\n\n $period = $this->calculateFromAndToDatePeriod($frequency);\n $from = $period['fromDate'];\n $to = $period['toDate'];\n }\n\n return $this->formatReportPeriodName($frequency, $from, $to);\n }\n\n private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string\n {\n $fromYear = $from->format('Y');\n $toYear = $to->format('Y');\n $differentYears = $fromYear !== $toYear;\n\n switch ($frequency) {\n case self::FREQUENCY_DAILY:\n return $from->format('j M Y');\n\n case self::FREQUENCY_QUARTERLY:\n // 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ\n $startMonth = $from->format('M');\n $endMonth = $to->copy()->subMonth();\n $endMonthName = $endMonth->format('M');\n $endMonthYear = $endMonth->format('Y');\n\n if ($differentYears) {\n return \"{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}\";\n }\n\n return \"{$startMonth} - {$endMonthName} {$toYear}\";\n\n case self::FREQUENCY_MONTHLY:\n // 'May 2025' - monthly reports are always within the same year\n return $from->format('M Y');\n\n case self::FREQUENCY_WEEKLY:\n // '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ\n $startDay = $from->format('j');\n $endDay = $to->format('j');\n $startMonth = $from->format('M');\n $endMonth = $to->format('M');\n\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n if ($startMonth !== $endMonth) {\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n return \"{$startDay} - {$endDay} {$endMonth} {$toYear}\";\n\n case self::FREQUENCY_ONE_OFF:\n // '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ\n $startDay = $from->format('j');\n $startMonth = $from->format('M');\n $endDay = $to->format('j');\n $endMonth = $to->format('M');\n\n // If same month and year, use a format like '2-31 May 2025'\n if ($startMonth === $endMonth && ! $differentYears) {\n return \"{$startDay} - {$endDay} {$startMonth} {$toYear}\";\n }\n\n // If different years, include both years\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n // Same year but different months\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n\n default:\n // Default format for unknown frequencies\n return $from->format('j M Y') . ' - ' . $to->format('j M Y');\n }\n }\n\n public function getReportTeamsName(AutomatedReportResult $report): string\n {\n $groups = $report->getGroups();\n\n if (empty($groups)) {\n return 'All';\n }\n\n // Get group names from repository\n $groupNames = [];\n foreach ($groups as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group) {\n $groupNames[] = $group->getName();\n }\n }\n\n if (count($groupNames) === 1) {\n // Single team format\n $teamsName = $groupNames[0];\n } else {\n // Multiple teams format\n $teamsName = implode(', ', $groupNames);\n }\n\n return $teamsName;\n }\n\n public function getReportFileName(AutomatedReportResult $report): string\n {\n $customName = $report->getReport()->getCustomName();\n $periodName = $this->getReportPeriodName($report);\n $filenameSuffix = $this->getFilenameSuffix($report);\n\n if ($customName) {\n if ($filenameSuffix) {\n $customName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$customName} - {$periodName}\");\n }\n\n $baseName = $this->getReportTypeName($report);\n\n if ($filenameSuffix) {\n $baseName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}\");\n }\n\n public function getReportFileNameWithExtension(AutomatedReportResult $result): string\n {\n $extension = $this->getMediaTypeMetadata($result)['extension'];\n\n return $this->getReportFileName($result) . '.' . $extension;\n }\n\n public function sanitizeFileName(string $fileName): string\n {\n return str_replace(['/', '\\\\'], '-', $fileName);\n }\n\n public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool\n {\n $recipients = array_map('intval', $report->getRecipients()['users'] ?? []);\n\n return in_array($user->getId(), $recipients);\n }\n\n public function transformReportResults(Collection $automatedReportResults): array\n {\n $data = [];\n foreach ($automatedReportResults as $automatedReportResult) {\n /** @var AutomatedReportResult $automatedReportResult */\n\n $report = $automatedReportResult->getReport();\n\n $createdBy = $report->getCreator();\n $creator = [\n 'id' => $createdBy?->getUuid(),\n 'name' => $createdBy?->getName(),\n 'email' => $createdBy?->getEmailAddress(),\n 'photoUrl' => $createdBy?->getPhotoUrl(),\n ];\n\n $data[] = [\n 'id' => $automatedReportResult->getUuid(),\n 'name' => $automatedReportResult->getName(),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n 'recipients' => $this->buildRecipients($report),\n 'report_type' => $this->transformReportType($report->getType()),\n 'media_type' => $automatedReportResult->getMediaType(),\n 'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),\n 'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),\n 'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),\n 'creator' => $creator,\n ];\n }\n\n return $data;\n }\n\n private function buildRecipients(AutomatedReport $report): array\n {\n $creatorUuid = $report->getCreator()?->getUuid();\n\n $recipients = array_values(array_filter(\n $this->transformRecipients($report->getRecipients()),\n static fn (array $recipient): bool => $recipient['id'] !== $creatorUuid,\n ));\n\n if (! $report->isAskJiminnyReport()) {\n return $recipients;\n }\n\n return [\n ...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),\n ...$recipients,\n ];\n }\n\n public function hasCallTypeConference(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);\n }\n\n public function hasCallTypeDialer(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);\n }\n\n // transformers\n private function transformTeam(Team $team): array\n {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n return [];\n }\n\n return [\n 'id' => $team->getUuid(),\n 'name' => $team->getName(),\n ];\n }\n\n private function transformReportFullView(AutomatedReport $report): array\n {\n $base = $this->transformReportBase($report);\n\n return $report->getType() === self::TYPE_ASK_JIMINNY\n ? $base + $this->transformAskJiminnyFields($report)\n : $base + $this->transformStandardReportFields($report);\n }\n\n private function transformReportBase(AutomatedReport $report): array\n {\n return [\n 'id' => $report->getUuid(),\n 'organization' => $this->transformOrganization(team: $report->getTeam()),\n 'report_type' => $this->transformReportType($report->getType()),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n ];\n }\n\n private function transformStandardReportFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n\n return [\n 'report_enabled' => $report->getStatus(),\n 'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),\n 'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),\n 'deal_value_min' => $report->getDealValueMin(),\n 'deal_value_max' => $report->getDealValueMax(),\n 'call_types' => $this->transformCallType($report->getCallTypes()),\n 'media_types' => $this->transformMediaTypes($report),\n 'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),\n 'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),\n 'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),\n 'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),\n 'recipients' => $this->transformRecipients($report->getRecipients()),\n 'created_by' => $this->transformCreator($report->getCreator()),\n 'additional_prompt_input' => $report->getAdditionalPromptInput(),\n 'custom_name' => $report->getCustomName(),\n 'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),\n 'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),\n 'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),\n ];\n }\n\n private function transformAskJiminnyFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n $creatorId = $report->getAttribute('created_by');\n $explicitUserIds = array_values(array_filter(\n $report->getRecipients()['users'] ?? [],\n static fn ($id) => $id !== $creatorId\n ));\n\n return [\n 'report_name' => $report->getCustomName(),\n 'enabled' => $report->getStatus(),\n 'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),\n 'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),\n 'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),\n 'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),\n ];\n }\n\n private function transformOrganization(?Team $team): array\n {\n return [\n 'id' => $team?->getUuid(),\n 'name' => $team?->getName(),\n ];\n }\n\n private function transformReportType(string $type): array\n {\n foreach (self::ALL_TYPES as $typeItem) {\n if ($typeItem['id'] === $type) {\n return $typeItem;\n }\n }\n\n return [];\n }\n\n private function transformCallType(array $types): array\n {\n $result = [];\n $callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];\n\n foreach ($types as $type) {\n foreach ($callTypes as $callTypeItem) {\n if ($callTypeItem['id'] === $type) {\n $result[] = $callTypeItem;\n\n break;\n }\n }\n }\n\n return $result;\n }\n\n private function transformMediaTypes(AutomatedReport $report): array\n {\n $values = [];\n\n foreach ($report->getMediaTypes() as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n continue;\n }\n\n $values[] = match ($mediaType) {\n self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,\n self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,\n };\n }\n\n return $values;\n }\n\n private function transformFrequency(string $frequency): array\n {\n foreach (self::ALL_FREQUENCIES as $frequencyItem) {\n if ($frequencyItem['id'] === $frequency) {\n return $frequencyItem;\n }\n }\n\n return [];\n }\n\n public function transformDurationToMinutes(?int $duration): ?int\n {\n if (! $duration) {\n return null;\n }\n\n return (int) ($duration / 60);\n }\n\n private function transformGroups(?Team $team, array $groupsIds): array\n {\n if (empty($groupsIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($groupsIds as $groupId) {\n $group = $team->groups()->where('id', $groupId)->first();\n\n if ($group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n 'photoUrl' => $group->getPhotoUrl(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformStages(?Team $team, array $stagesIds): array\n {\n if (empty($stagesIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($stagesIds as $stageId) {\n $stage = $team->stages()->where('id', $stageId)->first();\n\n if ($stage) {\n $data[] = [\n 'id' => $stage->getUuid(),\n 'name' => $stage->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformRecipients(array $recipients): array\n {\n $users = [];\n foreach ($recipients['users'] ?? [] as $userId) {\n $users[] = $this->transformUser($userId);\n }\n\n return $users;\n }\n\n private function transformCreator(?User $user): ?array\n {\n if ($user === null) {\n return null;\n }\n\n return $this->transformUser($user->getId());\n }\n\n private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array\n {\n if ($prompt === null) {\n return null;\n }\n\n return [\n 'id' => $prompt->getUuid(),\n 'name' => $prompt->getTitle(),\n ];\n }\n\n private function transformSafeSearch(?Search $search): ?array\n {\n if ($search === null) {\n return null;\n }\n\n return [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ];\n }\n\n private function transformUser(int $userId): array\n {\n /* @var ?User $user */\n $user = $this->userRepository->find($userId);\n\n return [\n 'id' => $user?->getUuid(),\n 'name' => $user?->getName(),\n 'email' => $user?->getEmailAddress(),\n 'photoUrl' => $user?->getPhotoUrl(),\n ];\n }\n\n public function create(array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $validatedData['created_by'] = auth()->id();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function update(string $uuid, array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $report = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $report) {\n throw new InvalidArgumentException('Report not found');\n }\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Create an Ask Jiminny report.\n */\n public function createAskJiminnyReport(array $data, User $creator): array\n {\n $validatedData = $this->validateAskJiminnyReportData($data, $creator);\n $validatedData['created_by'] = $creator->getId();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Update an Ask Jiminny report.\n */\n public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array\n {\n if (! $report->isAskJiminnyReport()) {\n throw new InvalidArgumentException('Report is not an Ask Jiminny report');\n }\n\n $validatedData = $this->validateAskJiminnyReportData($data, $user);\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array\n {\n $this->automatedReportsRepository->update($report, ['status' => $status]);\n\n return $this->transformReportFullView($report->fresh());\n }\n\n /**\n * Validate and transform data for Ask Jiminny reports.\n */\n private function validateAskJiminnyReportData(array $data, User $user): array\n {\n // Validate name\n $name = trim($data['report_name'] ?? '');\n if (empty($name)) {\n throw new InvalidArgumentException('Report name is required');\n }\n if (mb_strlen($name) > 50) {\n throw new InvalidArgumentException('Report name must be 50 characters or less');\n }\n\n // Validate frequency (only daily, weekly, monthly for Ask Jiminny)\n $frequency = $data['frequency'] ?? null;\n $askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];\n if (! in_array($frequency, $askJiminnyFrequencies, true)) {\n throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');\n }\n\n // Validate expiration date\n $expiresAt = $data['expires_on'] ?? null;\n if (empty($expiresAt)) {\n throw new InvalidArgumentException('Expiration date is required');\n }\n\n try {\n $expiresAtDate = Carbon::parse($expiresAt);\n } catch (InvalidFormatException $e) {\n throw new InvalidArgumentException('Expiration date format is invalid');\n }\n $maxExpiration = Carbon::now()->addYear()->endOfDay();\n if ($expiresAtDate->gt($maxExpiration)) {\n throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');\n }\n if ($expiresAtDate->isPast()) {\n throw new InvalidArgumentException('Expiration date cannot be in the past');\n }\n\n // Validate saved search\n $activitySearchId = $data['saved_search'] ?? null;\n if (empty($activitySearchId)) {\n throw new InvalidArgumentException('Saved search is required');\n }\n $savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);\n if (! $savedSearch) {\n throw new InvalidArgumentException('Saved search not found or does not belong to you');\n }\n\n // Validate saved prompt\n $askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;\n if (empty($askAnythingPromptId)) {\n throw new InvalidArgumentException('Ask Jiminny prompt is required');\n }\n $prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);\n if (! $prompt) {\n throw new InvalidArgumentException('Ask Jiminny prompt not found');\n }\n\n // Validate status\n $status = $data['enabled'] ?? false;\n\n $recipientUserIds = [$user->getId()];\n\n if (! empty($data['share_users'])) {\n $sharedUserIds = $this->validateAndGetUserIdsByTeam(\n $user->team,\n (array) $data['share_users']\n );\n $recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);\n }\n\n $sharedGroupIds = [];\n if (! empty($data['share_teams'])) {\n $sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);\n }\n\n $recipientUserIds = array_values(array_unique($recipientUserIds));\n\n return [\n 'team_id' => $user->getTeamId(),\n 'type' => self::TYPE_ASK_JIMINNY,\n 'status' => (bool) $status,\n 'frequency' => $frequency,\n 'custom_name' => $name,\n 'activity_search_id' => $savedSearch->getId(),\n 'ask_anything_prompt_id' => $prompt->getId(),\n 'expires_at' => $expiresAtDate->toDateString(),\n 'media_types' => [self::MEDIA_TYPE_PDF],\n 'call_types' => [],\n 'recipients' => ['users' => $recipientUserIds],\n 'groups' => $sharedGroupIds,\n ];\n }\n\n public static function getAskJiminnyFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::ASK_JIMINNY_FREQUENCIES);\n }\n\n public function getAskJiminnyReportFilters(User $user): array\n {\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n return [\n [\n 'id' => 'prompt',\n 'label' => 'Prompt',\n 'options' => $prompts,\n ],\n [\n 'id' => 'saved_search',\n 'label' => 'Saved Search',\n 'options' => $savedSearches,\n ],\n ];\n }\n\n public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array\n {\n $team = $user->getTeam();\n $userTimezone = $user->getTimezone();\n\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n $teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ])->values()->all();\n\n $shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];\n\n $sharedTeamsValue = [];\n $sharedUsersValue = [];\n if ($report) {\n $sharedTeamsValue = $this->transformGroups($team, $report->getGroups());\n\n $recipientUserIds = $report->getRecipients()['users'] ?? [];\n $creatorId = $report->getAttribute('created_by');\n $sharedUserIds = array_values(array_filter(\n $recipientUserIds,\n static fn ($id) => $id !== $creatorId\n ));\n $sharedUsersValue = collect($sharedUserIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (User $u) => [\n 'id' => $u->getUuid(),\n 'name' => $u->getName(),\n ])\n ->values()\n ->all();\n }\n\n return [\n 'fields' => [\n [\n 'id' => 'enabled',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'label' => '',\n 'value' => $report?->getStatus() ?? false,\n ],\n [\n 'id' => 'report_name',\n 'inputType' => InputTypeEnum::TEXT,\n 'label' => 'Name',\n 'placeholder' => 'Enter name',\n 'required' => true,\n 'validation' => ['maxLength' => 50],\n 'value' => $report?->getCustomName() ?? '',\n ],\n [\n 'id' => 'frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Frequency',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::ASK_JIMINNY_FREQUENCIES,\n 'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,\n ],\n [\n 'id' => 'expires_on',\n 'inputType' => InputTypeEnum::DATE,\n 'label' => 'Expires on',\n 'required' => true,\n 'placeholder' => 'Select',\n 'validation' => [\n 'minDate' => now($userTimezone)->toDateString(),\n 'maxDate' => now($userTimezone)->addYear()->toDateString(),\n ],\n 'value' => $report?->getExpiresAt()?->toDateString(),\n ],\n [\n 'id' => 'share_teams',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team',\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $teamGroups,\n 'value' => $sharedTeamsValue,\n ],\n [\n 'id' => 'share_users',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team member',\n 'required' => false,\n 'placeholder' => 'Select',\n 'groupLabelKey' => 'label',\n 'groupValuesKey' => 'users',\n 'optionLabelKey' => 'name',\n 'optionValueKey' => 'id',\n 'options' => $shareUsers,\n 'value' => $sharedUsersValue,\n ],\n [\n 'id' => 'saved_search',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Saved search',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $savedSearches,\n 'value' => $report && $report->getSavedSearch() ? [\n 'id' => $report->getSavedSearch()->getUuid(),\n 'name' => $report->getSavedSearch()->getName(),\n ] : null,\n ],\n [\n 'id' => 'ask_jiminny_prompt',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Ask Jiminny prompt',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $prompts,\n 'value' => $report && $report->getAskAnythingPrompt() ? [\n 'id' => $report->getAskAnythingPrompt()->getUuid(),\n 'name' => $report->getAskAnythingPrompt()->getTitle(),\n ] : null,\n ],\n ],\n ];\n }\n\n private function updateResultNames(AutomatedReport $automatedReport): void\n {\n $results = $this->automatedReportsRepository->getResultsByReport($automatedReport);\n\n foreach ($results as $result) {\n $result->update(['name' => $this->getReportFileName($result)]);\n }\n }\n\n public function updateStatus(string $uuid, array $data): array\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $automatedReport->update([\n 'status' => $status,\n ]);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n private function generateOneOffReport(AutomatedReport $automatedReport): void\n {\n // the scheduler handles all the other frequency types\n if ($automatedReport->getStatus() === false || $automatedReport->getFrequency() !== self::FREQUENCY_ONE_OFF) {\n return;\n }\n\n $this->dispatcher->dispatch(new RequestGenerateReportJob($automatedReport->getUuid()));\n }\n\n public function getReport(string $uuid): AutomatedReport\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n return $automatedReport;\n }\n\n public function get(string $uuid): array\n {\n $automatedReport = $this->getReport($uuid);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function list(string $sortColumn = 'created_at', string $sortDirection = 'desc'): array\n {\n $results = [];\n $collection = $this->automatedReportsRepository->getAllStandardReports($sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function listAskJiminnyReports(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): array {\n $results = [];\n $collection = $this->automatedReportsRepository->getAskJiminnyReportsByUser($user, $sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function delete(string $uuid): void\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $automatedReport->delete();\n }\n\n public function createReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n return $this->automatedReportsRepository->createResult(\n array_merge(\n [\n 'report_id' => $automatedReport->getId(),\n 'status' => AutomatedReportResult::STATUS_DEFAULT,\n ],\n $data\n )\n );\n }\n\n public function getOrCreateReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n $existing = $this->automatedReportsRepository->findLatestDefaultOrFailedResult($automatedReport);\n\n if ($existing !== null) {\n $existing->update(['status' => AutomatedReportResult::STATUS_DEFAULT]);\n\n return $existing;\n }\n\n return $this->createReportResult($automatedReport, $data);\n }\n\n public function getReportResult(string $resultUuid): AutomatedReportResult\n {\n $report = $this->automatedReportsRepository->findResultByUuid($resultUuid);\n\n if (! $report) {\n throw new ModelNotFoundException('Report Result not found');\n }\n\n return $report;\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return $this->automatedReportsRepository->findChildResult($result, $type);\n }\n\n // prophet API calls\n /**\n * @throws ApplicationException\n */\n public function getGenerateReportPayload(AutomatedReport $automatedReport, string $reportResultUuid): array\n {\n $period = $this->calculateFromAndToDate($automatedReport);\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n return [\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResultUuid,\n 'report_type' => $automatedReport->getType(),\n 'media_types' => $automatedReport->getMediaTypes(),\n 'from_date' => $fromDate->startOfDay()->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->endOfDay()->format(DateTimeInterface::RFC3339),\n 'group_ids' => $automatedReport->getGroups(),\n 'call_deal_stage' => $automatedReport->getDealAtCallStages(),\n 'current_deal_stage' => $automatedReport->getCurrentDealStages(),\n 'deal_min_value' => $automatedReport->getDealValueMin(),\n 'deal_max_value' => $automatedReport->getDealValueMax(),\n 'call_types' => $automatedReport->getCallTypes(),\n 'call_duration_min_seconds' => $automatedReport->getCallDurationMin(),\n 'call_duration_max_seconds' => $automatedReport->getCallDurationMax(),\n 'special_requirements' => $automatedReport->getAdditionalPromptInput(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->formatReportPeriodName(\n $automatedReport->getFrequency(),\n $fromDate,\n $toDate,\n ),\n 'playbook_categories' => $automatedReport->getPlaybookCategories(),\n 'custom_name' => $automatedReport->getCustomName(),\n ];\n }\n\n // $inputPayload - FE payload structure\n public function getActivitiesCountPayload(array $inputPayload): array\n {\n // Use validateAndTransformData to validate and normalize input\n $validatedData = $this->validateAndTransformData($inputPayload);\n $period = $this->calculateFromAndToDatePeriod(\n $validatedData['frequency'],\n Carbon::parse($validatedData['from']),\n Carbon::parse($validatedData['to']),\n );\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n // Create payload similar to getGenerateReportPayload\n return [\n 'team_id' => $validatedData['team_id'],\n 'group_ids' => $validatedData['groups'] ?? [],\n 'report_type' => $validatedData['type'],\n 'from_date' => $fromDate->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->format(DateTimeInterface::RFC3339),\n 'call_deal_stage' => $validatedData['deal_at_call_stages'] ?? [],\n 'current_deal_stage' => $validatedData['current_deal_stages'] ?? [],\n 'deal_min_value' => $validatedData['deal_value_min'] ?? null,\n 'deal_max_value' => $validatedData['deal_value_max'] ?? null,\n 'call_types' => $validatedData['call_types'],\n 'call_duration_min_seconds' => $validatedData['call_duration_min'] ?? null,\n 'call_duration_max_seconds' => $validatedData['call_duration_max'] ?? null,\n 'special_requirements' => $validatedData['additional_prompt_input'] ?? null,\n 'playbook_categories' => $validatedData['playbook_categories'] ?? [],\n 'request_id' => null,\n 'callback_url' => null,\n ];\n }\n\n public function shouldSendReport(array $users, ?CarbonInterface $generatedAt = null): bool\n {\n if (empty($users)) {\n return false;\n }\n\n $earliestTz = collect($users)\n ->mapWithKeys(function (array $user) {\n $tz = new DateTimeZone($user['timezone']);\n $nowUtc = new DateTime('now', new DateTimeZone('UTC'));\n $offset = $tz->getOffset($nowUtc);\n\n return [$user['timezone'] => $offset];\n })\n ->sortDesc()\n ->keys()\n ->first();\n\n $now = Carbon::now($earliestTz);\n $isScheduledTime = (int) $now->format('H') === self::SENT_REPORT_AT_HOURS;\n\n if ($isScheduledTime) {\n return true;\n }\n\n return $this->hasPassedScheduledTime($generatedAt, $earliestTz);\n }\n\n public function hasPassedScheduledTime(?CarbonInterface $generatedAt, string $timezone): bool\n {\n if ($generatedAt === null) {\n return false;\n }\n\n $now = Carbon::now($timezone);\n $scheduledTime = $now->copy()->setTime(self::SENT_REPORT_AT_HOURS, 0, 0);\n\n if ($now->hour < self::SENT_REPORT_AT_HOURS) {\n $scheduledTime = $scheduledTime->subDay();\n }\n\n $scheduledTimeUtc = $scheduledTime->copy()->utc();\n $generatedAtUtc = $generatedAt->copy()->utc();\n $nowUtc = $now->copy()->utc();\n\n return $generatedAtUtc->lt($scheduledTimeUtc) && $nowUtc->gt($scheduledTimeUtc);\n }\n\n public function calculateFromAndToDatePeriod(\n string $frequency,\n ?Carbon $fromDate = null,\n ?Carbon $toDate = null\n ): array {\n if ($frequency === self::FREQUENCY_ONE_OFF) {\n return [\n 'fromDate' => $fromDate,\n 'toDate' => $toDate,\n ];\n }\n\n $now = Carbon::now();\n\n return match ($frequency) {\n self::FREQUENCY_DAILY => [\n 'fromDate' => $now->copy()->subDay()->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_WEEKLY => [\n 'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_MONTHLY => [\n 'fromDate' => $now->copy()->subMonths(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_QUARTERLY => [\n 'fromDate' => $now->copy()->subMonths(3)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n default => throw new InvalidArgumentException(\"Unsupported frequency: {$frequency}\"),\n };\n }\n\n private function calculateFromAndToDate(AutomatedReport $automatedReport): array\n {\n return $this->calculateFromAndToDatePeriod(\n $automatedReport->getFrequency(),\n $automatedReport->getFrom(),\n $automatedReport->getTo()\n );\n }\n\n public function getAskJiminnyGenerateReportPayload(\n AutomatedReport $automatedReport,\n AutomatedReportResult $reportResult,\n array $activityIds,\n ): array {\n return [\n 'user_question' => $automatedReport->getAskAnythingPrompt()?->getContent(),\n 'call_ids' => array_map('strval', $activityIds),\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResult->getUuid(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->getReportPeriodName($reportResult),\n 'report_name' => $automatedReport->getCustomName(),\n ];\n }\n\n private function getCallbackUrl(): string\n {\n return $this->webhookService->route('jiminny.webhook.reports.ready');\n }\n\n /**\n * Validate and transform payload data for automated reports\n *\n * @param array $data\n *\n * @throws InvalidArgumentException\n *\n * @return array\n */\n private function validateAndTransformData(array $data): array\n {\n // Validate organization (team) and check feature\n $team = $this->validateOrganization($data['organization'] ?? null);\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $type = $this->validateReportType($data['report_type'] ?? null);\n $frequency = $this->validateFrequency($data['frequency'] ?? null);\n $additionalPromptInput = $this->validateAdditionalPromptInput(\n $data['additional_prompt_input'] ?? null\n );\n $customReportName = $this->validateCustomReportName($data['custom_name'] ?? null);\n\n // Prepare data for the database\n $reportData = [\n 'team_id' => $team->getId(),\n 'type' => $type,\n 'status' => $status,\n 'frequency' => $frequency,\n 'additional_prompt_input' => $additionalPromptInput,\n 'custom_name' => $customReportName,\n ];\n\n // Validate deal values\n $reportData = $this->validateDealValues($data, $reportData);\n\n // Validate date range\n $reportData = $this->validateDateRange($data, $reportData, $frequency);\n\n // Validate call durations\n $reportData = $this->validateCallDurations($data, $reportData);\n\n // Validate call types\n $reportData = $this->validateCallTypes($data, $reportData);\n\n // Validate media types\n $reportData = $this->validateMediaTypes($data, $reportData);\n\n // Validate groups\n if (isset($data['teams'])) {\n $reportData['groups'] = $this->validateAndGetGroupIds($team, $data['teams']);\n }\n\n // Validate deal stages\n $reportData = $this->validateDealStages($data, $reportData, $team, $type);\n\n // Validate playbook categories\n $reportData = $this->validatePlaybookCategories($data, $reportData, $team);\n\n // Validate recipients\n $reportData['recipients'] = [\n 'users' => $this->validateAndGetUserIdsByTeam($team, $data['recipients'] ?? []),\n ];\n\n if (isset($data['jiminny_recipients'])) {\n // Validate Jiminny recipients\n $reportData['jiminny_recipients'] = [\n 'users' => $this->validateAndGetJiminnyUserIds((array) $data['jiminny_recipients']),\n ];\n }\n\n return $reportData;\n }\n\n private function validateDealValues(array $data, array $reportData): array\n {\n if (isset($data['min_deal_value'])) {\n $reportData['deal_value_min'] = (int) $data['min_deal_value'];\n\n if ($reportData['deal_value_min'] > 4294967295 || $reportData['deal_value_min'] < 0) {\n throw new InvalidArgumentException('Min deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_deal_value'])) {\n $reportData['deal_value_max'] = (int) $data['max_deal_value'];\n\n if ($reportData['deal_value_max'] > 4294967295 || $reportData['deal_value_max'] < 0) {\n throw new InvalidArgumentException('Max deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['min_deal_value'], $data['max_deal_value'])\n && $data['min_deal_value'] > $data['max_deal_value']\n ) {\n throw new InvalidArgumentException('Min deal value cannot be greater than max deal value');\n }\n\n return $reportData;\n }\n\n private function validateDateRange(array $data, array $reportData, string $frequency): array\n {\n // Set date range only for one_off frequency\n if ($frequency === 'one_off') {\n if (isset($data['start_date_period'])) {\n $reportData['from'] = $this->parseDate($data['start_date_period']);\n }\n\n if (isset($data['end_date_period'])) {\n $reportData['to'] = $this->parseDate($data['end_date_period']);\n }\n\n if (empty($reportData['from']) || empty($reportData['to'])) {\n throw new InvalidArgumentException(\n 'Start date and end date are required for one_off frequency'\n );\n }\n } else {\n $reportData['from'] = null;\n $reportData['to'] = null;\n }\n\n return $reportData;\n }\n\n private function validateCallDurations(array $data, array $reportData): array\n {\n // Convert call durations from minutes to seconds\n if (isset($data['min_call_duration'])) {\n $reportData['call_duration_min'] = (int) $data['min_call_duration'] * 60;\n\n if ($reportData['call_duration_min'] > 4294967295 || $reportData['call_duration_min'] < 0) {\n throw new InvalidArgumentException('Min call duration should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_call_duration'])) {\n $reportData['call_duration_max'] = (int) $data['max_call_duration'] * 60;\n\n if ($reportData['call_duration_max'] > 4294967295 || $reportData['call_duration_max'] < 0) {\n throw new InvalidArgumentException('Max call duration should be between 0 and 4294967295');\n }\n }\n\n return $reportData;\n }\n\n private function validateCallTypes(array $data, array $reportData): array\n {\n // Set call types\n $reportData['call_types'] = $data['call_type'] ?? [];\n if (empty($reportData['call_types'])) {\n $reportData['call_types'] = self::getCallTypes();\n }\n\n foreach ($reportData['call_types'] as $callType) {\n if (! in_array($callType, self::getCallTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Call type %s is invalid', $callType));\n }\n }\n\n return $reportData;\n }\n\n private function validateMediaTypes(array $data, array $reportData): array\n {\n // Set media types from input data\n $reportData['media_types'] = $data['media_types'] ?? [];\n\n if (empty($reportData['media_types'])) {\n throw new InvalidArgumentException('Media types are required');\n }\n\n foreach ($reportData['media_types'] as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n throw new InvalidArgumentException(sprintf('Media type %s is invalid', $mediaType));\n }\n }\n\n return $reportData;\n }\n\n private function validateDealStages(array $data, array $reportData, Team $team, string $reportType): array\n {\n // Validate and set deal stages\n if (isset($data['deal_stage_at_call'])) {\n $reportData['deal_at_call_stages'] =\n $this->validateAndGetDealStageIds($team, $data['deal_stage_at_call'], 'Deal stage at call');\n }\n\n if (isset($data['current_deal_stage'])) {\n $reportData['current_deal_stages'] =\n $this->validateAndGetDealStageIds($team, $data['current_deal_stage'], 'Current deal stage');\n }\n\n // Ensure current_deal_stage is not provided for loss_analysis report type\n if ($reportType === self::TYPE_LOSS_ANALYSIS && ! empty($data['current_deal_stage'])) {\n throw new InvalidArgumentException('Current deal stage is not applicable for Loss Analysis reports');\n }\n\n return $reportData;\n }\n\n // transform uuid to id\n private function validatePlaybookCategories(array $data, array $reportData, Team $team): array\n {\n $key = 'playbook_categories';\n\n if (isset($data[$key])) {\n $payloadIds = $data[$key];\n $ids = [];\n\n foreach ($payloadIds as $uuid) {\n $uuid = (string) $uuid;\n\n try {\n $playbookCategory = $this->playbookCategoryRepository->findByUuid($uuid);\n } catch (Throwable $throwable) {\n Log::error(__METHOD__ . ' ' . $throwable->getMessage());\n\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory) {\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory->hasPlaybook()) {\n throw new InvalidArgumentException(sprintf('Playbook category %s has no playbook', $uuid));\n }\n\n if ($playbookCategory->getPlaybook()->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Playbook category %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $ids[] = $playbookCategory->getId();\n }\n\n $reportData[$key] = $ids;\n }\n\n return $reportData;\n }\n\n private function validateReportStatus($status): bool\n {\n if (! in_array($status, [true, false], true)) {\n throw new InvalidArgumentException('Report status is invalid');\n }\n\n return $status;\n }\n\n private function validateReportType($type): string\n {\n if (! in_array($type, self::getTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Report type is invalid: %s', $type));\n }\n\n return $type;\n }\n\n private function validateFrequency($frequency): string\n {\n if (! in_array($frequency, self::getFrequencies(), true)) {\n throw new InvalidArgumentException('Frequency is invalid');\n }\n\n return $frequency;\n }\n\n private function validateAdditionalPromptInput(?string $additionalPromptInput): ?string\n {\n if ($additionalPromptInput && strlen($additionalPromptInput) > 5000) {\n throw new InvalidArgumentException('Additional Prompt Input should be less than 5000 characters');\n }\n\n return $additionalPromptInput;\n }\n\n private function validateCustomReportName(?string $customReportName): ?string\n {\n if ($customReportName === null || $customReportName === '') {\n return null;\n }\n\n if (strlen($customReportName) > 70) {\n throw new InvalidArgumentException('Custom report name should be less than 70 characters');\n }\n\n return $customReportName;\n }\n\n private function validateOrganization(?string $organizationUuid): Team\n {\n if (! $organizationUuid) {\n throw new InvalidArgumentException('Organization is required');\n }\n\n $team = $this->teamRepository->idOrUuid($organizationUuid);\n\n if (! $team) {\n throw new InvalidArgumentException('Organization not found');\n }\n\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n throw new InvalidArgumentException('Organization does not have the Automated Reports feature');\n }\n\n return $team;\n }\n\n private function validateAndGetGroupIds(Team $team, array $teamUuids): array\n {\n $groupIds = [];\n\n foreach ($teamUuids as $uuid) {\n $group = $this->groupRepository->findByUuid($uuid);\n\n if ($group === null || $group->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Group %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $groupIds[] = $group->getId();\n\n }\n\n return $groupIds;\n }\n\n private function validateAndGetDealStageIds(Team $team, array $stageUuids, string $propertyLabel): array\n {\n $stageIds = [];\n\n foreach ($stageUuids as $uuid) {\n $stage = $this->stageRepository->findByUuid($uuid);\n\n if ($stage === null || $stage->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Stage %s not found for team %s for %s', $uuid, $team->getUuid(), $propertyLabel)\n );\n }\n\n $stageIds[] = $stage->getId();\n }\n\n return $stageIds;\n }\n\n private function validateAndGetUserIds(array $userUuids, callable $teamCheck): array\n {\n if (empty($userUuids)) {\n return [];\n }\n\n $userIds = [];\n\n foreach ($userUuids as $uuid) {\n $user = $this->userRepository->findByUuid($uuid);\n\n if (! $user || ! $user->isStatusActive()) {\n throw new InvalidArgumentException(\n sprintf('User %s not found or is not active', $uuid)\n );\n }\n\n if (! $teamCheck($user)) {\n throw new InvalidArgumentException(\n sprintf('User %s does not belong to the allowed team(s)', $uuid)\n );\n }\n\n $userIds[] = $user->getId();\n }\n\n return $userIds;\n }\n\n private function validateAndGetUserIdsByTeam(Team $team, array $userUuids): array\n {\n return $this->validateAndGetUserIds($userUuids, fn ($user) => $user->getTeamId() === $team->getId());\n }\n\n private function validateAndGetJiminnyUserIds(array $userUuids): array\n {\n $allowedTeamIds = config('kiosk.teamIds', []);\n\n return $this->validateAndGetUserIds($userUuids, fn ($user) => in_array($user->getTeamId(), $allowedTeamIds, true));\n }\n\n private function parseDate(string $dateString): string\n {\n return date('Y-m-d H:i:s', strtotime($dateString));\n }\n\n private function generateReportResultViewUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.view', ['uuid' => $result->getUuid()]);\n }\n\n private function generateReportResultDownloadUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.download', ['uuid' => $result->getUuid()]);\n }\n\n private function getReportMediaRouteResource(AutomatedReportResult $result): string\n {\n if ($result->getMediaType() === self::MEDIA_TYPE_PDF) {\n return self::PDF_KEY;\n } elseif ($result->getMediaType() === self::MEDIA_TYPE_PODCAST) {\n return self::AUDIO_KEY;\n }\n\n throw new \\InvalidArgumentException('Unknown media type.');\n }\n\n public function getMediaPath(AutomatedReportResult $result): ?string\n {\n $url = match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => $result->getPdfUrl(),\n self::MEDIA_TYPE_PODCAST => $result->getPodcastAudioUrl(),\n default => null,\n };\n\n if ($url === null) {\n return null;\n }\n\n $path = parse_url(trim($url, '\"\\''), PHP_URL_PATH);\n\n return $path ?: null;\n }\n\n public function getFilenameSuffix(AutomatedReportResult $result): ?string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => 'Podcast',\n default => null,\n };\n }\n\n public function getMailSubjectSuffix(AutomatedReportResult $result): string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => 'report',\n self::MEDIA_TYPE_PODCAST => 'podcast',\n default => '',\n };\n }\n\n public function getMediaTypeMetadata(AutomatedReportResult $result): array\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => ['extension' => 'mp3', 'mime' => 'audio/mpeg'],\n self::MEDIA_TYPE_PDF => ['extension' => 'pdf', 'mime' => 'application/pdf'],\n default => ['extension' => null, 'mime' => null],\n };\n }\n\n public function deleteS3Files(AutomatedReportResult $result): void\n {\n $teamUuid = $result->getReport()->getTeam()->getUuid();\n $reportUuid = $result->getUuid();\n\n // delete all files for a report uuid no mather of pdf, podcast, or both\n // in case of both - the podcast files are linked to the pdf (parent) uuid\n // pdf and podcast date times should be close\n $path = sprintf('%s/%s/%s', $teamUuid, self::S3_DIR, $reportUuid);\n\n foreach (self::FILE_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted S3 file', [\n 'path' => $file,\n ]);\n }\n }\n\n foreach (self::FILE_PODCAST_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '_podcast.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted Podcast S3 file', [\n 'path' => $file,\n ]);\n }\n }\n }\n\n /**\n *\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): Collection\n {\n return $this->automatedReportsRepository->getTeamIdsWithReportsResults($teamId);\n }\n\n /**\n * Core delete logic for report results using a query\n *\n * @param Builder $query\n * @param array $logContext\n *\n * @return int\n */\n private function deleteReportResultsByQuery(Builder $query, array $logContext = []): int\n {\n $deletedCount = 0;\n\n if ($query->exists()) {\n Log::info(\n 'Run delete report results',\n array_merge(\n $logContext,\n [\n 'service' => 'AutomatedReportsService',\n ]\n )\n );\n\n $query->chunkById(50, function ($results) use (&$deletedCount, $logContext) {\n foreach ($results as $result) {\n $this->deleteReportResult($result);\n $deletedCount++;\n\n Log::info(\n 'Deleted a report result',\n array_merge(\n $logContext,\n [\n 'result_id' => $result->getId(),\n 'report_id' => $result->getReportId(),\n ]\n )\n );\n }\n });\n }\n\n return $deletedCount;\n }\n\n /**\n * Delete report results for a team by retention period\n *\n * @param Team $team\n * @param CarbonImmutable $retentionDate\n *\n * @return int Number of deleted report results\n */\n public function deleteReportsResultsInRetentionPeriod(Team $team, CarbonImmutable $retentionDate): int\n {\n $reportIds = $this->automatedReportsRepository->getReportIdsByTeam($team);\n\n if ($reportIds->isEmpty()) {\n return 0;\n }\n\n $query = $this->automatedReportsRepository\n ->getReportResultsQueryForRetention($team, $retentionDate);\n\n return $this->deleteReportResultsByQuery($query, [\n 'team_id' => $team->getId(),\n 'retention_date' => $retentionDate->toDateTimeString(),\n ]);\n }\n\n /**\n * Delete ALL report results for a specific automated report\n *\n * @param string $uuid\n *\n * @return int\n */\n public function deleteReportResults(string $uuid): int\n {\n $report = $this->getReport($uuid);\n\n $query = $this->automatedReportsRepository->getResultsByReportQuery($report);\n\n return $this->deleteReportResultsByQuery($query, [\n 'report_uuid' => $uuid,\n 'report_id' => $report->getId(),\n ]);\n }\n\n public function deleteReportResult(AutomatedReportResult $result): void\n {\n $this->deleteS3Files($result);\n\n $result->delete();\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getTeamReports(Team $team): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getReportsByTeam($team);\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getReportResults(AutomatedReport $report): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getResultsByReport($report);\n }\n\n public function deleteAllReportResults(AutomatedReport $report): void\n {\n $results = $this->getReportResults($report);\n\n /** @var AutomatedReportResult $result */\n foreach ($results as $result) {\n Log::info('Deleting result', [\n 'report' => $report->getId(),\n 'result' => $result->getId(),\n ]);\n\n $this->deleteReportResult($result);\n }\n }\n\n public function deleteAllData(Team $team): void\n {\n Log::info('Deleting automated report and results for team', [\n 'team' => $team->getId(),\n ]);\n\n $reports = $this->getTeamReports($team);\n\n /** @var AutomatedReport $report */\n foreach ($reports as $report) {\n Log::info('Deleting report', [\n 'team' => $team->getId(),\n 'report' => $report->getId(),\n ]);\n\n $this->deleteAllReportResults($report);\n\n $report->delete();\n }\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"18","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"14","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"2","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"4","depth":4,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o\nJOIN activities a ON o.id = a.opportunity_id\nWHERE a.crm_configuration_id = 39\nAND a.actual_start_time > '2025-10-13'\nAND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM activities\nWHERE crm_configuration_id = 39 and user_id = 143\nand actual_start_time >= '2025-10-13'\nAND type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM opportunities WHERE account_id IN (178);\nselect * from activities where id IN (620137, 620187, 620188, 620189, 620230);\n\n# HS\nSELECT * FROM opportunities WHERE id IN (238);\nselect * from activities where id IN (477,2076);\n\nselect * from users;\n\nSELECT COUNT(*) FROM users;\nSELECT COUNT(*) FROM activities;\nSELECT COUNT(*) FROM opportunities;\n\nUPDATE activities\nSET\n actual_start_time = '2025-12-19 09:00:00',\n actual_end_time = '2025-12-19 10:30:00',\n scheduled_start_time = '2025-12-19 09:00:00',\n scheduled_end_time = '2025-12-19 10:30:00'\nWHERE id IN (407509,407375);\n\nselect * from partners;\n\nSELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id\nFROM activities\nWHERE user_id = 143\nAND actual_start_time >= '2025-10-13 00:00:00'\nAND actual_start_time <= '2026-01-13 23:59:59'\nORDER BY actual_start_time DESC;\n\nSELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;\nSELECT * FROM crm_layouts where crm_configuration_id = 39;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;\n# lead_id\n# account_id 177\n# contact_id 3969\n# opportunity_id\n# stage_id 203\n\nSELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;\n\nSELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'\nAND user_id = 143 and actual_start_time >= '2025-10-13';\n\nSELECT * FROM activities a\n# JOIN opportunities o ON a.opportunity_id = o.id\nWHERE a.crm_configuration_id = 39 AND a.type = 'conference'\nand status = 'completed' and recording_state = 'recorded'\nand a.actual_start_time >= '2025-10-13'\nAND a.user_id = 143\n;\n\nselect * from leads\nwhere crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707\n\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310);\nSELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198\nSELECT * FROM activities WHERE id IN (356001, 356008); # contacts:\n\nSELECT * FROM opportunities WHERE id IN (1707);\nSELECT * FROM stages where id IN (204, 198);\nSELECT * FROM opportunities WHERE account_id IN (178);\nSELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';\nSELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal\n\nSELECT * FROM activities where crm_configuration_id = 39\nAND opportunity_id IS NULL\nAND is_internal = false\nand status = 'completed' and recording_state = 'recorded'\nAND actual_start_time >= '2025-10-13'\nAND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)\n# AND lead_id IN (112, 109)\n;\n\nSELECT * FROM crm_profiles WHERE user_id = 143;\n\nselect * from inboxes; # 212\nselect * from users where id = 143; # 143\nselect * from inbox_email_batches where inbox_id = 212\nand updated_at >= '2026-01-28 00:00:00' order by id desc;\nselect * from inbox_emails where inbox_id = 212\nand batch_id = 95885 order by id desc;\nselect * from email_messages where origin_user_id = 143;\nselect * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';\nselect * from participants where activity_id = 620247;\n\nselect * from crm_profiles where user_id = 143;\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001\nselect * from transcription where activity_id = 356001; # 6943\nselect * from ai_prompts where transcription_id = 6943;\nSELECT * FROM activity_summary_logs where activity_id = 356001;\n\nSELECT * FROM social_accounts WHERE sociable_id = 143;\n\n# ************************************************************************************\nSELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;\n# 422515 softphone tr. 8100\n\nSELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;\n# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS\n\nselect * from ai_prompts where transcription_id IN (8100, 7670);\nselect * from activity_summary_logs where activity_id = 407509;\n\nselect * from sidekick_settings;\nselect * from default_activity_types;\n\nSELECT * FROM contacts WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\nSELECT * FROM leads WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\n\nSELECT * FROM activity_searches where user_id = 143;\nSELECT * FROM groups where team_id = 1;\n\nselect * from teams where id = 1;\nselect * from groups where team_id = 1; # 1150 - 7e75f8025c22\nselect id, name, group_id, status, deleted_at, email\nfrom users where team_id = 1 order by group_id desc ;\n\nselect * from activity_searches where id in (1977, 1978, 1979);\nselect * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);\nselect * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277\nselect * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879\n\nINSERT INTO `activity_search_filters`\n(`activity_search_id`, `filter`, `value`) VALUES\n(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')\n;\n\nselect * from crm_configurations where id = 39;\n\n\nselect sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id\nwhere u.team_id = 1;\nSELECT * FROM social_accounts WHERE sociable_id = 1635;\nSELECT * FROM users WHERE id = 1635;\n\nselect * from teams where id = 1;\nselect * from users where team_id = 1;\nselect * from team_features where team_id = 1;\nselect * from features;\n\nSELECT * FROM activity_searches where id = 1982; # 1981\nSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;\n\nSELECT * FROM automated_reports where id = 68;\nUPDATE automated_reports set playbook_categories = NULL where id = 68;\nSELECT * FROM automated_report_results where id = 275;\n\nSELECT * FROM automated_reports order by id desc;\nSELECT * FROM automated_report_results order by id desc;\nselect * from activity_searches where user_id = 143;\nselect * from ask_anything_prompts;\n\nSELECT * FROM groups WHERE id = 1439;\nSELECT * FROM users WHERE group_id = 1439;\n\nselect * from permissions; # 158\nselect * from roles;\nselect * from permission_role\n\nselect * from teams where id = 1;\nselect * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;\nselect * from groups where id = 28;\nselect * from playbooks where team_id = 1;\nselect * from playbooks where id = 179;\nselect * from playbook_categories where id = 1391;\nselect * from users where id = 143;\nselect * from crm_profiles where user_id = 143;\nselect * from activities where crm_configuration_id = 39 and type = 'conference'\nand crm_provider_id IS NOT NULL ORDER by id desc;\nselect * from activities where id = 422003; # 00UO400000pB6fpMAC\n\nSELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type\nFROM automated_report_results ar\nJOIN automated_reports a ON a.id = ar.report_id\nWHERE a.type = 'ask_jiminny'\nLIMIT 10;\n\nSELECT `automated_report_results`.* FROM `automated_report_results`\nINNER JOIN `automated_reports`\n ON `automated_report_results`.`report_id` = `automated_reports`.`id`\nWHERE `automated_report_results`.`generated_at` IS NOT NULL\n AND `automated_reports`.`team_id` = 1\n AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$.\"users\"')\n;\n\n\nselect * from teams where id = 3143;\nselect * from crm_configurations where id = 500;\nselect * from users where name = 'Integration Account'; # 1695\nSELECT * FROM social_accounts WHERE sociable_id = 1695;\n\nselect * from activities where crm_configuration_id = 39\nand recording_state = 'recorded' and duration > 60\nand status = 'completed' and actual_start_time >= '2025-12-01';\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;\n\nselect * from leads;","depth":4,"value":"SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o\nJOIN activities a ON o.id = a.opportunity_id\nWHERE a.crm_configuration_id = 39\nAND a.actual_start_time > '2025-10-13'\nAND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM activities\nWHERE crm_configuration_id = 39 and user_id = 143\nand actual_start_time >= '2025-10-13'\nAND type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM opportunities WHERE account_id IN (178);\nselect * from activities where id IN (620137, 620187, 620188, 620189, 620230);\n\n# HS\nSELECT * FROM opportunities WHERE id IN (238);\nselect * from activities where id IN (477,2076);\n\nselect * from users;\n\nSELECT COUNT(*) FROM users;\nSELECT COUNT(*) FROM activities;\nSELECT COUNT(*) FROM opportunities;\n\nUPDATE activities\nSET\n actual_start_time = '2025-12-19 09:00:00',\n actual_end_time = '2025-12-19 10:30:00',\n scheduled_start_time = '2025-12-19 09:00:00',\n scheduled_end_time = '2025-12-19 10:30:00'\nWHERE id IN (407509,407375);\n\nselect * from partners;\n\nSELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id\nFROM activities\nWHERE user_id = 143\nAND actual_start_time >= '2025-10-13 00:00:00'\nAND actual_start_time <= '2026-01-13 23:59:59'\nORDER BY actual_start_time DESC;\n\nSELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;\nSELECT * FROM crm_layouts where crm_configuration_id = 39;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;\n# lead_id\n# account_id 177\n# contact_id 3969\n# opportunity_id\n# stage_id 203\n\nSELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;\n\nSELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'\nAND user_id = 143 and actual_start_time >= '2025-10-13';\n\nSELECT * FROM activities a\n# JOIN opportunities o ON a.opportunity_id = o.id\nWHERE a.crm_configuration_id = 39 AND a.type = 'conference'\nand status = 'completed' and recording_state = 'recorded'\nand a.actual_start_time >= '2025-10-13'\nAND a.user_id = 143\n;\n\nselect * from leads\nwhere crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707\n\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310);\nSELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198\nSELECT * FROM activities WHERE id IN (356001, 356008); # contacts:\n\nSELECT * FROM opportunities WHERE id IN (1707);\nSELECT * FROM stages where id IN (204, 198);\nSELECT * FROM opportunities WHERE account_id IN (178);\nSELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';\nSELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal\n\nSELECT * FROM activities where crm_configuration_id = 39\nAND opportunity_id IS NULL\nAND is_internal = false\nand status = 'completed' and recording_state = 'recorded'\nAND actual_start_time >= '2025-10-13'\nAND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)\n# AND lead_id IN (112, 109)\n;\n\nSELECT * FROM crm_profiles WHERE user_id = 143;\n\nselect * from inboxes; # 212\nselect * from users where id = 143; # 143\nselect * from inbox_email_batches where inbox_id = 212\nand updated_at >= '2026-01-28 00:00:00' order by id desc;\nselect * from inbox_emails where inbox_id = 212\nand batch_id = 95885 order by id desc;\nselect * from email_messages where origin_user_id = 143;\nselect * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';\nselect * from participants where activity_id = 620247;\n\nselect * from crm_profiles where user_id = 143;\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001\nselect * from transcription where activity_id = 356001; # 6943\nselect * from ai_prompts where transcription_id = 6943;\nSELECT * FROM activity_summary_logs where activity_id = 356001;\n\nSELECT * FROM social_accounts WHERE sociable_id = 143;\n\n# ************************************************************************************\nSELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;\n# 422515 softphone tr. 8100\n\nSELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;\n# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS\n\nselect * from ai_prompts where transcription_id IN (8100, 7670);\nselect * from activity_summary_logs where activity_id = 407509;\n\nselect * from sidekick_settings;\nselect * from default_activity_types;\n\nSELECT * FROM contacts WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\nSELECT * FROM leads WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\n\nSELECT * FROM activity_searches where user_id = 143;\nSELECT * FROM groups where team_id = 1;\n\nselect * from teams where id = 1;\nselect * from groups where team_id = 1; # 1150 - 7e75f8025c22\nselect id, name, group_id, status, deleted_at, email\nfrom users where team_id = 1 order by group_id desc ;\n\nselect * from activity_searches where id in (1977, 1978, 1979);\nselect * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);\nselect * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277\nselect * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879\n\nINSERT INTO `activity_search_filters`\n(`activity_search_id`, `filter`, `value`) VALUES\n(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')\n;\n\nselect * from crm_configurations where id = 39;\n\n\nselect sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id\nwhere u.team_id = 1;\nSELECT * FROM social_accounts WHERE sociable_id = 1635;\nSELECT * FROM users WHERE id = 1635;\n\nselect * from teams where id = 1;\nselect * from users where team_id = 1;\nselect * from team_features where team_id = 1;\nselect * from features;\n\nSELECT * FROM activity_searches where id = 1982; # 1981\nSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;\n\nSELECT * FROM automated_reports where id = 68;\nUPDATE automated_reports set playbook_categories = NULL where id = 68;\nSELECT * FROM automated_report_results where id = 275;\n\nSELECT * FROM automated_reports order by id desc;\nSELECT * FROM automated_report_results order by id desc;\nselect * from activity_searches where user_id = 143;\nselect * from ask_anything_prompts;\n\nSELECT * FROM groups WHERE id = 1439;\nSELECT * FROM users WHERE group_id = 1439;\n\nselect * from permissions; # 158\nselect * from roles;\nselect * from permission_role\n\nselect * from teams where id = 1;\nselect * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;\nselect * from groups where id = 28;\nselect * from playbooks where team_id = 1;\nselect * from playbooks where id = 179;\nselect * from playbook_categories where id = 1391;\nselect * from users where id = 143;\nselect * from crm_profiles where user_id = 143;\nselect * from activities where crm_configuration_id = 39 and type = 'conference'\nand crm_provider_id IS NOT NULL ORDER by id desc;\nselect * from activities where id = 422003; # 00UO400000pB6fpMAC\n\nSELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type\nFROM automated_report_results ar\nJOIN automated_reports a ON a.id = ar.report_id\nWHERE a.type = 'ask_jiminny'\nLIMIT 10;\n\nSELECT `automated_report_results`.* FROM `automated_report_results`\nINNER JOIN `automated_reports`\n ON `automated_report_results`.`report_id` = `automated_reports`.`id`\nWHERE `automated_report_results`.`generated_at` IS NOT NULL\n AND `automated_reports`.`team_id` = 1\n AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$.\"users\"')\n;\n\n\nselect * from teams where id = 3143;\nselect * from crm_configurations where id = 500;\nselect * from users where name = 'Integration Account'; # 1695\nSELECT * FROM social_accounts WHERE sociable_id = 1695;\n\nselect * from activities where crm_configuration_id = 39\nand recording_state = 'recorded' and duration > 60\nand status = 'completed' and actual_start_time >= '2025-12-01';\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;\n\nselect * from leads;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-6532606308203292909
|
1126710648141684156
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsRepositoryTest
Run 'AutomatedReportsRepositoryTest'
Debug 'AutomatedReportsRepositoryTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
102
3
34
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Kiosk\AutomatedReports;
use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Carbon\Exceptions\InvalidFormatException;
use DateTime;
use DateTimeInterface;
use DateTimeZone;
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcher;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Jiminny\Component\ActivitySearch\FilterDefinition\InputTypeEnum;
use Jiminny\Component\AskAnything\AskAnythingPromptService;
use Jiminny\Component\AskAnything\Dtos\AskAnythingPromptDto;
use Jiminny\Component\UrlGenerator\Webhook;
use Jiminny\Contracts\Repositories\PlaybookCategoryRepository;
use Jiminny\Contracts\Repositories\TeamRepository;
use Jiminny\Contracts\Repositories\UserRepository;
use Jiminny\Exceptions\ApplicationException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Exceptions\ModelNotFoundException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateReportJob;
use Jiminny\Models\Activity\Search;
use Jiminny\Models\AskAnything\AskAnythingPrompt;
use Jiminny\Models\AskAnything\AskAnythingPromptTarget;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Contracts\UserContract;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AskAnythingRepository;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Repositories\GroupRepository;
use Jiminny\Repositories\SearchRepository;
use Jiminny\Repositories\StageRepository;
use Throwable;
class AutomatedReportsService
{
public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';
public const string TYPE_ASK_JIMINNY = 'ask_jiminny';
/**
* Standard report types (used by kiosk for existing automated reports).
*/
// @TODO this will add filter, however if we need to control feature by FF we need conditional logic
public const array TYPES = [
['id' => 'exec_summary', 'name' => 'Exec Summary'],
['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],
['id' => 'product_feedback', 'name' => 'Product Feedback'],
['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],
// ['id' => 'questions', 'name' => 'Questions'],
// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],
];
public const array ALL_TYPES = [
...self::TYPES,
['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],
];
public const string FREQUENCY_DAILY = 'daily';
public const string FREQUENCY_WEEKLY = 'weekly';
public const string FREQUENCY_MONTHLY = 'monthly';
public const string FREQUENCY_QUARTERLY = 'quarterly';
public const string FREQUENCY_ONE_OFF = 'one_off';
/**
* Frequencies for standard (non-Ask Jiminny) reports.
*/
public const array FREQUENCIES = [
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
/**
* Frequencies for Ask Jiminny reports.
*/
public const array ASK_JIMINNY_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
];
public const string MEDIA_TYPE_PDF = 'pdf';
public const string MEDIA_TYPE_PODCAST = 'podcast';
public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];
public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];
public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];
public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];
public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];
public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];
public const int SENT_REPORT_AT_HOURS = 5;
public const string PDF_KEY = 'pdf';
public const string AUDIO_KEY = 'audio';
private const array ALL_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
private const string S3_DIR = 'reports';
private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];
private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];
public function __construct(
private readonly TeamRepository $teamRepository,
private readonly GroupRepository $groupRepository,
private readonly UserRepository $userRepository,
private readonly StageRepository $stageRepository,
private readonly DealStagesService $dealStagesService,
private readonly RecipientsService $recipientsService,
private readonly AutomatedReportsRepository $automatedReportsRepository,
private readonly Webhook $webhookService,
private readonly BusDispatcher $dispatcher,
private readonly ActivityTypeService $activityTypeService,
private readonly PlaybookCategoryRepository $playbookCategoryRepository,
private readonly AskAnythingPromptService $askAnythingPromptService,
private readonly SearchRepository $activitySearchRepository,
private readonly AskAnythingRepository $askAnythingRepository,
) {
}
public static function getTypes(): array
{
$types = self::TYPES;
return array_map(static function ($type) {
return $type['id'];
}, $types);
}
public static function getCallTypes(): array
{
return array_map(static function ($callType) {
return $callType['id'];
}, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);
}
public static function getFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::FREQUENCIES);
}
// front-facing structure
public function getReportEnabledFieldData(bool $value = false): array
{
return [
'id' => 'report_enabled',
'label' => '',
'inputType' => InputTypeEnum::TOGGLE,
'value' => $value,
];
}
// Organizations = Teams
public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array
{
$options = $this->getTeams();
if ($shortVersion) {
return [
'id' => 'organization',
'label' => 'Organization',
'options' => $options,
];
}
return [
'id' => 'organization',
'label' => 'Organization',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $options,
'value' => $value,
'dependencies' => [
'teams',
'deal_stage_at_call',
'current_deal_stage',
'recipients',
ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,
],
'dependsOn' => [],
];
}
// Teams = Groups
public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array
{
if ($shortVersion) {
return [
'id' => 'teams',
'label' => 'Team',
'options' => $options,
];
}
return [
'id' => 'teams',
'label' => 'Team',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => false,
'placeholder' => 'Select',
'options' => $options,
'value' => $value, // value should be an array of objects {id, name}
'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],
'dependsOn' => [],
];
}
public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array
{
$types = [];
if ($team instanceof Team) {
if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
$types = self::TYPES;
}
if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {
$types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];
}
} else {
$types = self::TYPES;
}
if ($shortVersion) {
return [
'id' => 'report_type',
'label' => 'Report Type',
'options' => $types,
];
}
return [
'id' => 'report_type',
'label' => 'Report Type',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $types,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getFrequencyFieldData(?string $value = null): array
{
return [
'id' => 'frequency',
'label' => 'Frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => self::FREQUENCIES,
'value' => $value,
'dependencies' => ['period'],
'dependsOn' => [],
];
}
public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array
{
return [
'id' => 'period',
'label' => 'Select one-off period',
'inputType' => InputTypeEnum::DATE_RANGE,
'required' => true,
'placeholder' => 'Select',
'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],
'queryParams' => [
'startDate' => 'start_date_period',
'endDate' => 'end_date_period',
],
'dependencies' => [],
'dependsOn' => ['frequency'],
];
}
public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array
{
return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);
}
public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);
}
public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);
}
public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'deal_value',
'label' => 'Deal Value',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_deal_value',
'max' => 'max_deal_value',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array
{
$value = [];
$conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;
$dialerOn && $value[] = self::CALL_TYPE_DIALER;
return [
'id' => 'call_type',
'label' => 'Call Type',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => [
self::CALL_TYPE_CONFERENCE,
self::CALL_TYPE_DIALER,
],
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getMediaTypeFieldData(?AutomatedReport $report = null): array
{
$value = [];
if ($report) {
$value = $this->transformMediaTypes($report);
}
return [
'id' => 'media_types',
'label' => 'Export as',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => self::MEDIA_TYPE_OBJECTS,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'call_duration',
'label' => 'Call Duration',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_call_duration',
'max' => 'max_call_duration',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getRecipientsFieldData(?Team $team = null, array $value = []): array
{
return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);
}
public function getJiminnyRecipientsFieldData(array $value = []): array
{
return $this->recipientsService->getJiminnyRecipientsFieldData($value);
}
public function getAdditionalPromptInputFieldData(?string $value = null): array
{
return [
'id' => 'additional_prompt_input',
'label' => 'Special requirements',
'inputType' => InputTypeEnum::TEXTAREA,
'required' => false,
'placeholder' => 'What should be the focus of the report?',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCustomReportNameFieldData(?string $value = null): array
{
return [
'id' => 'custom_name',
'label' => 'Custom report name',
'inputType' => InputTypeEnum::TEXT,
'required' => false,
'placeholder' => 'Enter custom name',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
// data providers
public function getTeams(): array
{
$teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);
$teamData = [];
foreach ($teams as $team) {
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
continue;
}
$teamData[] = $this->transformTeam($team);
}
return $teamData;
}
public function getTeamGroups(string $teamUuid): array
{
$data = [];
$team = $this->getTeam($teamUuid);
if ($team !== null) {
$groups = $team->groups()->get();
foreach ($groups as $group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
];
}
}
return $data;
}
public function getTeamsGroupsOptions(array $filterTeamUuids = []): array
{
$data = [];
$teams = $this->getTeams();
foreach ($teams as $team) {
if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {
continue;
}
$data[] = [
'label' => $team['name'],
'groups' => $this->getTeamGroups($team['id']),
];
}
return $data;
}
public function getTeam(string $teamUuid): ?Team
{
return $this->teamRepository->idOrUuid($teamUuid);
}
public function getTeamById(int $teamId): ?Team
{
return $this->teamRepository->find($teamId);
}
public function getGroupsUuids(AutomatedReport $report): array
{
$uuids = [];
$reportGroups = $report->getGroups();
foreach ($reportGroups as $groupId) {
if ($group = $this->groupRepository->find($groupId)) {
$uuids[] = $group->getUuid();
}
}
return $uuids;
}
public function getPlaybookCategoriesUuids(AutomatedReport $report): array
{
$uuids = [];
$playbookCategories = $report->getPlaybookCategories();
foreach ($playbookCategories as $id) {
if ($category = $this->playbookCategoryRepository->find($id)) {
$uuids[] = $category->getUuid();
}
}
return $uuids;
}
public function getDealAtCallStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getDealAtCallStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getCurrentDealStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getCurrentDealStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getRecipients());
}
public function getJiminnyUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function extractUserUuids(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => $user->getUuid())
->values()
->all();
}
// get mail data
public function getRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getRecipients());
}
/**
* @return array<UserContract>
*/
public function getRecipientUserObjects(AutomatedReport $report): array
{
$userIds = $report->getRecipients()['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->values()
->all();
}
private function getJiminnyRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function buildRecipientUsers(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => [
'email' => $user->getEmailAddress(),
'name' => $user->getName(),
'timezone' => $user->getTimezone()->getName(),
])
->values()
->all();
}
public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array
{
if ($report->isAskJiminnyReport()) {
$recipients = $this->resolveAskJiminnyRecipients($report);
} else {
$recipients = $this->getRecipientUsers($report);
if ($includeJiminny) {
$recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));
}
}
$emails = [];
return array_values(array_filter(
$recipients,
static function ($recipient) use (&$emails) {
if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {
return false;
}
$emails[] = $recipient['email'];
return true;
}
));
}
private function resolveAskJiminnyRecipients(AutomatedReport $report): array
{
$recipients = [];
$creator = $report->getCreator();
if ($creator !== null) {
$recipients[] = [
'email' => $creator->getEmailAddress(),
'name' => $creator->getName(),
'timezone' => $creator->getTimezone()->getName(),
];
}
return array_merge(
$recipients,
$this->buildRecipientUsers($report->getRecipients()),
$this->getGroupRecipientUsers($report),
);
}
private function getGroupRecipientUsers(AutomatedReport $report): array
{
$users = [];
foreach ($report->getGroups() as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group === null) {
continue;
}
foreach ($group->getMembers() as $member) {
$users[] = [
'email' => $member->getEmailAddress(),
'name' => $member->getName(),
'timezone' => $member->getTimezone()->getName(),
];
}
}
return $users;
}
public function getReportTypeName(AutomatedReportResult $report): string
{
$type = $report->getReport()->getType();
$getType = $this->transformReportType($type);
return $getType['name'];
}
public function getReportPeriodName(AutomatedReportResult $report): string
{
$from = $report->getFromDate();
$to = $report->getToDate();
$frequency = $report->getReport()->getFrequency();
if ($from === null || $to === null) {
if (! $report->getReport()->isAskJiminnyReport()) {
$invalidPeriod = $from === null ? 'from' : 'to';
throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);
}
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
}
return $this->formatReportPeriodName($frequency, $from, $to);
}
private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string
{
$fromYear = $from->format('Y');
$toYear = $to->format('Y');
$differentYears = $fromYear !== $toYear;
switch ($frequency) {
case self::FREQUENCY_DAILY:
return $from->format('j M Y');
case self::FREQUENCY_QUARTERLY:
// 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ
$startMonth = $from->format('M');
$endMonth = $to->copy()->subMonth();
$endMonthName = $endMonth->format('M');
$endMonthYear = $endMonth->format('Y');
if ($differentYears) {
return "{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}";
}
return "{$startMonth} - {$endMonthName} {$toYear}";
case self::FREQUENCY_MONTHLY:
// 'May 2025' - monthly reports are always within the same year
return $from->format('M Y');
case self::FREQUENCY_WEEKLY:
// '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ
$startDay = $from->format('j');
$endDay = $to->format('j');
$startMonth = $from->format('M');
$endMonth = $to->format('M');
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
if ($startMonth !== $endMonth) {
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
}
return "{$startDay} - {$endDay} {$endMonth} {$toYear}";
case self::FREQUENCY_ONE_OFF:
// '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ
$startDay = $from->format('j');
$startMonth = $from->format('M');
$endDay = $to->format('j');
$endMonth = $to->format('M');
// If same month and year, use a format like '2-31 May 2025'
if ($startMonth === $endMonth && ! $differentYears) {
return "{$startDay} - {$endDay} {$startMonth} {$toYear}";
}
// If different years, include both years
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
// Same year but different months
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
default:
// Default format for unknown frequencies
return $from->format('j M Y') . ' - ' . $to->format('j M Y');
}
}
public function getReportTeamsName(AutomatedReportResult $report): string
{
$groups = $report->getGroups();
if (empty($groups)) {
return 'All';
}
// Get group names from repository
$groupNames = [];
foreach ($groups as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group) {
$groupNames[] = $group->getName();
}
}
if (count($groupNames) === 1) {
// Single team format
$teamsName = $groupNames[0];
} else {
// Multiple teams format
$teamsName = implode(', ', $groupNames);
}
return $teamsName;
}
public function getReportFileName(AutomatedReportResult $report): string
{
$customName = $report->getReport()->getCustomName();
$periodName = $this->getReportPeriodName($report);
$filenameSuffix = $this->getFilenameSuffix($report);
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$customName} - {$periodName}");
}
$baseName = $this->getReportTypeName($report);
if ($filenameSuffix) {
$baseName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}");
}
public function getReportFileNameWithExtension(AutomatedReportResult $result): string
{
$extension = $this->getMediaTypeMetadata($result)['extension'];
return $this->getReportFileName($result) . '.' . $extension;
}
public function sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool
{
$recipients = array_map('intval', $report->getRecipients()['users'] ?? []);
return in_array($user->getId(), $recipients);
}
public function transformReportResults(Collection $automatedReportResults): array
{
$data = [];
foreach ($automatedReportResults as $automatedReportResult) {
/** @var AutomatedReportResult $automatedReportResult */
$report = $automatedReportResult->getReport();
$createdBy = $report->getCreator();
$creator = [
'id' => $createdBy?->getUuid(),
'name' => $createdBy?->getName(),
'email' => $createdBy?->getEmailAddress(),
'photoUrl' => $createdBy?->getPhotoUrl(),
];
$data[] = [
'id' => $automatedReportResult->getUuid(),
'name' => $automatedReportResult->getName(),
'frequency' => $this->transformFrequency($report->getFrequency()),
'recipients' => $this->buildRecipients($report),
'report_type' => $this->transformReportType($report->getType()),
'media_type' => $automatedReportResult->getMediaType(),
'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),
'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),
'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),
'creator' => $creator,
];
}
return $data;
}
private function buildRecipients(AutomatedReport $report): array
{
$creatorUuid = $report->getCreator()?->getUuid();
$recipients = array_values(array_filter(
$this->transformRecipients($report->getRecipients()),
static fn (array $recipient): bool => $recipient['id'] !== $creatorUuid,
));
if (! $report->isAskJiminnyReport()) {
return $recipients;
}
return [
...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),
...$recipients,
];
}
public function hasCallTypeConference(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);
}
public function hasCallTypeDialer(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);
}
// transformers
private function transformTeam(Team $team): array
{
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
return [];
}
return [
'id' => $team->getUuid(),
'name' => $team->getName(),
];
}
private function transformReportFullView(AutomatedReport $report): array
{
$base = $this->transformReportBase($report);
return $report->getType() === self::TYPE_ASK_JIMINNY
? $base + $this->transformAskJiminnyFields($report)
: $base + $this->transformStandardReportFields($report);
}
private function transformReportBase(AutomatedReport $report): array
{
return [
'id' => $report->getUuid(),
'organization' => $this->transformOrganization(team: $report->getTeam()),
'report_type' => $this->transformReportType($report->getType()),
'frequency' => $this->transformFrequency($report->getFrequency()),
];
}
private function transformStandardReportFields(AutomatedReport $report): array
{
$team = $report->getTeam();
return [
'report_enabled' => $report->getStatus(),
'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),
'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),
'deal_value_min' => $report->getDealValueMin(),
'deal_value_max' => $report->getDealValueMax(),
'call_types' => $this->transformCallType($report->getCallTypes()),
'media_types' => $this->transformMediaTypes($report),
'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),
'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),
'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),
'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),
'recipients' => $this->transformRecipients($report->getRecipients()),
'created_by' => $this->transformCreator($report->getCreator()),
'additional_prompt_input' => $report->getAdditionalPromptInput(),
'custom_name' => $report->getCustomName(),
'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),
'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),
'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),
];
}
private function transformAskJiminnyFields(AutomatedReport $report): array
{
$team = $report->getTeam();
$creatorId = $report->getAttribute('created_by');
$explicitUserIds = array_values(array_filter(
$report->getRecipients()['users'] ?? [],
static fn ($id) => $id !== $creatorId
));
return [
'report_name' => $report->getCustomName(),
'enabled' => $report->getStatus(),
'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),
'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),
'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),
'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),
];
}
private function transformOrganization(?Team $team): array
{
return [
'id' => $team?->getUuid(),
'name' => $team?->getName(),
];
}
private function transformReportType(string $type): array
{
foreach (self::ALL_TYPES as $typeItem) {
if ($typeItem['id'] === $type) {
return $typeItem;
}
}
return [];
}
private function transformCallType(array $types): array
{
$result = [];
$callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];
foreach ($types as $type) {
foreach ($callTypes as $callTypeItem) {
if ($callTypeItem['id'] === $type) {
$result[] = $callTypeItem;
break;
}
}
}
return $result;
}
private function transformMediaTypes(AutomatedReport $report): array
{
$values = [];
foreach ($report->getMediaTypes() as $mediaType) {
if (! in_array($mediaType, self::MEDIA_TYPES, true)) {
continue;
}
$values[] = match ($mediaType) {
self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,
self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,
};
}
return $values;
}
private function transformFrequency(string $frequency): array
{
foreach (self::ALL_FREQUENCIES as $frequencyItem) {
if ($frequencyItem['id'] === $frequency) {
return $frequencyItem;
}
}
return [];
}
public function transformDurationToMinutes(?int $duration): ?int
{
if (! $duration) {
return null;
}
return (int) ($duration / 60);
}
private function transformGroups(?Team $team, array $groupsIds): array
{
if (empty($groupsIds) || ! $team) {
return [];
}
$data = [];
foreach ($groupsIds as $groupId) {
$group = $team->groups()->where('id', $groupId)->first();
if ($group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
'photoUrl' => $group->getPhotoUrl(),
];
}
}
return $data;
}
private function transformStages(?Team $team, array $stagesIds): array
{
if (empty($stagesIds) || ! $team) {
return [];
}
$data = [];
foreach ($stagesIds as $stageId) {
$stage = $team->stages()->where('id', $stageId)->first();
if ($stage) {
$data[] = [
'id' => $stage->getUuid(),
'name' => $stage->getName(),
];
}
}
return $data;
}
private function transformRecipients(array $recipients): array
{
$users = [];
foreach ($recipients['users'] ?? [] as $userId) {
$users[] = $this->transformUser($userId);
}
return $users;
}
private function transformCreator(?User $user): ?array
{
if ($user === null) {
return null;
}
return $this->transformUser($user->getId());
}
private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array
{
if ($prompt === null) {
return null;
}
return [
'id' => $prompt->getUuid(),
'name' => $prompt->getTitle(),
];
}
private function transformSafeSearch(?Search $search): ?array
{
if ($search === null) {
return null;
}
return [
'id' => $search->getUuid(),
'name' => $search->getName(),
];
}
private function transformUser(int $userId): array
{
/* @var ?User $user */
$user = $this->userRepository->find($userId);
return [
'id' => $user?->getUuid(),
'name' => $user?->getName(),
'email' => $user?->getEmailAddress(),
'photoUrl' => $user?->getPhotoUrl(),
];
}
public function create(array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$validatedData['created_by'] = auth()->id();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
public function update(string $uuid, array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$report = $this->automatedReportsRepository->findByUuid($uuid);
if (! $report) {
throw new InvalidArgumentException('Report not found');
}
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
/**
* Create an Ask Jiminny report.
*/
public function createAskJiminnyReport(array $data, User $creator): array
{
$validatedData = $this->validateAskJiminnyReportData($data, $creator);
$validatedData['created_by'] = $creator->getId();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
return $this->transformReportFullView($automatedReport);
}
/**
* Update an Ask Jiminny report.
*/
public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array
{
if (! $report->isAskJiminnyReport()) {
throw new InvalidArgumentException('Report is not an Ask Jiminny report');
}
$validatedData = $this->validateAskJiminnyReportData($data, $user);
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
return $this->transformReportFullView($automatedReport);
}
public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array
{
$this->automatedReportsRepository->update($report, ['status' => $status]);
return $this->transformReportFullView($report->fresh());
}
/**
* Validate and transform data for Ask Jiminny reports.
*/
private function validateAskJiminnyReportData(array $data, User $user): array
{
// Validate name
$name = trim($data['report_name'] ?? '');
if (empty($name)) {
throw new InvalidArgumentException('Report name is required');
}
if (mb_strlen($name) > 50) {
throw new InvalidArgumentException('Report name must be 50 characters or less');
}
// Validate frequency (only daily, weekly, monthly for Ask Jiminny)
$frequency = $data['frequency'] ?? null;
$askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];
if (! in_array($frequency, $askJiminnyFrequencies, true)) {
throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');
}
// Validate expiration date
$expiresAt = $data['expires_on'] ?? null;
if (empty($expiresAt)) {
throw new InvalidArgumentException('Expiration date is required');
}
try {
$expiresAtDate = Carbon::parse($expiresAt);
} catch (InvalidFormatException $e) {
throw new InvalidArgumentException('Expiration date format is invalid');
}
$maxExpiration = Carbon::now()->addYear()->endOfDay();
if ($expiresAtDate->gt($maxExpiration)) {
throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');
}
if ($expiresAtDate->isPast()) {
throw new InvalidArgumentException('Expiration date cannot be in the past');
}
// Validate saved search
$activitySearchId = $data['saved_search'] ?? null;
if (empty($activitySearchId)) {
throw new InvalidArgumentException('Saved search is required');
}
$savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);
if (! $savedSearch) {
throw new InvalidArgumentException('Saved search not found or does not belong to you');
}
// Validate saved prompt
$askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;
if (empty($askAnythingPromptId)) {
throw new InvalidArgumentException('Ask Jiminny prompt is required');
}
$prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);
if (! $prompt) {
throw new InvalidArgumentException('Ask Jiminny prompt not found');
}
// Validate status
$status = $data['enabled'] ?? false;
$recipientUserIds = [$user->getId()];
if (! empty($data['share_users'])) {
$sharedUserIds = $this->validateAndGetUserIdsByTeam(
$user->team,
(array) $data['share_users']
);
$recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);
}
$sharedGroupIds = [];
if (! empty($data['share_teams'])) {
$sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);
}
$recipientUserIds = array_values(array_unique($recipientUserIds));
return [
'team_id' => $user->getTeamId(),
'type' => self::TYPE_ASK_JIMINNY,
'status' => (bool) $status,
'frequency' => $frequency,
'custom_name' => $name,
'activity_search_id' => $savedSearch->getId(),
'ask_anything_prompt_id' => $prompt->getId(),
'expires_at' => $expiresAtDate->toDateString(),
'media_types' => [self::MEDIA_TYPE_PDF],
'call_types' => [],
'recipients' => ['users' => $recipientUserIds],
'groups' => $sharedGroupIds,
];
}
public static function getAskJiminnyFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::ASK_JIMINNY_FREQUENCIES);
}
public function getAskJiminnyReportFilters(User $user): array
{
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
return [
[
'id' => 'prompt',
'label' => 'Prompt',
'options' => $prompts,
],
[
'id' => 'saved_search',
'label' => 'Saved Search',
'options' => $savedSearches,
],
];
}
public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array
{
$team = $user->getTeam();
$userTimezone = $user->getTimezone();
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
$teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [
'id' => $group->getUuid(),
'name' => $group->getName(),
])->values()->all();
$shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];
$sharedTeamsValue = [];
$sharedUsersValue = [];
if ($report) {
$sharedTeamsValue = $this->transformGroups($team, $report->getGroups());
$recipientUserIds = $report->getRecipients()['users'] ?? [];
$creatorId = $report->getAttribute('created_by');
$sharedUserIds = array_values(array_filter(
$recipientUserIds,
static fn ($id) => $id !== $creatorId
));
$sharedUsersValue = collect($sharedUserIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (User $u) => [
'id' => $u->getUuid(),
'name' => $u->getName(),
])
->values()
->all();
}
return [
'fields' => [
[
'id' => 'enabled',
'inputType' => InputTypeEnum::TOGGLE,
'label' => '',
'value' => $report?->getStatus() ?? false,
],
[
'id' => 'report_name',
'inputType' => InputTypeEnum::TEXT,
'label' => 'Name',
'placeholder' => 'Enter name',
'required' => true,
'validation' => ['maxLength' => 50],
'value' => $report?->getCustomName() ?? '',
],
[
'id' => 'frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'label' => 'Frequency',
'required' => true,
'placeholder' => 'Select',
'options' => self::ASK_JIMINNY_FREQUENCIES,
'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,
],
[
'id' => 'expires_on',
'inputType' => InputTypeEnum::DATE,
'label' => 'Expires on',
'required' => true,
'placeholder' => 'Select',
'validation' => [
'minDate' => now($userTimezone)->toDateString(),
'maxDate' => n...
|
66788
|
|
66842
|
NULL
|
0
|
2026-04-21T15:09:33.288774+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776784173288_m2.jpg...
|
Slack
|
releases (Channel) - Jiminny Inc - Slack
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences...
|
[{"role":"AXPopUpButton","text [{"role":"AXPopUpButton","text":"Switch workspaces… (Jiminny Inc) Has new messages","depth":14,"bounds":{"left":0.0056515955,"top":0.058260176,"width":0.011968086,"height":0.028731046},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"Home","depth":14,"bounds":{"left":0.0029920214,"top":0.10055866,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Home","depth":16,"bounds":{"left":0.0066489363,"top":0.13806863,"width":0.009973404,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"DMs","depth":14,"bounds":{"left":0.0029920214,"top":0.15482841,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"DMs","depth":16,"bounds":{"left":0.0076462766,"top":0.19233839,"width":0.007978723,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Activity","depth":14,"bounds":{"left":0.0029920214,"top":0.20909816,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Activity","depth":16,"bounds":{"left":0.004986702,"top":0.24660814,"width":0.012965426,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":14,"bounds":{"left":0.0029920214,"top":0.26336792,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":16,"bounds":{"left":0.0076462766,"top":0.3008779,"width":0.0076462766,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Later","depth":14,"bounds":{"left":0.0029920214,"top":0.31763768,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Later","depth":16,"bounds":{"left":0.00731383,"top":0.35514766,"width":0.008643617,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"More…","depth":14,"bounds":{"left":0.0029920214,"top":0.3719074,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More","depth":16,"bounds":{"left":0.006981383,"top":0.4094174,"width":0.008976064,"height":0.0103751},"role_description":"text"},{"role":"AXStaticText","text":"Unreads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Threads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Huddles","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Drafts & sent","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Directories","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-x-integration-app","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-inner-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"ai-chapter","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"alerts","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"backend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"c-learning-people","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"confusion-clinic","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"curiosity_lab","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"engineering","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"frontend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"general","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"infra-changes","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-bg","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-copilot-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-zoom-phone-licences","depth":23,"role_description":"text"}]...
|
2995771484154762928
|
-5783511711348080957
|
idle
|
hybrid
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
ActivityMoreSlackcalVIewMistonWindowHelp@ Describe what you are looking forJiminny ...9 22# plattorm-tickets# product launches¿randomi# releases# support# thank-yous# the people of jimi..ó- Direct messagese Aneliva Angelova(3 Aneliya Angelova, ...Mario GeorgievNikolav Yankov3 Todor Stamatovfe Gabriela Dureva• Petko Kashinski• Vasil Vasilev• Nikolav Nikolov.Galya Dimitrova8 Stefka StovanovaAa Stovan TomovStoyan TanevA Nikolav Ivanov::: Aons7" Jira Cloud8 Toast# releasesMessagesUe Files• Bookmarkstlaccian net/browse JY-19/98)change ai achyToday ~ m priority (#475)Nikolav Ivanov.GitHUb APP 5:34 PM5 new commits oushed to master bvnikolavbiaivanov3872fc08 - Add Makehle shortcuts forenvironment togqle commands6352d781 - Merge branch 'master" intoreature/add-olaner-start-ston-to-make-hlee2859d4d - Merge branch 'master" intoreature/adc-nlaner-ctart-cton-to-make-nle4303337d - Merge branch 'master" intofeature/add-nlanet-ctart-ston-to-make.fled207a770 - Merge pull request #11984from liminny/feature /add-nlanet-ctart-ston-to-make.fleejum99 +CircleeO Denlounent SuccecetulProlect: aooWhen04/21/202614.561View JobMessage #releases+ Aal@ SvncTolntercom.ohv app/JJobs/TeamUnversioned Files 11 filesaкepoпskepository.onp© AutomatedReportsRepositoryTest.phpC) Service.php© Field.phpervice.pnpOkeporcontroller.onp© AutomatedReportsSendCommand.phpAutomatedReportsServiceTest.phpyListener.php©)ActivityLogged.php© AutomatedReportsCallbackService.php© RequestGenerateAskJAutomatedRenorts.xtends TestlaseCconvino:voidf...}+ → Side-by-side viewer -Do not ignoreHighlight words • | 11array_ values(Sthis->transformRecipients(Sreport->getRecipients))'report type' => $this->transformReportType(Sreport->qetTypeO)'media type' => sautomatedReportResult->qetMed1alypeol'downloadUrl' => $this->qenerateReportResultDownloadUr1($automatedReportResult)vlewirl' =>sthis->deneraterenortresu.tvlewr.csautomatedRenortresuutreturn Sdata:nublie function hasCallTvneConference(AutomatedRenont Srenont): hoolneturn in arnav(self:•CAll TYPE CONEERENCE(Iid'L Srenont->ae+callTvneço true):A10 A90 X59 ^ Y 161#263— 165=166E167=169—170E172174—176100% SzTue 21 Apr 18:09:34=custom.logSF [jiminny@localhost] XCascade# concole [pponlA ho_local Uiminny@localnostA console (EU]Review Planhat IntearAutomated Reports RCalendar Multi-Domal+0 ..report-not-generated.blade.phgrun tests and fix if not passingA console [STAGING]e jiminnyseleel * rrun acuivity searches whereSELECT * FROM activity search_filters WHERE activity_search_id =SELECT * FROM automated_ reports where id = 68UPUAIEautomated_reports set playbook categories = NULL where idSELECT * FROM automated_ report_ results where id = 275:o docte ai docset le /A bia eteroftevoposto yie eoye oge tea /Po1/°PHPUnit 11.5.55 by Sebastian Bergmann and contributors.contiguration: Phome/jiminy/phpunit.xmlrvices/Kiosk/AutomatedReports/nAccessAiReportsTest.php 2>&1 ||SELECT * FROM automated_reports order by id desc;SELECT * FROM automated report results order by 1d desc:select * from activity_searches where user_id = 143;selectA| 453 tests pass (6 ore-existina skiooed. 5 unrelated PHPUnit deorecation notices). No fixes needed.SELEC * FROM GrOUOS WHERE 10 = 14591SELECT * FROM usens WHERE aroun id = 1439:select * From permissions: # 158select * from roles:select * from permission_roleselect * from teams where id = 1;select * from groups g JOIN playbooks p 1..n<->1: on g.playbook_idClaude Onuc 47 MediumCurrent versionif (! Sreport->isAskJiminnyReportO) {returnf...array_values ($this->transformGroups(team: Sreport->getTeam, groupsids: Sreport->getGroupsO)).nublie function hasCallTvneConference(AutomatedRenont Srenont): hoollneturn in arnaviself:•CAll TYPE CONEERENCE(Iid' Srenont->aetcallTvneço. true)•Teal ae2 differencesPo. 4 space...
|
66840
|
|
66843
|
NULL
|
0
|
2026-04-21T15:09:37.465843+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776784177465_m1.jpg...
|
Slack
|
releases (Channel) - Jiminny Inc - Slack
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Files
Files
Bookmarks
Bookmarks
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Today at 4:46:06 PM
4:46
New commits deployed to Prophet Prod-US:
[fe16760](
https://github.com/jiminny/prophet/commit/fe16760f5ad8ad751aa6c2699551619b9149a14c
https://github.com/jiminny/prophet/commit/fe16760f5ad8ad751aa6c2699551619b9149a14c
) - [JY-20715](
https://jiminny.atlassian.net/browse/JY-20715
https://jiminny.atlassian.net/browse/JY-20715
) Return 412 code on transcript empty (#487) (ilian-jiminny)
[74e2564](
https://github.com/jiminny/prophet/commit/74e2564886483faee461cde7a86a8789e509519e
https://github.com/jiminny/prophet/commit/74e2564886483faee461cde7a86a8789e509519e
) - Jy 19798 evaluation for ai activity types data (#486) (Nikolay Ivanov)
[a3db1ce](
https://github.com/jiminny/prophet/commit/a3db1ced7e0d2659140afa3d02daac9a6afb7ab1
https://github.com/jiminny/prophet/commit/a3db1ced7e0d2659140afa3d02daac9a6afb7ab1
) - [JY-19798](
https://jiminny.atlassian.net/browse/JY-19798
https://jiminny.atlassian.net/browse/JY-19798
) | Activity type evaluation (#468) (Nikolay Ivanov)
[acf44b3](
https://github.com/jiminny/prophet/commit/acf44b3851a898dca040165a7cc1f8309e40e04e
https://github.com/jiminny/prophet/commit/acf44b3851a898dca040165a7cc1f8309e40e04e
) - [JY-19798](
https://jiminny.atlassian.net/browse/JY-19798
https://jiminny.atlassian.net/browse/JY-19798
) | change ai activity types llm priority (#475) (Nikolay Ivanov)
GitHub
APP
Today at 5:34:28 PM
5:34 PM
5 new commits
5 new commits
pushed to
master
master
by
nikolaybiaivanov
nikolaybiaivanov
3872fca8
3872fca8
- Add Makefile shortcuts for environment toggle commands
6352d781
6352d781
- Merge branch 'master' into feature/add-planet-start-stop-to-make-file
e2859d4d
e2859d4d
- Merge branch 'master' into feature/add-planet-start-stop-to-make-file
4303337d
4303337d
- Merge branch 'master' into feature/add-planet-start-stop-to-make-file
d207a770...
|
[{"role":"AXPopUpButton","text [{"role":"AXPopUpButton","text":"Switch workspaces… (Jiminny Inc) Has new messages","depth":14,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"Home","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Home","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"DMs","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"DMs","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"Activity","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Activity","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"Later","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Later","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"More…","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More","depth":16,"role_description":"text"},{"role":"AXStaticText","text":"Unreads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Threads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Huddles","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Drafts & sent","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Directories","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-x-integration-app","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-inner-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"ai-chapter","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"alerts","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"backend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"c-learning-people","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"confusion-clinic","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"curiosity_lab","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"engineering","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"frontend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"general","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"infra-changes","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-bg","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-copilot-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-zoom-phone-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-tickets","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"product_launches","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"random","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"releases","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"support","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"thank-yous","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"the_people_of_jiminny","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Steliyan Georgiev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Mario Georgiev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Todor Stamatov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Gabriela Dureva","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Petko Kashinski","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Vasil Vasilev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Nikolov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Galya Dimitrova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Stefka Stoyanova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tomov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tanev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Ivanov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Ves","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Jira Cloud","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Toast","depth":23,"role_description":"text"},{"role":"AXRadioButton","text":"Messages","depth":17,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Messages","depth":19,"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":17,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":19,"role_description":"text"},{"role":"AXRadioButton","text":"Bookmarks","depth":17,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Bookmarks","depth":19,"role_description":"text"},{"role":"AXPopUpButton","text":"Add and Edit Channel Tabs","depth":17,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Canvas","depth":17,"role_description":"text"},{"role":"AXStaticText","text":"List","depth":17,"role_description":"text"},{"role":"AXStaticText","text":"Folder","depth":17,"role_description":"text"},{"role":"AXPopUpButton","text":"Jump to date","depth":22,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 4:46:06 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"4:46","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"New commits deployed to Prophet Prod-US:","depth":24,"role_description":"text"},{"role":"AXStaticText","text":"[fe16760](","depth":24,"role_description":"text"},{"role":"AXLink","text":"https://github.com/jiminny/prophet/commit/fe16760f5ad8ad751aa6c2699551619b9149a14c","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"https://github.com/jiminny/prophet/commit/fe16760f5ad8ad751aa6c2699551619b9149a14c","depth":25,"role_description":"text"},{"role":"AXStaticText","text":") - [JY-20715](","depth":24,"role_description":"text"},{"role":"AXLink","text":"https://jiminny.atlassian.net/browse/JY-20715","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"https://jiminny.atlassian.net/browse/JY-20715","depth":25,"role_description":"text"},{"role":"AXStaticText","text":") Return 412 code on transcript empty (#487) (ilian-jiminny)","depth":24,"role_description":"text"},{"role":"AXStaticText","text":"[74e2564](","depth":24,"role_description":"text"},{"role":"AXLink","text":"https://github.com/jiminny/prophet/commit/74e2564886483faee461cde7a86a8789e509519e","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"https://github.com/jiminny/prophet/commit/74e2564886483faee461cde7a86a8789e509519e","depth":25,"role_description":"text"},{"role":"AXStaticText","text":") - Jy 19798 evaluation for ai activity types data (#486) (Nikolay Ivanov)","depth":24,"role_description":"text"},{"role":"AXStaticText","text":"[a3db1ce](","depth":24,"role_description":"text"},{"role":"AXLink","text":"https://github.com/jiminny/prophet/commit/a3db1ced7e0d2659140afa3d02daac9a6afb7ab1","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"https://github.com/jiminny/prophet/commit/a3db1ced7e0d2659140afa3d02daac9a6afb7ab1","depth":25,"role_description":"text"},{"role":"AXStaticText","text":") - [JY-19798](","depth":24,"role_description":"text"},{"role":"AXLink","text":"https://jiminny.atlassian.net/browse/JY-19798","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"https://jiminny.atlassian.net/browse/JY-19798","depth":25,"role_description":"text"},{"role":"AXStaticText","text":") | Activity type evaluation (#468) (Nikolay Ivanov)","depth":24,"role_description":"text"},{"role":"AXStaticText","text":"[acf44b3](","depth":24,"role_description":"text"},{"role":"AXLink","text":"https://github.com/jiminny/prophet/commit/acf44b3851a898dca040165a7cc1f8309e40e04e","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"https://github.com/jiminny/prophet/commit/acf44b3851a898dca040165a7cc1f8309e40e04e","depth":25,"role_description":"text"},{"role":"AXStaticText","text":") - [JY-19798](","depth":24,"role_description":"text"},{"role":"AXLink","text":"https://jiminny.atlassian.net/browse/JY-19798","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"https://jiminny.atlassian.net/browse/JY-19798","depth":25,"role_description":"text"},{"role":"AXStaticText","text":") | change ai activity types llm priority (#475) (Nikolay Ivanov)","depth":24,"role_description":"text"},{"role":"AXButton","text":"GitHub","depth":23,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"APP","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"","depth":23,"role_description":"text"},{"role":"AXLink","text":"Today at 5:34:28 PM","depth":23,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:34 PM","depth":24,"role_description":"text"},{"role":"AXLink","text":"5 new commits","depth":23,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5 new commits","depth":24,"role_description":"text"},{"role":"AXStaticText","text":"pushed to","depth":23,"role_description":"text"},{"role":"AXLink","text":"master","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"master","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"by","depth":23,"role_description":"text"},{"role":"AXLink","text":"nikolaybiaivanov","depth":23,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"nikolaybiaivanov","depth":24,"role_description":"text"},{"role":"AXLink","text":"3872fca8","depth":26,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"3872fca8","depth":27,"role_description":"text"},{"role":"AXStaticText","text":"- Add Makefile shortcuts for environment toggle commands","depth":25,"role_description":"text"},{"role":"AXLink","text":"6352d781","depth":26,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6352d781","depth":27,"role_description":"text"},{"role":"AXStaticText","text":"- Merge branch 'master' into feature/add-planet-start-stop-to-make-file","depth":25,"role_description":"text"},{"role":"AXLink","text":"e2859d4d","depth":26,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"e2859d4d","depth":27,"role_description":"text"},{"role":"AXStaticText","text":"- Merge branch 'master' into feature/add-planet-start-stop-to-make-file","depth":25,"role_description":"text"},{"role":"AXLink","text":"4303337d","depth":26,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"4303337d","depth":27,"role_description":"text"},{"role":"AXStaticText","text":"- Merge branch 'master' into feature/add-planet-start-stop-to-make-file","depth":25,"role_description":"text"},{"role":"AXLink","text":"d207a770","depth":26,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-5874917525198510412
|
-8071619460733288943
|
visual_change
|
hybrid
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Files
Files
Bookmarks
Bookmarks
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Today at 4:46:06 PM
4:46
New commits deployed to Prophet Prod-US:
[fe16760](
https://github.com/jiminny/prophet/commit/fe16760f5ad8ad751aa6c2699551619b9149a14c
https://github.com/jiminny/prophet/commit/fe16760f5ad8ad751aa6c2699551619b9149a14c
) - [JY-20715](
https://jiminny.atlassian.net/browse/JY-20715
https://jiminny.atlassian.net/browse/JY-20715
) Return 412 code on transcript empty (#487) (ilian-jiminny)
[74e2564](
https://github.com/jiminny/prophet/commit/74e2564886483faee461cde7a86a8789e509519e
https://github.com/jiminny/prophet/commit/74e2564886483faee461cde7a86a8789e509519e
) - Jy 19798 evaluation for ai activity types data (#486) (Nikolay Ivanov)
[a3db1ce](
https://github.com/jiminny/prophet/commit/a3db1ced7e0d2659140afa3d02daac9a6afb7ab1
https://github.com/jiminny/prophet/commit/a3db1ced7e0d2659140afa3d02daac9a6afb7ab1
) - [JY-19798](
https://jiminny.atlassian.net/browse/JY-19798
https://jiminny.atlassian.net/browse/JY-19798
) | Activity type evaluation (#468) (Nikolay Ivanov)
[acf44b3](
https://github.com/jiminny/prophet/commit/acf44b3851a898dca040165a7cc1f8309e40e04e
https://github.com/jiminny/prophet/commit/acf44b3851a898dca040165a7cc1f8309e40e04e
) - [JY-19798](
https://jiminny.atlassian.net/browse/JY-19798
https://jiminny.atlassian.net/browse/JY-19798
) | change ai activity types llm priority (#475) (Nikolay Ivanov)
GitHub
APP
Today at 5:34:28 PM
5:34 PM
5 new commits
5 new commits
pushed to
master
master
by
nikolaybiaivanov
nikolaybiaivanov
3872fca8
3872fca8
- Add Makefile shortcuts for environment toggle commands
6352d781
6352d781
- Merge branch 'master' into feature/add-planet-start-stop-to-make-file
e2859d4d
e2859d4d
- Merge branch 'master' into feature/add-planet-start-stop-to-make-file
4303337d
4303337d
- Merge branch 'master' into feature/add-planet-start-stop-to-make-file
d207a770
iTerm2ShellEditViewSessionScriptsProfilesWindowHelp•docker₴2docker* Build full day activity...• *4|screenpipe*DOCKERO ₴1-zshworker-nudges:worker-nudges_00: startedWhat's next:Try Docker Debug for seamless, persistent debugging tools in any container or image + docker debug docker_lamp_1Learn moreat [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-18909-automated-reports-ask-jiminny) $ csfixdockerexec -it docker_lamp_1./vendor/bin/php-cs-fixer fix--config=.php-cs-fixer.dist.php -v --using-cache=no --diffPHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.PHPruntime:8.3.30Running analysis on 7 cores with 10 files per process.Parallel runner is an experimental feature and may be unstable, use it at your own risk. Feedback highly appreciated!Loadedconfigdefault from-php-cs-fixer.dist.php".5609/5609100%Fixed 0 of 5609 files in 36.627 seconds, 60.00 MB memory usedWhat's next:Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-18909-automated-reports-ask-jiminny) $ ||...
|
66841
|
|
66844
|
1505
|
0
|
2026-04-21T15:09:56.298750+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776784196298_m1.jpg...
|
PhpStorm
|
faVsco.js – AutomatedReportsServiceTest.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsServiceTest
Run 'AutomatedReportsServiceTest'
Debug 'AutomatedReportsServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
10
90
59
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Tests\Unit\Services\Kiosk\AutomatedReports;
use Carbon\Carbon;
use Illuminate\Support\Carbon as IlluminateCarbon;
use Illuminate\Contracts\Bus\Dispatcher;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Jiminny\Component\AskAnything\AskAnythingPromptService;
use Jiminny\Component\AskAnything\Dtos\AskAnythingPromptDto;
use Jiminny\Component\UrlGenerator\Webhook;
use Jiminny\Contracts\Repositories\PlaybookCategoryRepository;
use Jiminny\Contracts\Repositories\TeamRepository;
use Jiminny\Contracts\Repositories\UserRepository;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Exceptions\ModelNotFoundException;
use Illuminate\Support\Collection;
use Jiminny\Models\AskAnything\AskAnythingPrompt;
use Jiminny\Models\AskAnything\AskAnythingPromptTarget;
use Jiminny\Models\Activity\Search;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Group;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AskAnythingRepository;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Repositories\GroupRepository;
use Jiminny\Repositories\SearchRepository;
use Jiminny\Repositories\StageRepository;
use Jiminny\Services\Kiosk\AutomatedReports\ActivityTypeService;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\Kiosk\AutomatedReports\DealStagesService;
use Jiminny\Services\Kiosk\AutomatedReports\RecipientsService;
use Mockery;
use PHPUnit\Framework\Attributes\DataProvider;
use Tests\TestCase;
class AutomatedReportsServiceTest extends TestCase
{
private AutomatedReportsService $service;
protected function setUp(): void
{
parent::setUp();
// Create a real instance of the service without calling the constructor
$reflection = new \ReflectionClass(AutomatedReportsService::class);
$this->service = $reflection->newInstanceWithoutConstructor();
// Manually set the dependencies using reflection
$dependencies = [
'teamRepository' => TeamRepository::class,
'groupRepository' => GroupRepository::class,
'userRepository' => UserRepository::class,
'stageRepository' => StageRepository::class,
'dealStagesService' => DealStagesService::class,
'recipientsService' => RecipientsService::class,
'automatedReportsRepository' => AutomatedReportsRepository::class,
'webhookService' => Webhook::class,
'dispatcher' => Dispatcher::class,
'activityTypeService' => ActivityTypeService::class,
'playbookCategoryRepository' => PlaybookCategoryRepository::class,
'askAnythingPromptService' => AskAnythingPromptService::class,
'activitySearchRepository' => SearchRepository::class,
'askAnythingRepository' => AskAnythingRepository::class,
];
foreach ($dependencies as $propertyName => $class) {
$property = $reflection->getProperty($propertyName);
$property->setAccessible(true);
$property->setValue($this->service, $this->createMock($class));
}
}
protected function tearDown(): void
{
parent::tearDown();
Mockery::close();
}
private function getService(
$mockUserRepository = null,
$mockStageRepository = null,
$mockTeamRepository = null,
): AutomatedReportsService {
return new AutomatedReportsService(
($mockTeamRepository ?? $this->createMock(TeamRepository::class)),
$this->createMock(GroupRepository::class),
($mockUserRepository ?? $this->createMock(UserRepository::class)),
($mockStageRepository ?? $this->createMock(StageRepository::class)),
$this->createMock(DealStagesService::class),
$this->createMock(RecipientsService::class),
$this->createMock(AutomatedReportsRepository::class),
$this->createMock(Webhook::class),
$this->createMock(Dispatcher::class),
$this->createMock(ActivityTypeService::class),
$this->createMock(PlaybookCategoryRepository::class),
$this->createMock(AskAnythingPromptService::class),
$this->createMock(SearchRepository::class),
$this->createMock(AskAnythingRepository::class),
);
}
#[DataProvider('transformMediaTypesDataProvider')]
public function testTransformMediaTypes(array $mediaTypes, array $expected): void
{
$report = new AutomatedReport(['media_types' => $mediaTypes]);
$reflection = new \ReflectionClass(AutomatedReportsService::class);
$method = $reflection->getMethod('transformMediaTypes');
$result = $method->invoke($this->service, $report);
$this->assertEquals($expected, $result);
}
public function testGetMediaTypeFieldDataWithoutReport(): void
{
$result = $this->service->getMediaTypeFieldData(null);
$this->assertIsArray($result);
$this->assertArrayHasKey('value', $result);
$this->assertEmpty($result['value']);
$this->assertEquals('media_types', $result['id']);
}
public function testGetMediaTypeFieldDataWithReport(): void
{
$mediaTypes = ['pdf', 'podcast'];
$report = new AutomatedReport(['media_types' => $mediaTypes]);
$result = $this->service->getMediaTypeFieldData($report);
$expectedValue = [
['id' => 'pdf', 'name' => 'PDF'],
['id' => 'podcast', 'name' => 'Podcast'],
];
$this->assertIsArray($result);
$this->assertArrayHasKey('value', $result);
$this->assertEquals($expectedValue, $result['value']);
}
public static function transformMediaTypesDataProvider(): array
{
return [
'empty array' => [
'mediaTypes' => [],
'expected' => [],
],
'pdf only' => [
'mediaTypes' => ['pdf'],
'expected' => [
['id' => 'pdf', 'name' => 'PDF'],
],
],
'podcast only' => [
'mediaTypes' => ['podcast'],
'expected' => [
['id' => 'podcast', 'name' => 'Podcast'],
],
],
'both pdf and podcast' => [
'mediaTypes' => ['pdf', 'podcast'],
'expected' => [
['id' => 'pdf', 'name' => 'PDF'],
['id' => 'podcast', 'name' => 'Podcast'],
],
],
'with invalid type' => [
'mediaTypes' => ['pdf', 'invalid', 'podcast'],
'expected' => [
['id' => 'pdf', 'name' => 'PDF'],
['id' => 'podcast', 'name' => 'Podcast'],
],
],
];
}
#[DataProvider('hasCallTypeConferenceDataProvider')]
public function testHasCallTypeConference(array $callTypes, bool $expected): void
{
$report = $this->createMock(AutomatedReport::class);
$report->method('getCallTypes')->willReturn($callTypes);
$result = $this->service->hasCallTypeConference($report);
$this->assertEquals($expected, $result);
}
#[DataProvider('hasCallTypeDialerDataProvider')]
public function testHasCallTypeDialer(array $callTypes, bool $expected): void
{
$report = $this->createMock(AutomatedReport::class);
$report->method('getCallTypes')->willReturn($callTypes);
$result = $this->service->hasCallTypeDialer($report);
$this->assertEquals($expected, $result);
}
public static function hasCallTypeConferenceDataProvider(): array
{
return [
'has conference' => [
'callTypes' => ['conference', 'dialer'],
'expected' => true,
],
'does not have conference' => [
'callTypes' => ['dialer', 'other'],
'expected' => false,
],
'empty call types' => [
'callTypes' => [],
'expected' => false,
],
];
}
public static function hasCallTypeDialerDataProvider(): array
{
return [
'has dialer' => [
'callTypes' => ['conference', 'dialer'],
'expected' => true,
],
'does not have dialer' => [
'callTypes' => ['conference', 'other'],
'expected' => false,
],
'empty call types' => [
'callTypes' => [],
'expected' => false,
],
];
}
public function testTransformReportResultsWithEmptyCollection(): void
{
$emptyCollection = new Collection([]);
$result = $this->service->transformReportResults($emptyCollection);
$this->assertIsArray($result);
$this->assertEmpty($result);
}
public function testTransformReportResultsStructure(): void
{
// Create a mock AutomatedReportResult with minimal setup to test structure
$mockReportResult = $this->createMockReportResult();
$collection = new Collection([$mockReportResult]);
$result = $this->service->transformReportResults($collection);
$this->assertIsArray($result);
$this->assertCount(1, $result);
$transformedResult = $result[0];
// Verify all expected keys are present
$expectedKeys = [
'id', 'name', 'frequency', 'recipients',
'report_type', 'media_type', 'downloadUrl', 'viewUrl', 'generated_at',
];
foreach ($expectedKeys as $key) {
$this->assertArrayHasKey($key, $transformedResult);
}
// Verify structure of nested arrays
$this->assertIsArray($transformedResult['frequency']);
$this->assertArrayHasKey('id', $transformedResult['frequency']);
$this->assertArrayHasKey('name', $transformedResult['frequency']);
$this->assertIsArray($transformedResult['report_type']);
$this->assertArrayHasKey('id', $transformedResult['report_type']);
$this->assertArrayHasKey('name', $transformedResult['report_type']);
$this->assertIsArray($transformedResult['recipients']);
// Verify TODO fields are null as expected
$this->assertEquals(AutomatedReportsService::MEDIA_TYPE_PODCAST, $transformedResult['media_type']);
$this->assertEquals(route('ai-reports.audio.download', ['uuid' => 'test-uuid']), $transformedResult['downloadUrl']);
$this->assertEquals(route('ai-reports.audio.view', ['uuid' => 'test-uuid']), $transformedResult['viewUrl']);
}
public function testTransformReportResultsWithMultipleResults(): void
{
$mockReportResult1 = $this->createMockReportResult('result-uuid-1', 'exec_summary');
$mockReportResult2 = $this->createMockReportResult('result-uuid-2', 'coaching_profiles');
$collection = new Collection([$mockReportResult1, $mockReportResult2]);
$result = $this->service->transformReportResults($collection);
$this->assertIsArray($result);
$this->assertCount(2, $result);
// Verify different UUIDs
$this->assertEquals('result-uuid-1', $result[0]['id']);
$this->assertEquals('result-uuid-2', $result[1]['id']);
// Verify both results have the expected structure
foreach ($result as $transformedResult) {
$this->assertArrayHasKey('id', $transformedResult);
$this->assertArrayHasKey('name', $transformedResult);
$this->assertArrayHasKey('frequency', $transformedResult);
$this->assertArrayHasKey('recipients', $transformedResult);
$this->assertArrayHasKey('report_type', $transformedResult);
}
}
#[DataProvider('isUserRecipientOfReportDataProvider')]
public function testIsUserRecipientOfReport(int $userId, array $recipients, bool $expected): void
{
// Create mock User
$mockUser = $this->createMock(\Jiminny\Models\User::class);
$mockUser->method('getId')->willReturn($userId);
// Create mock AutomatedReport
$mockReport = $this->createMock(AutomatedReport::class);
$mockReport->method('getRecipients')->willReturn($recipients);
$result = $this->service->isUserRecipientOfReport($mockUser, $mockReport);
$this->assertEquals($expected, $result);
}
public function testIsUserRecipientOfReportWithEmptyRecipients(): void
{
// Create mock User
$mockUser = $this->createMock(\Jiminny\Models\User::class);
$mockUser->method('getId')->willReturn(123);
// Create mock AutomatedReport with no recipients
$mockReport = $this->createMock(AutomatedReport::class);
$mockReport->method('getRecipients')->willReturn([]);
$result = $this->service->isUserRecipientOfReport($mockUser, $mockReport);
$this->assertFalse($result);
}
public function testIsUserRecipientOfReportWithNoUsersKey(): void
{
// Create mock User
$mockUser = $this->createMock(\Jiminny\Models\User::class);
$mockUser->method('getId')->willReturn(123);
// Create mock AutomatedReport with recipients but no 'users' key
$mockReport = $this->createMock(AutomatedReport::class);
$mockReport->method('getRecipients')->willReturn(['other_key' => [456, 789]]);
$result = $this->service->isUserRecipientOfReport($mockUser, $mockReport);
$this->assertFalse($result);
}
public static function isUserRecipientOfReportDataProvider(): array
{
return [
'user is recipient - single user' => [
'userId' => 123,
'recipients' => ['users' => [123]],
'expected' => true,
],
'user is recipient - multiple users' => [
'userId' => 456,
'recipients' => ['users' => [123, 456, 789]],
'expected' => true,
],
'user is not recipient - single user' => [
'userId' => 999,
'recipients' => ['users' => [123]],
'expected' => false,
],
'user is not recipient - multiple users' => [
'userId' => 999,
'recipients' => ['users' => [123, 456, 789]],
'expected' => false,
],
'user is recipient - string IDs converted to int' => [
'userId' => 123,
'recipients' => ['users' => ['123', '456']],
'expected' => true,
],
'user is not recipient - string IDs converted to int' => [
'userId' => 999,
'recipients' => ['users' => ['123', '456']],
'expected' => false,
],
'empty users array' => [
'userId' => 123,
'recipients' => ['users' => []],
'expected' => false,
],
];
}
private function createMockReportResult(string $uuid = 'test-uuid', string $reportType = 'exec_summary'): AutomatedReportResult
{
// Create mock AutomatedReport
$mockReport = $this->createMock(AutomatedReport::class);
$mockReport->method('getFrequency')->willReturn('weekly');
$mockReport->method('getRecipients')->willReturn(['users' => [1, 2]]);
$mockReport->method('getGroups')->willReturn([10, 20]);
$mockReport->method('getType')->willReturn($reportType);
// Create mock Team
$mockTeam = $this->createMock(\Jiminny\Models\Team::class);
// Create mock Group
$mockGroup = $this->createMock(\Jiminny\Models\Group::class);
$mockGroup->method('getUuid')->willReturn('group-uuid-10');
$mockGroup->method('getName')->willReturn('Test Team');
$mockQueryBuilder = Mockery::mock();
$mockQueryBuilder->shouldReceive('where')->andReturnSelf();
$mockQueryBuilder->shouldReceive('first')->andReturn($mockGroup);
$dataRelation = Mockery::mock(HasMany::class);
$dataRelation->shouldReceive('where')->andReturn($mockQueryBuilder);
$dataRelation->shouldReceive('get')->andReturn(
new \Illuminate\Database\Eloquent\Collection([$mockGroup])
);
$mockTeam->method('groups')->willReturn($dataRelation);
$mockReport->method('getTeam')->willReturn($mockTeam);
// Create mock AutomatedReportResult
$mockReportResult = $this->createMock(AutomatedReportResult::class);
$mockReportResult->method('getUuid')->willReturn($uuid);
$mockReportResult->method('getGeneratedAt')->willReturn(
\Illuminate\Support\Carbon::parse('2024-01-15T10:30:00Z')
);
$mockReportResult->method('getReport')->willReturn($mockReport);
// Mock methods used in getReportFileName
$mockReportResult->method('getReportType')->willReturn($reportType);
$mockReportResult->method('getFromDate')->willReturn(
\Illuminate\Support\Carbon::parse('2024-01-08')
);
$mockReportResult->method('getToDate')->willReturn(
\Illuminate\Support\Carbon::parse('2024-01-15')
);
$mockReportResult->method('getGroups')->willReturn([10]);
$mockReportResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PODCAST);
return $mockReportResult;
}
#[DataProvider('getUsersUuidsDataProvider')]
public function testGetUsersUuids(array $recipients, array $mockUsers, array $expectedUuids): void
{
// Create mock UserRepository
$mockUserRepository = $this->createMock(UserRepository::class);
// Configure the mock to return specific users for specific IDs using a callback
$mockUserRepository->method('find')
->willReturnCallback(function ($userId) use ($mockUsers) {
if (! isset($mockUsers[$userId])) {
return null;
}
$userUuid = $mockUsers[$userId]['uuid'] ?? null;
if ($userUuid === null) {
return null;
}
$mockUser = $this->createMock(\Jiminny\Models\User::class);
$mockUser->method('getUuid')->willReturn((string) $userUuid);
return $mockUser;
});
// Create service with mocked UserRepository
$automatedReportsService = $this->getService(mockUserRepository: $mockUserRepository);
// Create mock AutomatedReport
$mockReport = $this->createMock(AutomatedReport::class);
$mockReport->method('getRecipients')->willReturn($recipients);
$result = $automatedReportsService->getUsersUuids($mockReport);
$this->assertEquals($expectedUuids, $result);
}
public function testGetUsersUuidsWithEmptyRecipients(): void
{
// Create mock AutomatedReport with empty recipients
$mockReport = $this->createMock(AutomatedReport::class);
$mockReport->method('getRecipients')->willReturn([]);
$result = $this->service->getUsersUuids($mockReport);
$this->assertEquals([], $result);
}
public function testGetUsersUuidsWithNoUsersKey(): void
{
// Create mock AutomatedReport with recipients but no 'users' key
$mockReport = $this->createMock(AutomatedReport::class);
$mockReport->method('getRecipients')->willReturn(['other_key' => [1, 2, 3]]);
$result = $this->service->getUsersUuids($mockReport);
$this->assertEquals([], $result);
}
public function testGetUsersUuidsWithNonExistentUsers(): void
{
// Create mock UserRepository that returns null for all users
$mockUserRepository = $this->createMock(UserRepository::class);
$mockUserRepository->method('find')->willReturn(null);
// Create service with mocked UserRepository
$automatedReportsService = $this->getService(mockUserRepository: $mockUserRepository);
// Create mock AutomatedReport
$mockReport = $this->createMock(AutomatedReport::class);
$mockReport->method('getRecipients')->willReturn(['users' => [1, 2, 3]]);
$result = $automatedReportsService->getUsersUuids($mockReport);
// Should return array with null values for non-existent users
$this->assertEquals([], $result);
}
public static function getUsersUuidsDataProvider(): array
{
return [
'single user found' => [
'recipients' => ['users' => [123]],
'mockUsers' => [
123 => ['id' => 123, 'uuid' => 'user-uuid-123'],
],
'expectedUuids' => ['user-uuid-123'],
],
'multiple users found' => [
'recipients' => ['users' => [123, 456, 789]],
'mockUsers' => [
123 => ['id' => 123, 'uuid' => 'user-uuid-123'],
456 => ['id' => 456, 'uuid' => 'user-uuid-456'],
789 => ['id' => 789, 'uuid' => 'user-uuid-789'],
],
'expectedUuids' => ['user-uuid-123', 'user-uuid-456', 'user-uuid-789'],
],
'mixed found and not found users' => [
'recipients' => ['users' => [123, 456, 789]],
'mockUsers' => [
123 => ['id' => 123, 'uuid' => 'user-uuid-123'],
// 456 not found in DB
789 => ['id' => 789, 'uuid' => 'user-uuid-789'],
],
'expectedUuids' => ['user-uuid-123', 'user-uuid-789'], // Updated to reflect that nulls are filtered out
],
'empty users array' => [
'recipients' => ['users' => []],
'mockUsers' => [],
'expectedUuids' => [],
],
'all users not found' => [
'recipients' => ['users' => [123, 456]],
'mockUsers' => [], // No users found
'expectedUuids' => [], // Updated to reflect that nulls are filtered out
],
];
}
#[DataProvider('getCurrentDealStagesUuidsDataProvider')]
public function testGetCurrentDealStagesUuids(array $currentDealStages, array $mockStages, array $expectedUuids): void
{
// Create mock StageRepository
$mockStageRepository = $this->createMock(StageRepository::class);
// Configure the mock to return specific stages for specific IDs using a callback
$mockStageRepository->method('find')
->willReturnCallback(function ($stageId) use ($mockStages) {
if (! isset($mockStages[$stageId])) {
return null;
}
$stageUuid = $mockStages[$stageId]['uuid'] ?? null;
if ($stageUuid === null) {
return null;
}
$mockStage = $this->createMock(\Jiminny\Models\Stage::class);
$mockStage->method('getUuid')->willReturn((string) $stageUuid);
return $mockStage;
});
// Create service with mocked StageRepository
$automatedReportsService = $this->getService(mockStageRepository: $mockStageRepository);
// Create mock AutomatedReport
$mockReport = $this->createMock(AutomatedReport::class);
$mockReport->method('getCurrentDealStages')->willReturn($currentDealStages);
$result = $automatedReportsService->getCurrentDealStagesUuids($mockReport);
$this->assertEquals($expectedUuids, $result);
}
public function testGetCurrentDealStagesUuidsWithEmptyStages(): void
{
// Create mock AutomatedReport with empty current deal stages
$mockReport = $this->createMock(AutomatedReport::class);
$mockReport->method('getCurrentDealStages')->willReturn([]);
$result = $this->service->getCurrentDealStagesUuids($mockReport);
$this->assertEquals([], $result);
}
public function testGetCurrentDealStagesUuidsWithNonExistentStages(): void
{
// Create mock StageRepository that returns null for all stages
$mockStageRepository = $this->createMock(StageRepository::class);
$mockStageRepository->method('find')->willReturn(null);
// Create service with mocked StageRepository
$automatedReportsService = $this->getService(mockStageRepository: $mockStageRepository);
// Create mock AutomatedReport
$mockReport = $this->createMock(AutomatedReport::class);
$mockReport->method('getCurrentDealStages')->willReturn([1, 2, 3]);
$result = $automatedReportsService->getCurrentDealStagesUuids($mockReport);
// Should return array with null values for non-existent stages
$this->assertEquals([], $result);
}
public static function getCurrentDealStagesUuidsDataProvider(): array
{
return [
'single stage found' => [
'currentDealStages' => [10],
'mockStages' => [
10 => ['id' => 10, 'uuid' => 'stage-uuid-10'],
],
'expectedUuids' => ['stage-uuid-10'],
],
'multiple stages found' => [
'currentDealStages' => [10, 20, 30],
'mockStages' => [
10 => ['id' => 10, 'uuid' => 'stage-uuid-10'],
20 => ['id' => 20, 'uuid' => 'stage-uuid-20'],
30 => ['id' => 30, 'uuid' => 'stage-uuid-30'],
],
'expectedUuids' => ['stage-uuid-10', 'stage-uuid-20', 'stage-uuid-30'],
],
'mixed found and not found stages' => [
'currentDealStages' => [10, 20, 30],
'mockStages' => [
10 => ['id' => 10, 'uuid' => 'stage-uuid-10'],
// 20 not found in DB
30 => ['id' => 30, 'uuid' => 'stage-uuid-30'],
],
'expectedUuids' => ['stage-uuid-10', 'stage-uuid-30'], // Updated to reflect that nulls are filtered out
],
'empty stages array' => [
'currentDealStages' => [],
'mockStages' => [],
'expectedUuids' => [],
],
'all stages not found' => [
'currentDealStages' => [10, 20],
'mockStages' => [], // No stages found
'expectedUuids' => [], // Updated to reflect that nulls are filtered out
],
];
}
#[DataProvider('getTeamGroupsDataProvider')]
public function testGetTeamGroups(string $teamUuid, ?array $mockTeamData, array $mockGroups, array $expectedResult): void
{
// Create mock TeamRepository
$mockTeamRepository = $this->createMock(TeamRepository::class);
if ($mockTeamData === null) {
// Team not found
$mockTeamRepository->method('idOrUuid')
->with($teamUuid)
->willReturn(null);
} else {
// Team found - create mock team with groups
$mockTeam = $this->createMock(\Jiminny\Models\Team::class);
// Create mock groups collection
$mockGroupsCollection = $this->createMock(\Illuminate\Database\Eloquent\Collection::class);
// Create mock Group objects
$groupObjects = [];
foreach ($mockGroups as $groupData) {
$mockGroup = $this->createMock(\Jiminny\Models\Group::class);
$mockGroup->method('getUuid')->willReturn($groupData['id']);
$mockGroup->method('getName')->willReturn($groupData['name']);
$groupObjects[] = $mockGroup;
}
// Mock the groups collection to return our mock groups
$mockGroupsCollection->method('getIterator')->willReturn(new \ArrayIterator($groupObjects));
// Mock the groups() relation
$mockGroupsRelation = $this->createMock(\Illuminate\Database\Eloquent\Relations\HasMany::class);
$mockGroupsRelation->method('get')->willReturn($mockGroupsCollection);
$mockTeam->method('groups')->willReturn($mockGroupsRelation);
$mockTeamRepository->method('idOrUuid')
->with($teamUuid)
->willReturn($mockTeam);
}
// Create service with mocked TeamRepository
$automatedReportsService = $this->getService(mockTeamRepository: $mockTeamRepository);
$result = $automatedReportsService->getTeamGroups($teamUuid);
$this->assertEquals($expectedResult, $result);
}
public function testGetTeamGroupsWithNonExistentTeam(): void
{
// Create mock TeamRepository that returns null (team not found)
$mockTeamRepository = $this->createMock(TeamRepository::class);
$mockTeamRepository->method('idOrUuid')->willReturn(null);
// Create service with mocked TeamRepository
$automatedReportsService = $this->getService(mockTeamRepository: $mockTeamRepository);
$result = $automatedReportsService->getTeamGroups('non-existent-team-uuid');
$this->assertEquals([], $result);
}
public function testGetTeamGroupsWithEmptyGroups(): void
{
// Create mock team with no groups
$mockTeam = $this->createMock(\Jiminny\Models\Team::class);
// Create empty groups collection
$mockGroupsCollection = $this->createMock(\Illuminate\Database\Eloquent\Collection::class);
$mockGroupsCollection->method('getIterator')->willReturn(new \ArrayIterator([]));
$mockGroupsRelation = $this->createMock(\Illuminate\Database\Eloquent\Relations\HasMany::class);
$mockGroupsRelation->method('get')->willReturn($mockGroupsCollection);
$mockTeam->method('groups')->willReturn($mockGroupsRelation);
// Create mock TeamRepository
$mockTeamRepository = $this->createMock(TeamRepository::class);
$mockTeamRepository->method('idOrUuid')->willReturn($mockTeam);
// Create service with mocked TeamRepository
$automatedReportsService = $this->getService(mockTeamRepository: $mockTeamRepository);
$result = $automatedReportsService->getTeamGroups('team-with-no-groups');
$this->assertEquals([], $result);
}
public static function getTeamGroupsDataProvider(): array
{
return [
'team with single group' => [
'teamUuid' => 'team-uuid-123',
'mockTeamData' => ['id' => 'team-uuid-123', 'name' => 'Test Team'],
'mockGroups' => [
['id' => 'group-uuid-1', 'name' => 'Sales Team'],
],
'expectedResult' => [
['id' => 'group-uuid-1', 'name' => 'Sales Team'],
],
],
'team with multiple groups' => [
'teamUuid' => 'team-uuid-456',
'mockTeamData' => ['id' => 'team-uuid-456', 'name' => 'Another Team'],
'mockGroups' => [
['id' => 'group-uuid-1', 'name' => 'Sales Team'],
['id' => 'group-uuid-2', 'name' => 'Marketing Team'],
['id' => 'group-uuid-3', 'name' => 'Support Team'],
],
'expectedResult' => [
['id' => 'group-uuid-1', 'name' => 'Sales Team'],
['id' => 'group-uuid-2', 'name' => 'Marketing Team'],
['id' => 'group-uuid-3', 'name' => 'Support Team'],
],
],
'team not found' => [
'teamUuid' => 'non-existent-uuid',
'mockTeamData' => null,
'mockGroups' => [],
'expectedResult' => [],
],
'team with no groups' => [
'teamUuid' => 'team-uuid-empty',
'mockTeamData' => ['id' => 'team-uuid-empty', 'name' => 'Empty Team'],
'mockGroups' => [],
'expectedResult' => [],
],
];
}
#[DataProvider('getTeamsDataProvider')]
public function testGetTeams(array $mockTeams, array $expectedResult): void
{
// Create mock TeamRepository
$mockTeamRepository = $this->createMock(TeamRepository::class);
// Create mock Team objects
$teamObjects = [];
foreach ($mockTeams as $teamData) {
$mockTeam = $this->createMock(\Jiminny\Models\Team::class);
$mockTeam->method('getUuid')->willReturn($teamData['id']);
$mockTeam->method('getName')->willReturn($teamData['name']);
$mockTeam->method('hasFeature')
->with(\Jiminny\Models\Feature\FeatureEnum::AUTOMATED_REPORTS)
->willReturn($teamData['hasAutomatedReports']);
$teamObjects[] = $mockTeam;
}
// Mock the repository to return a Collection (not array)
$mockTeamRepository->method('getTeamsForKiosk')
->with('active')
->willReturn(new Collection($teamObjects));
// Create service with mocked TeamRepository
$automatedReportsService = $this->getService(mockTeamRepository: $mockTeamRepository);
$result = $automatedReportsService->getTeams();
$this->assertEquals($expectedResult, $result);
}
public function testGetTeamsWithNoTeams(): void
{
// Create mock TeamRepository that returns empty Collection
$mockTeamRepository = $this->createMock(TeamRepository::class);
$mockTeamRepository->method('getTeamsForKiosk')->willReturn(new Collection([]));
// Create service with mocked TeamRepository
$automatedReportsService = $this->getService(mockTeamRepository: $mockTeamRepository);
$result = $automatedReportsService->getTeams();
$this->assertEquals([], $result);
}
public function testGetTeamsWithAllTeamsWithoutFeature(): void
{
// Create mock teams without AUTOMATED_REPORTS feature
$mockTeam1 = $this->createMock(\Jiminny\Models\Team::class);
$mockTeam1->method('hasFeature')
->with(\Jiminny\Models\Feature\FeatureEnum::AUTOMATED_REPORTS)
->willReturn(false);
$mockTeam2 = $this->createMock(\Jiminny\Models\Team::class);
$mockTeam2->method('hasFeature')
->with(\Jiminny\Models\Feature\FeatureEnum::AUTOMATED_REPORTS)
->willReturn(false);
// Create mock TeamRepository that returns Collection
$mockTeamRepository = $this->createMock(TeamRepository::class);
$mockTeamRepository->method('getTeamsForKiosk')->willReturn(new Collection([$mockTeam1, $mockTeam2]));
// Create service with mocked TeamRepository
$automatedReportsService = $this->getService(mockTeamRepository: $mockTeamRepository);
$result = $automatedReportsService->getTeams();
$this->assertEquals([], $result);
}
public static function getTeamsDataProvider(): array
{
return [
'single team with feature' => [
'mockTeams' => [
[
'id' => 'team-uuid-1',
'name' => 'Sales Team',
'hasAutomatedReports' => true,
],
],
'expectedResult' => [
['id' => 'team-uuid-1', 'name' => 'Sales Team'],
],
],
'multiple teams with feature' => [
'mockTeams' => [
[
'id' => 'team-uuid-1',
'name' => 'Sales Team',
'hasAutomatedReports' => true,
],
[
'id' => 'team-uuid-2',
'name' => 'Marketing Team',
'hasAutomatedReports' => true,
],
[
'id' => 'team-uuid-3',
'name' => 'Support Team',
'hasAutomatedReports' => true,
],
],
'expectedResult' => [
['id' => 'team-uuid-1', 'name' => 'Sales Team'],
['id' => 'team-uuid-2', 'name' => 'Marketing Team'],
['id' => 'team-uuid-3', 'name' => 'Support Team'],
],
],
'mixed teams - some with feature, some without' => [
'mockTeams' => [
[
'id' => 'team-uuid-1',
'name' => 'Sales Team',
'hasAutomatedReports' => true,
],
[
'id' => 'team-uuid-2',
'name' => 'Marketing Team',
'hasAutomatedReports' => false,
],
[
'id' => 'team-uuid-3',
'name' => 'Support Team',
'hasAutomatedReports' => true,
],
],
'expectedResult' => [
['id' => 'team-uuid-1', 'name' => 'Sales Team'],
['id' => 'team-uuid-3', 'name' => 'Support Team'],
],
],
'all teams without feature' => [
'mockTeams' => [
[
'id' => 'team-uuid-1',
'name' => 'Sales Team',
'hasAutomatedReports' => false,
],
[
'id' => 'team-uuid-2',
'name' => 'Marketing Team',
'hasAutomatedReports' => false,
],
],
'expectedResult' => [],
],
'empty teams array' => [
'mockTeams' => [],
'expectedResult' => [],
],
];
}
#[DataProvider('deleteS3FilesDataProvider')]
public function testDeleteS3Files(
string $mediaType,
array $expectedFileExtensions,
array $existingFiles,
string $pathSuffix,
int $expectedDeletes
): void {
// Arrange
$teamUuid = 'team-uuid-123';
$reportUuid = 'report-uuid-456';
$basePath = sprintf('%s/reports/%s', $teamUuid, $reportUuid);
$team = Mockery::mock(Team::class);
$team->allows('getUuid')->andReturn($teamUuid);
$report = Mockery::mock(AutomatedReport::class);
$report->allows('getTeam')->andReturn($team);
$result = Mockery::mock(AutomatedReportResult::class);
$result->allows('getReport')->andReturn($report);
$result->allows('getUuid')->andReturn($reportUuid);
$result->allows('getMediaType')->andReturn($mediaType);
Storage::fake();
Log::shouldReceive('info')->times($expectedDeletes);
foreach ($existingFiles as $extension) {
$filePath = $basePath . $pathSuffix . '.' . $extension;
Storage::put($filePath, 'dummy content');
}
// Act
$this->service->deleteS3Files($result);
// Assert
foreach ($expectedFileExtensions as $extension) {
$filePath = $basePath . $pathSuffix . '.' . $extension;
if (in_array($extension, $existingFiles, true)) {
Storage::assertMissing($filePath);
} else {
// To be sure no unexpected files were created and deleted
Storage::assertMissing($filePath);
}
}
}
public static function deleteS3FilesDataProvider(): array
{
return [
'PDF report, all files exist' => [
'mediaType' => AutomatedReportsService::MEDIA_TYPE_PDF,
'expectedFileExtensions' => ['html', 'MD', 'pdf'],
'existingFiles' => ['html', 'MD', 'pdf'],
'pathSuffix' => '',
'expectedDeletes' => 3,
],
'PDF report, some files exist' => [
'mediaType' => AutomatedReportsService::MEDIA_TYPE_PDF,
'expectedFileExtensions' => ['html', 'MD', 'pdf'],
'existingFiles' => ['html', 'pdf'],
'pathSuffix' => '',
'expectedDeletes' => 2,
],
'PDF report, no files exist' => [
'mediaType' => AutomatedReportsService::MEDIA_TYPE_PDF,
'expectedFileExtensions' => ['html', 'MD', 'pdf'],
'existingFiles' => [],
'pathSuffix' => '',
'expectedDeletes' => 0,
],
'Podcast report, all files exist' => [
'mediaType' => AutomatedReportsService::MEDIA_TYPE_PODCAST,
'expectedFileExtensions' => ['json', 'mp3', 'ssml'],
'existingFiles' => ['json', 'mp3', 'ssml'],
'pathSuffix' => '_podcast',
'expectedDeletes' => 3,
],
'Podcast report, some files exist' => [
'mediaType' => AutomatedReportsService::MEDIA_TYPE_PODCAST,
'expectedFileExtensions' => ['json', 'mp3', 'ssml'],
'existingFiles' => ['mp3'],
'pathSuffix' => '_podcast',
'expectedDeletes' => 1,
],
'Podcast report, no files exist' => [
'mediaType' => AutomatedReportsService::MEDIA_TYPE_PODCAST,
'expectedFileExtensions' => ['json', 'mp3', 'ssml'],
'existingFiles' => [],
'pathSuffix' => '_podcast',
'expectedDeletes' => 0,
],
'Other media type, should do nothing' => [
'mediaType' => 'some_other_type',
'expectedFileExtensions' => [],
'existingFiles' => [],
'pathSuffix' => '',
'expectedDeletes' => 0,
],
];
}
public function testDeleteReportsResultsInRetentionPeriodWithLogging(): void
{
// Create mocks for the test
$automatedReportsService = Mockery::mock(AutomatedReportsService::class);
$team = Mockery::mock(Team::class);
$team->shouldReceive('getId')->andReturn(123);
$from = now()->subDays(30);
$to = now();
$source = 'test-source';
// Expect the method to be called with specific parameters
$automatedReportsService->shouldReceive('deleteReportsResultsInRetentionPeriodWithLogging')
->once()
->with(
$team,
Mockery::on(function ($arg) use ($from) {
return $arg->timestamp === $from->timestamp;
}),
Mockery::on(function ($arg) use ($to) {
return $arg->timestamp === $to->timestamp;
}),
$source
)
->andReturn(5);
// Call the method and verify the result
$result = $automatedReportsService->deleteReportsResultsInRetentionPeriodWithLogging(
$team,
$from,
$to,
$source
);
$this->assertEquals(5, $result);
}
#[DataProvider('sanitizeFileNameDataProvider')]
public function testSanitizeFileName(string $input, string $expected): void
{
$result = $this->service->sanitizeFileName($input);
$this->assertEquals($expected, $result);
}
public static function sanitizeFileNameDataProvider(): array
{
return [
'no special characters' => [
'input' => 'Exec Summary - Sep 2025 - Business Development Team',
'expected' => 'Exec Summary - Sep 2025 - Business Development Team',
],
'forward slash in team name' => [
'input' => 'Exec Summary - Sep 2025 - ND/IRV',
'expected' => 'Exec Summary - Sep 2025 - ND-IRV',
],
'backslash in team name' => [
'input' => 'Exec Summary - Sep 2025 - ND\IRV',
'expected' => 'Exec Summary - Sep 2025 - ND-IRV',
],
'multiple forward slashes' => [
'input' => 'Report - Team A/B/C',
'expected' => 'Report - Team A-B-C',
],
'multiple backslashes' => [
'input' => 'Report - Team A\B\C',
'expected' => 'Report - Team A-B-C',
],
'mixed slashes and backslashes' => [
'input' => 'Report - Team A/B\C',
'expected' => 'Report - Team A-B-C',
],
'complex team name with slashes' => [
'input' => 'Exec Summary - Sep 2025 - Business Development Team - ND/IRV, Net Driven - Acquisition (Sales)',
'expected' => 'Exec Summary - Sep 2025 - Business Development Team - ND-IRV, Net Driven - Acquisition (Sales)',
],
'only slashes' => [
'input' => '//\\\\',
'expected' => '----',
],
'empty string' => [
'input' => '',
'expected' => '',
],
'slash at start' => [
'input' => '/Report Name',
'expected' => '-Report Name',
],
'slash at end' => [
'input' => 'Report Name/',
'expected' => 'Report Name-',
],
];
}
public function testGetReportFileNameSanitizesOutput(): void
{
// Create mock GroupRepository
$mockGroupRepository = $this->createMock(GroupRepository::class);
// Create mock Group with slash in name
$mockGroup = $this->createMock(\Jiminny\Models\Group::class);
$mockGroup->method('getName')->willReturn('ND/IRV, Net Driven - Acquisition (Sales)');
$mockGroupRepository->method('find')->willReturn($mockGroup);
// Create service with mocked GroupRepository
$service = new AutomatedReportsService(
$this->createMock(TeamRepository::class),
$mockGroupRepository,
$this->createMock(UserRepository::class),
$this->createMock(StageRepository::class),
$this->createMock(DealStagesService::class),
$this->createMock(RecipientsService::class),
$this->createMock(AutomatedReportsRepository::class),
$this->createMock(Webhook::class),
$this->createMock(Dispatcher::class),
$this->createMock(ActivityTypeService::class),
$this->createMock(PlaybookCategoryRepository::class),
$this->createMock(AskAnythingPromptService::class),
$this->createMock(SearchRepository::class),
$this->createMock(AskAnythingRepository::class),
);
// Create mock AutomatedReportResult
$mockReportResult = $this->createMock(AutomatedReportResult::class);
// Create mock AutomatedReport
$mockReport = $this->createMock(AutomatedReport::class);
$mockReport->method('getType')->willReturn('exec_summary');
$mockReport->method('getFrequency')->willReturn('monthly');
$mockReportResult->method('getReport')->willReturn($mockReport);
$mockReportResult->method('getFromDate')->willReturn(
\Illuminate\Support\Carbon::parse('2025-09-01')
);
$mockReportResult->method('getToDate')->willReturn(
\Illuminate\Support\Carbon::parse('2025-09-30')
);
$mockReportResult->method('getGroups')->willReturn([123]);
$mockReportResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PDF);
// Call getReportFileName
$result = $service->getReportFileName($mockReportResult);
// Verify the result does not contain slashes or backslashes
$this->assertStringNotContainsString('/', $result);
$this->assertStringNotContainsString('\\', $result);
// Verify the slash was replaced with dash
$this->assertStringContainsString('ND-IRV', $result);
}
public function testGetReportFileNameWithExtensionSanitizesOutput(): void
{
// Create mock GroupRepository
$mockGroupRepository = $this->createMock(GroupRepository::class);
// Create mock Group with backslash in name
$mockGroup = $this->createMock(\Jiminny\Models\Group::class);
$mockGroup->method('getName')->willReturn('Team\Name');
$mockGroupRepository->method('find')->willReturn($mockGroup);
// Create service with mocked GroupRepository
$service = new AutomatedReportsService(
$this->createMock(TeamRepository::class),
$mockGroupRepository,
$this->createMock(UserRepository::class),
$this->createMock(StageRepository::class),
$this->...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"#11894 on JY-18909-automated-reports-ask-jiminny, menu","depth":5,"help_text":"Pull request #11894 exists for current branch JY-18909-automated-reports-ask-jiminny","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AutomatedReportsServiceTest","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AutomatedReportsServiceTest'","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AutomatedReportsServiceTest'","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"10","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"90","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"59","depth":4,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Tests\\Unit\\Services\\Kiosk\\AutomatedReports;\n\nuse Carbon\\Carbon;\nuse Illuminate\\Support\\Carbon as IlluminateCarbon;\nuse Illuminate\\Contracts\\Bus\\Dispatcher;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Database\\Eloquent\\Relations\\HasMany;\nuse Illuminate\\Support\\Facades\\Log;\nuse Illuminate\\Support\\Facades\\Storage;\nuse Jiminny\\Component\\AskAnything\\AskAnythingPromptService;\nuse Jiminny\\Component\\AskAnything\\Dtos\\AskAnythingPromptDto;\nuse Jiminny\\Component\\UrlGenerator\\Webhook;\nuse Jiminny\\Contracts\\Repositories\\PlaybookCategoryRepository;\nuse Jiminny\\Contracts\\Repositories\\TeamRepository;\nuse Jiminny\\Contracts\\Repositories\\UserRepository;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Exceptions\\ModelNotFoundException;\nuse Illuminate\\Support\\Collection;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPrompt;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPromptTarget;\nuse Jiminny\\Models\\Activity\\Search;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Group;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Repositories\\AskAnythingRepository;\nuse Jiminny\\Repositories\\AutomatedReportsRepository;\nuse Jiminny\\Repositories\\GroupRepository;\nuse Jiminny\\Repositories\\SearchRepository;\nuse Jiminny\\Repositories\\StageRepository;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\ActivityTypeService;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\AutomatedReportsService;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\DealStagesService;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\RecipientsService;\nuse Mockery;\nuse PHPUnit\\Framework\\Attributes\\DataProvider;\nuse Tests\\TestCase;\n\nclass AutomatedReportsServiceTest extends TestCase\n{\n private AutomatedReportsService $service;\n\n protected function setUp(): void\n {\n parent::setUp();\n\n // Create a real instance of the service without calling the constructor\n $reflection = new \\ReflectionClass(AutomatedReportsService::class);\n $this->service = $reflection->newInstanceWithoutConstructor();\n\n // Manually set the dependencies using reflection\n $dependencies = [\n 'teamRepository' => TeamRepository::class,\n 'groupRepository' => GroupRepository::class,\n 'userRepository' => UserRepository::class,\n 'stageRepository' => StageRepository::class,\n 'dealStagesService' => DealStagesService::class,\n 'recipientsService' => RecipientsService::class,\n 'automatedReportsRepository' => AutomatedReportsRepository::class,\n 'webhookService' => Webhook::class,\n 'dispatcher' => Dispatcher::class,\n 'activityTypeService' => ActivityTypeService::class,\n 'playbookCategoryRepository' => PlaybookCategoryRepository::class,\n 'askAnythingPromptService' => AskAnythingPromptService::class,\n 'activitySearchRepository' => SearchRepository::class,\n 'askAnythingRepository' => AskAnythingRepository::class,\n ];\n\n foreach ($dependencies as $propertyName => $class) {\n $property = $reflection->getProperty($propertyName);\n $property->setAccessible(true);\n $property->setValue($this->service, $this->createMock($class));\n }\n }\n\n protected function tearDown(): void\n {\n parent::tearDown();\n Mockery::close();\n }\n\n private function getService(\n $mockUserRepository = null,\n $mockStageRepository = null,\n $mockTeamRepository = null,\n ): AutomatedReportsService {\n return new AutomatedReportsService(\n ($mockTeamRepository ?? $this->createMock(TeamRepository::class)),\n $this->createMock(GroupRepository::class),\n ($mockUserRepository ?? $this->createMock(UserRepository::class)),\n ($mockStageRepository ?? $this->createMock(StageRepository::class)),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n }\n\n #[DataProvider('transformMediaTypesDataProvider')]\n public function testTransformMediaTypes(array $mediaTypes, array $expected): void\n {\n $report = new AutomatedReport(['media_types' => $mediaTypes]);\n\n $reflection = new \\ReflectionClass(AutomatedReportsService::class);\n $method = $reflection->getMethod('transformMediaTypes');\n\n $result = $method->invoke($this->service, $report);\n\n $this->assertEquals($expected, $result);\n }\n\n public function testGetMediaTypeFieldDataWithoutReport(): void\n {\n $result = $this->service->getMediaTypeFieldData(null);\n\n $this->assertIsArray($result);\n $this->assertArrayHasKey('value', $result);\n $this->assertEmpty($result['value']);\n $this->assertEquals('media_types', $result['id']);\n }\n\n public function testGetMediaTypeFieldDataWithReport(): void\n {\n $mediaTypes = ['pdf', 'podcast'];\n $report = new AutomatedReport(['media_types' => $mediaTypes]);\n\n $result = $this->service->getMediaTypeFieldData($report);\n\n $expectedValue = [\n ['id' => 'pdf', 'name' => 'PDF'],\n ['id' => 'podcast', 'name' => 'Podcast'],\n ];\n\n $this->assertIsArray($result);\n $this->assertArrayHasKey('value', $result);\n $this->assertEquals($expectedValue, $result['value']);\n }\n\n public static function transformMediaTypesDataProvider(): array\n {\n return [\n 'empty array' => [\n 'mediaTypes' => [],\n 'expected' => [],\n ],\n 'pdf only' => [\n 'mediaTypes' => ['pdf'],\n 'expected' => [\n ['id' => 'pdf', 'name' => 'PDF'],\n ],\n ],\n 'podcast only' => [\n 'mediaTypes' => ['podcast'],\n 'expected' => [\n ['id' => 'podcast', 'name' => 'Podcast'],\n ],\n ],\n 'both pdf and podcast' => [\n 'mediaTypes' => ['pdf', 'podcast'],\n 'expected' => [\n ['id' => 'pdf', 'name' => 'PDF'],\n ['id' => 'podcast', 'name' => 'Podcast'],\n ],\n ],\n 'with invalid type' => [\n 'mediaTypes' => ['pdf', 'invalid', 'podcast'],\n 'expected' => [\n ['id' => 'pdf', 'name' => 'PDF'],\n ['id' => 'podcast', 'name' => 'Podcast'],\n ],\n ],\n ];\n }\n\n #[DataProvider('hasCallTypeConferenceDataProvider')]\n public function testHasCallTypeConference(array $callTypes, bool $expected): void\n {\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getCallTypes')->willReturn($callTypes);\n\n $result = $this->service->hasCallTypeConference($report);\n\n $this->assertEquals($expected, $result);\n }\n\n #[DataProvider('hasCallTypeDialerDataProvider')]\n public function testHasCallTypeDialer(array $callTypes, bool $expected): void\n {\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getCallTypes')->willReturn($callTypes);\n\n $result = $this->service->hasCallTypeDialer($report);\n\n $this->assertEquals($expected, $result);\n }\n\n public static function hasCallTypeConferenceDataProvider(): array\n {\n return [\n 'has conference' => [\n 'callTypes' => ['conference', 'dialer'],\n 'expected' => true,\n ],\n 'does not have conference' => [\n 'callTypes' => ['dialer', 'other'],\n 'expected' => false,\n ],\n 'empty call types' => [\n 'callTypes' => [],\n 'expected' => false,\n ],\n ];\n }\n\n public static function hasCallTypeDialerDataProvider(): array\n {\n return [\n 'has dialer' => [\n 'callTypes' => ['conference', 'dialer'],\n 'expected' => true,\n ],\n 'does not have dialer' => [\n 'callTypes' => ['conference', 'other'],\n 'expected' => false,\n ],\n 'empty call types' => [\n 'callTypes' => [],\n 'expected' => false,\n ],\n ];\n }\n\n public function testTransformReportResultsWithEmptyCollection(): void\n {\n $emptyCollection = new Collection([]);\n\n $result = $this->service->transformReportResults($emptyCollection);\n\n $this->assertIsArray($result);\n $this->assertEmpty($result);\n }\n\n public function testTransformReportResultsStructure(): void\n {\n // Create a mock AutomatedReportResult with minimal setup to test structure\n $mockReportResult = $this->createMockReportResult();\n $collection = new Collection([$mockReportResult]);\n\n $result = $this->service->transformReportResults($collection);\n\n $this->assertIsArray($result);\n $this->assertCount(1, $result);\n\n $transformedResult = $result[0];\n\n // Verify all expected keys are present\n $expectedKeys = [\n 'id', 'name', 'frequency', 'recipients',\n 'report_type', 'media_type', 'downloadUrl', 'viewUrl', 'generated_at',\n ];\n\n foreach ($expectedKeys as $key) {\n $this->assertArrayHasKey($key, $transformedResult);\n }\n\n // Verify structure of nested arrays\n $this->assertIsArray($transformedResult['frequency']);\n $this->assertArrayHasKey('id', $transformedResult['frequency']);\n $this->assertArrayHasKey('name', $transformedResult['frequency']);\n\n $this->assertIsArray($transformedResult['report_type']);\n $this->assertArrayHasKey('id', $transformedResult['report_type']);\n $this->assertArrayHasKey('name', $transformedResult['report_type']);\n\n $this->assertIsArray($transformedResult['recipients']);\n\n // Verify TODO fields are null as expected\n $this->assertEquals(AutomatedReportsService::MEDIA_TYPE_PODCAST, $transformedResult['media_type']);\n $this->assertEquals(route('ai-reports.audio.download', ['uuid' => 'test-uuid']), $transformedResult['downloadUrl']);\n $this->assertEquals(route('ai-reports.audio.view', ['uuid' => 'test-uuid']), $transformedResult['viewUrl']);\n }\n\n public function testTransformReportResultsWithMultipleResults(): void\n {\n $mockReportResult1 = $this->createMockReportResult('result-uuid-1', 'exec_summary');\n $mockReportResult2 = $this->createMockReportResult('result-uuid-2', 'coaching_profiles');\n $collection = new Collection([$mockReportResult1, $mockReportResult2]);\n\n $result = $this->service->transformReportResults($collection);\n\n $this->assertIsArray($result);\n $this->assertCount(2, $result);\n\n // Verify different UUIDs\n $this->assertEquals('result-uuid-1', $result[0]['id']);\n $this->assertEquals('result-uuid-2', $result[1]['id']);\n\n // Verify both results have the expected structure\n foreach ($result as $transformedResult) {\n $this->assertArrayHasKey('id', $transformedResult);\n $this->assertArrayHasKey('name', $transformedResult);\n $this->assertArrayHasKey('frequency', $transformedResult);\n $this->assertArrayHasKey('recipients', $transformedResult);\n $this->assertArrayHasKey('report_type', $transformedResult);\n }\n }\n\n #[DataProvider('isUserRecipientOfReportDataProvider')]\n public function testIsUserRecipientOfReport(int $userId, array $recipients, bool $expected): void\n {\n // Create mock User\n $mockUser = $this->createMock(\\Jiminny\\Models\\User::class);\n $mockUser->method('getId')->willReturn($userId);\n\n // Create mock AutomatedReport\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getRecipients')->willReturn($recipients);\n\n $result = $this->service->isUserRecipientOfReport($mockUser, $mockReport);\n\n $this->assertEquals($expected, $result);\n }\n\n public function testIsUserRecipientOfReportWithEmptyRecipients(): void\n {\n // Create mock User\n $mockUser = $this->createMock(\\Jiminny\\Models\\User::class);\n $mockUser->method('getId')->willReturn(123);\n\n // Create mock AutomatedReport with no recipients\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getRecipients')->willReturn([]);\n\n $result = $this->service->isUserRecipientOfReport($mockUser, $mockReport);\n\n $this->assertFalse($result);\n }\n\n public function testIsUserRecipientOfReportWithNoUsersKey(): void\n {\n // Create mock User\n $mockUser = $this->createMock(\\Jiminny\\Models\\User::class);\n $mockUser->method('getId')->willReturn(123);\n\n // Create mock AutomatedReport with recipients but no 'users' key\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getRecipients')->willReturn(['other_key' => [456, 789]]);\n\n $result = $this->service->isUserRecipientOfReport($mockUser, $mockReport);\n\n $this->assertFalse($result);\n }\n\n public static function isUserRecipientOfReportDataProvider(): array\n {\n return [\n 'user is recipient - single user' => [\n 'userId' => 123,\n 'recipients' => ['users' => [123]],\n 'expected' => true,\n ],\n 'user is recipient - multiple users' => [\n 'userId' => 456,\n 'recipients' => ['users' => [123, 456, 789]],\n 'expected' => true,\n ],\n 'user is not recipient - single user' => [\n 'userId' => 999,\n 'recipients' => ['users' => [123]],\n 'expected' => false,\n ],\n 'user is not recipient - multiple users' => [\n 'userId' => 999,\n 'recipients' => ['users' => [123, 456, 789]],\n 'expected' => false,\n ],\n 'user is recipient - string IDs converted to int' => [\n 'userId' => 123,\n 'recipients' => ['users' => ['123', '456']],\n 'expected' => true,\n ],\n 'user is not recipient - string IDs converted to int' => [\n 'userId' => 999,\n 'recipients' => ['users' => ['123', '456']],\n 'expected' => false,\n ],\n 'empty users array' => [\n 'userId' => 123,\n 'recipients' => ['users' => []],\n 'expected' => false,\n ],\n ];\n }\n\n private function createMockReportResult(string $uuid = 'test-uuid', string $reportType = 'exec_summary'): AutomatedReportResult\n {\n // Create mock AutomatedReport\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getFrequency')->willReturn('weekly');\n $mockReport->method('getRecipients')->willReturn(['users' => [1, 2]]);\n $mockReport->method('getGroups')->willReturn([10, 20]);\n $mockReport->method('getType')->willReturn($reportType);\n\n // Create mock Team\n $mockTeam = $this->createMock(\\Jiminny\\Models\\Team::class);\n\n // Create mock Group\n $mockGroup = $this->createMock(\\Jiminny\\Models\\Group::class);\n $mockGroup->method('getUuid')->willReturn('group-uuid-10');\n $mockGroup->method('getName')->willReturn('Test Team');\n\n $mockQueryBuilder = Mockery::mock();\n $mockQueryBuilder->shouldReceive('where')->andReturnSelf();\n $mockQueryBuilder->shouldReceive('first')->andReturn($mockGroup);\n\n $dataRelation = Mockery::mock(HasMany::class);\n $dataRelation->shouldReceive('where')->andReturn($mockQueryBuilder);\n $dataRelation->shouldReceive('get')->andReturn(\n new \\Illuminate\\Database\\Eloquent\\Collection([$mockGroup])\n );\n\n $mockTeam->method('groups')->willReturn($dataRelation);\n $mockReport->method('getTeam')->willReturn($mockTeam);\n\n // Create mock AutomatedReportResult\n $mockReportResult = $this->createMock(AutomatedReportResult::class);\n $mockReportResult->method('getUuid')->willReturn($uuid);\n $mockReportResult->method('getGeneratedAt')->willReturn(\n \\Illuminate\\Support\\Carbon::parse('2024-01-15T10:30:00Z')\n );\n\n $mockReportResult->method('getReport')->willReturn($mockReport);\n\n // Mock methods used in getReportFileName\n $mockReportResult->method('getReportType')->willReturn($reportType);\n $mockReportResult->method('getFromDate')->willReturn(\n \\Illuminate\\Support\\Carbon::parse('2024-01-08')\n );\n $mockReportResult->method('getToDate')->willReturn(\n \\Illuminate\\Support\\Carbon::parse('2024-01-15')\n );\n $mockReportResult->method('getGroups')->willReturn([10]);\n $mockReportResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PODCAST);\n\n return $mockReportResult;\n }\n\n #[DataProvider('getUsersUuidsDataProvider')]\n public function testGetUsersUuids(array $recipients, array $mockUsers, array $expectedUuids): void\n {\n // Create mock UserRepository\n $mockUserRepository = $this->createMock(UserRepository::class);\n\n // Configure the mock to return specific users for specific IDs using a callback\n $mockUserRepository->method('find')\n ->willReturnCallback(function ($userId) use ($mockUsers) {\n if (! isset($mockUsers[$userId])) {\n return null;\n }\n\n $userUuid = $mockUsers[$userId]['uuid'] ?? null;\n\n if ($userUuid === null) {\n return null;\n }\n\n $mockUser = $this->createMock(\\Jiminny\\Models\\User::class);\n $mockUser->method('getUuid')->willReturn((string) $userUuid);\n\n return $mockUser;\n });\n\n // Create service with mocked UserRepository\n $automatedReportsService = $this->getService(mockUserRepository: $mockUserRepository);\n\n // Create mock AutomatedReport\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getRecipients')->willReturn($recipients);\n\n $result = $automatedReportsService->getUsersUuids($mockReport);\n\n $this->assertEquals($expectedUuids, $result);\n }\n\n public function testGetUsersUuidsWithEmptyRecipients(): void\n {\n // Create mock AutomatedReport with empty recipients\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getRecipients')->willReturn([]);\n\n $result = $this->service->getUsersUuids($mockReport);\n\n $this->assertEquals([], $result);\n }\n\n public function testGetUsersUuidsWithNoUsersKey(): void\n {\n // Create mock AutomatedReport with recipients but no 'users' key\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getRecipients')->willReturn(['other_key' => [1, 2, 3]]);\n\n $result = $this->service->getUsersUuids($mockReport);\n\n $this->assertEquals([], $result);\n }\n\n public function testGetUsersUuidsWithNonExistentUsers(): void\n {\n // Create mock UserRepository that returns null for all users\n $mockUserRepository = $this->createMock(UserRepository::class);\n $mockUserRepository->method('find')->willReturn(null);\n\n // Create service with mocked UserRepository\n $automatedReportsService = $this->getService(mockUserRepository: $mockUserRepository);\n\n // Create mock AutomatedReport\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getRecipients')->willReturn(['users' => [1, 2, 3]]);\n\n $result = $automatedReportsService->getUsersUuids($mockReport);\n\n // Should return array with null values for non-existent users\n $this->assertEquals([], $result);\n }\n\n public static function getUsersUuidsDataProvider(): array\n {\n return [\n 'single user found' => [\n 'recipients' => ['users' => [123]],\n 'mockUsers' => [\n 123 => ['id' => 123, 'uuid' => 'user-uuid-123'],\n ],\n 'expectedUuids' => ['user-uuid-123'],\n ],\n 'multiple users found' => [\n 'recipients' => ['users' => [123, 456, 789]],\n 'mockUsers' => [\n 123 => ['id' => 123, 'uuid' => 'user-uuid-123'],\n 456 => ['id' => 456, 'uuid' => 'user-uuid-456'],\n 789 => ['id' => 789, 'uuid' => 'user-uuid-789'],\n ],\n 'expectedUuids' => ['user-uuid-123', 'user-uuid-456', 'user-uuid-789'],\n ],\n 'mixed found and not found users' => [\n 'recipients' => ['users' => [123, 456, 789]],\n 'mockUsers' => [\n 123 => ['id' => 123, 'uuid' => 'user-uuid-123'],\n // 456 not found in DB\n 789 => ['id' => 789, 'uuid' => 'user-uuid-789'],\n ],\n 'expectedUuids' => ['user-uuid-123', 'user-uuid-789'], // Updated to reflect that nulls are filtered out\n ],\n 'empty users array' => [\n 'recipients' => ['users' => []],\n 'mockUsers' => [],\n 'expectedUuids' => [],\n ],\n 'all users not found' => [\n 'recipients' => ['users' => [123, 456]],\n 'mockUsers' => [], // No users found\n 'expectedUuids' => [], // Updated to reflect that nulls are filtered out\n ],\n ];\n }\n\n #[DataProvider('getCurrentDealStagesUuidsDataProvider')]\n public function testGetCurrentDealStagesUuids(array $currentDealStages, array $mockStages, array $expectedUuids): void\n {\n // Create mock StageRepository\n $mockStageRepository = $this->createMock(StageRepository::class);\n\n // Configure the mock to return specific stages for specific IDs using a callback\n $mockStageRepository->method('find')\n ->willReturnCallback(function ($stageId) use ($mockStages) {\n if (! isset($mockStages[$stageId])) {\n return null;\n }\n\n $stageUuid = $mockStages[$stageId]['uuid'] ?? null;\n\n if ($stageUuid === null) {\n return null;\n }\n\n $mockStage = $this->createMock(\\Jiminny\\Models\\Stage::class);\n $mockStage->method('getUuid')->willReturn((string) $stageUuid);\n\n return $mockStage;\n });\n\n // Create service with mocked StageRepository\n $automatedReportsService = $this->getService(mockStageRepository: $mockStageRepository);\n\n // Create mock AutomatedReport\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getCurrentDealStages')->willReturn($currentDealStages);\n\n $result = $automatedReportsService->getCurrentDealStagesUuids($mockReport);\n\n $this->assertEquals($expectedUuids, $result);\n }\n\n public function testGetCurrentDealStagesUuidsWithEmptyStages(): void\n {\n // Create mock AutomatedReport with empty current deal stages\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getCurrentDealStages')->willReturn([]);\n\n $result = $this->service->getCurrentDealStagesUuids($mockReport);\n\n $this->assertEquals([], $result);\n }\n\n public function testGetCurrentDealStagesUuidsWithNonExistentStages(): void\n {\n // Create mock StageRepository that returns null for all stages\n $mockStageRepository = $this->createMock(StageRepository::class);\n $mockStageRepository->method('find')->willReturn(null);\n\n // Create service with mocked StageRepository\n $automatedReportsService = $this->getService(mockStageRepository: $mockStageRepository);\n\n // Create mock AutomatedReport\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getCurrentDealStages')->willReturn([1, 2, 3]);\n\n $result = $automatedReportsService->getCurrentDealStagesUuids($mockReport);\n\n // Should return array with null values for non-existent stages\n $this->assertEquals([], $result);\n }\n\n public static function getCurrentDealStagesUuidsDataProvider(): array\n {\n return [\n 'single stage found' => [\n 'currentDealStages' => [10],\n 'mockStages' => [\n 10 => ['id' => 10, 'uuid' => 'stage-uuid-10'],\n ],\n 'expectedUuids' => ['stage-uuid-10'],\n ],\n 'multiple stages found' => [\n 'currentDealStages' => [10, 20, 30],\n 'mockStages' => [\n 10 => ['id' => 10, 'uuid' => 'stage-uuid-10'],\n 20 => ['id' => 20, 'uuid' => 'stage-uuid-20'],\n 30 => ['id' => 30, 'uuid' => 'stage-uuid-30'],\n ],\n 'expectedUuids' => ['stage-uuid-10', 'stage-uuid-20', 'stage-uuid-30'],\n ],\n 'mixed found and not found stages' => [\n 'currentDealStages' => [10, 20, 30],\n 'mockStages' => [\n 10 => ['id' => 10, 'uuid' => 'stage-uuid-10'],\n // 20 not found in DB\n 30 => ['id' => 30, 'uuid' => 'stage-uuid-30'],\n ],\n 'expectedUuids' => ['stage-uuid-10', 'stage-uuid-30'], // Updated to reflect that nulls are filtered out\n ],\n 'empty stages array' => [\n 'currentDealStages' => [],\n 'mockStages' => [],\n 'expectedUuids' => [],\n ],\n 'all stages not found' => [\n 'currentDealStages' => [10, 20],\n 'mockStages' => [], // No stages found\n 'expectedUuids' => [], // Updated to reflect that nulls are filtered out\n ],\n ];\n }\n\n #[DataProvider('getTeamGroupsDataProvider')]\n public function testGetTeamGroups(string $teamUuid, ?array $mockTeamData, array $mockGroups, array $expectedResult): void\n {\n // Create mock TeamRepository\n $mockTeamRepository = $this->createMock(TeamRepository::class);\n\n if ($mockTeamData === null) {\n // Team not found\n $mockTeamRepository->method('idOrUuid')\n ->with($teamUuid)\n ->willReturn(null);\n } else {\n // Team found - create mock team with groups\n $mockTeam = $this->createMock(\\Jiminny\\Models\\Team::class);\n\n // Create mock groups collection\n $mockGroupsCollection = $this->createMock(\\Illuminate\\Database\\Eloquent\\Collection::class);\n\n // Create mock Group objects\n $groupObjects = [];\n foreach ($mockGroups as $groupData) {\n $mockGroup = $this->createMock(\\Jiminny\\Models\\Group::class);\n $mockGroup->method('getUuid')->willReturn($groupData['id']);\n $mockGroup->method('getName')->willReturn($groupData['name']);\n $groupObjects[] = $mockGroup;\n }\n\n // Mock the groups collection to return our mock groups\n $mockGroupsCollection->method('getIterator')->willReturn(new \\ArrayIterator($groupObjects));\n\n // Mock the groups() relation\n $mockGroupsRelation = $this->createMock(\\Illuminate\\Database\\Eloquent\\Relations\\HasMany::class);\n $mockGroupsRelation->method('get')->willReturn($mockGroupsCollection);\n $mockTeam->method('groups')->willReturn($mockGroupsRelation);\n\n $mockTeamRepository->method('idOrUuid')\n ->with($teamUuid)\n ->willReturn($mockTeam);\n }\n\n // Create service with mocked TeamRepository\n $automatedReportsService = $this->getService(mockTeamRepository: $mockTeamRepository);\n\n $result = $automatedReportsService->getTeamGroups($teamUuid);\n\n $this->assertEquals($expectedResult, $result);\n }\n\n public function testGetTeamGroupsWithNonExistentTeam(): void\n {\n // Create mock TeamRepository that returns null (team not found)\n $mockTeamRepository = $this->createMock(TeamRepository::class);\n $mockTeamRepository->method('idOrUuid')->willReturn(null);\n\n // Create service with mocked TeamRepository\n $automatedReportsService = $this->getService(mockTeamRepository: $mockTeamRepository);\n\n $result = $automatedReportsService->getTeamGroups('non-existent-team-uuid');\n\n $this->assertEquals([], $result);\n }\n\n public function testGetTeamGroupsWithEmptyGroups(): void\n {\n // Create mock team with no groups\n $mockTeam = $this->createMock(\\Jiminny\\Models\\Team::class);\n\n // Create empty groups collection\n $mockGroupsCollection = $this->createMock(\\Illuminate\\Database\\Eloquent\\Collection::class);\n $mockGroupsCollection->method('getIterator')->willReturn(new \\ArrayIterator([]));\n\n $mockGroupsRelation = $this->createMock(\\Illuminate\\Database\\Eloquent\\Relations\\HasMany::class);\n $mockGroupsRelation->method('get')->willReturn($mockGroupsCollection);\n $mockTeam->method('groups')->willReturn($mockGroupsRelation);\n\n // Create mock TeamRepository\n $mockTeamRepository = $this->createMock(TeamRepository::class);\n $mockTeamRepository->method('idOrUuid')->willReturn($mockTeam);\n\n // Create service with mocked TeamRepository\n $automatedReportsService = $this->getService(mockTeamRepository: $mockTeamRepository);\n\n $result = $automatedReportsService->getTeamGroups('team-with-no-groups');\n\n $this->assertEquals([], $result);\n }\n\n public static function getTeamGroupsDataProvider(): array\n {\n return [\n 'team with single group' => [\n 'teamUuid' => 'team-uuid-123',\n 'mockTeamData' => ['id' => 'team-uuid-123', 'name' => 'Test Team'],\n 'mockGroups' => [\n ['id' => 'group-uuid-1', 'name' => 'Sales Team'],\n ],\n 'expectedResult' => [\n ['id' => 'group-uuid-1', 'name' => 'Sales Team'],\n ],\n ],\n 'team with multiple groups' => [\n 'teamUuid' => 'team-uuid-456',\n 'mockTeamData' => ['id' => 'team-uuid-456', 'name' => 'Another Team'],\n 'mockGroups' => [\n ['id' => 'group-uuid-1', 'name' => 'Sales Team'],\n ['id' => 'group-uuid-2', 'name' => 'Marketing Team'],\n ['id' => 'group-uuid-3', 'name' => 'Support Team'],\n ],\n 'expectedResult' => [\n ['id' => 'group-uuid-1', 'name' => 'Sales Team'],\n ['id' => 'group-uuid-2', 'name' => 'Marketing Team'],\n ['id' => 'group-uuid-3', 'name' => 'Support Team'],\n ],\n ],\n 'team not found' => [\n 'teamUuid' => 'non-existent-uuid',\n 'mockTeamData' => null,\n 'mockGroups' => [],\n 'expectedResult' => [],\n ],\n 'team with no groups' => [\n 'teamUuid' => 'team-uuid-empty',\n 'mockTeamData' => ['id' => 'team-uuid-empty', 'name' => 'Empty Team'],\n 'mockGroups' => [],\n 'expectedResult' => [],\n ],\n ];\n }\n\n #[DataProvider('getTeamsDataProvider')]\n public function testGetTeams(array $mockTeams, array $expectedResult): void\n {\n // Create mock TeamRepository\n $mockTeamRepository = $this->createMock(TeamRepository::class);\n\n // Create mock Team objects\n $teamObjects = [];\n foreach ($mockTeams as $teamData) {\n $mockTeam = $this->createMock(\\Jiminny\\Models\\Team::class);\n $mockTeam->method('getUuid')->willReturn($teamData['id']);\n $mockTeam->method('getName')->willReturn($teamData['name']);\n $mockTeam->method('hasFeature')\n ->with(\\Jiminny\\Models\\Feature\\FeatureEnum::AUTOMATED_REPORTS)\n ->willReturn($teamData['hasAutomatedReports']);\n $teamObjects[] = $mockTeam;\n }\n\n // Mock the repository to return a Collection (not array)\n $mockTeamRepository->method('getTeamsForKiosk')\n ->with('active')\n ->willReturn(new Collection($teamObjects));\n\n // Create service with mocked TeamRepository\n $automatedReportsService = $this->getService(mockTeamRepository: $mockTeamRepository);\n\n $result = $automatedReportsService->getTeams();\n\n $this->assertEquals($expectedResult, $result);\n }\n\n public function testGetTeamsWithNoTeams(): void\n {\n // Create mock TeamRepository that returns empty Collection\n $mockTeamRepository = $this->createMock(TeamRepository::class);\n $mockTeamRepository->method('getTeamsForKiosk')->willReturn(new Collection([]));\n\n // Create service with mocked TeamRepository\n $automatedReportsService = $this->getService(mockTeamRepository: $mockTeamRepository);\n\n $result = $automatedReportsService->getTeams();\n\n $this->assertEquals([], $result);\n }\n\n public function testGetTeamsWithAllTeamsWithoutFeature(): void\n {\n // Create mock teams without AUTOMATED_REPORTS feature\n $mockTeam1 = $this->createMock(\\Jiminny\\Models\\Team::class);\n $mockTeam1->method('hasFeature')\n ->with(\\Jiminny\\Models\\Feature\\FeatureEnum::AUTOMATED_REPORTS)\n ->willReturn(false);\n\n $mockTeam2 = $this->createMock(\\Jiminny\\Models\\Team::class);\n $mockTeam2->method('hasFeature')\n ->with(\\Jiminny\\Models\\Feature\\FeatureEnum::AUTOMATED_REPORTS)\n ->willReturn(false);\n\n // Create mock TeamRepository that returns Collection\n $mockTeamRepository = $this->createMock(TeamRepository::class);\n $mockTeamRepository->method('getTeamsForKiosk')->willReturn(new Collection([$mockTeam1, $mockTeam2]));\n\n // Create service with mocked TeamRepository\n $automatedReportsService = $this->getService(mockTeamRepository: $mockTeamRepository);\n\n $result = $automatedReportsService->getTeams();\n\n $this->assertEquals([], $result);\n }\n\n public static function getTeamsDataProvider(): array\n {\n return [\n 'single team with feature' => [\n 'mockTeams' => [\n [\n 'id' => 'team-uuid-1',\n 'name' => 'Sales Team',\n 'hasAutomatedReports' => true,\n ],\n ],\n 'expectedResult' => [\n ['id' => 'team-uuid-1', 'name' => 'Sales Team'],\n ],\n ],\n 'multiple teams with feature' => [\n 'mockTeams' => [\n [\n 'id' => 'team-uuid-1',\n 'name' => 'Sales Team',\n 'hasAutomatedReports' => true,\n ],\n [\n 'id' => 'team-uuid-2',\n 'name' => 'Marketing Team',\n 'hasAutomatedReports' => true,\n ],\n [\n 'id' => 'team-uuid-3',\n 'name' => 'Support Team',\n 'hasAutomatedReports' => true,\n ],\n ],\n 'expectedResult' => [\n ['id' => 'team-uuid-1', 'name' => 'Sales Team'],\n ['id' => 'team-uuid-2', 'name' => 'Marketing Team'],\n ['id' => 'team-uuid-3', 'name' => 'Support Team'],\n ],\n ],\n 'mixed teams - some with feature, some without' => [\n 'mockTeams' => [\n [\n 'id' => 'team-uuid-1',\n 'name' => 'Sales Team',\n 'hasAutomatedReports' => true,\n ],\n [\n 'id' => 'team-uuid-2',\n 'name' => 'Marketing Team',\n 'hasAutomatedReports' => false,\n ],\n [\n 'id' => 'team-uuid-3',\n 'name' => 'Support Team',\n 'hasAutomatedReports' => true,\n ],\n ],\n 'expectedResult' => [\n ['id' => 'team-uuid-1', 'name' => 'Sales Team'],\n ['id' => 'team-uuid-3', 'name' => 'Support Team'],\n ],\n ],\n 'all teams without feature' => [\n 'mockTeams' => [\n [\n 'id' => 'team-uuid-1',\n 'name' => 'Sales Team',\n 'hasAutomatedReports' => false,\n ],\n [\n 'id' => 'team-uuid-2',\n 'name' => 'Marketing Team',\n 'hasAutomatedReports' => false,\n ],\n ],\n 'expectedResult' => [],\n ],\n 'empty teams array' => [\n 'mockTeams' => [],\n 'expectedResult' => [],\n ],\n ];\n }\n\n #[DataProvider('deleteS3FilesDataProvider')]\n public function testDeleteS3Files(\n string $mediaType,\n array $expectedFileExtensions,\n array $existingFiles,\n string $pathSuffix,\n int $expectedDeletes\n ): void {\n // Arrange\n $teamUuid = 'team-uuid-123';\n $reportUuid = 'report-uuid-456';\n $basePath = sprintf('%s/reports/%s', $teamUuid, $reportUuid);\n\n $team = Mockery::mock(Team::class);\n $team->allows('getUuid')->andReturn($teamUuid);\n\n $report = Mockery::mock(AutomatedReport::class);\n $report->allows('getTeam')->andReturn($team);\n\n $result = Mockery::mock(AutomatedReportResult::class);\n $result->allows('getReport')->andReturn($report);\n $result->allows('getUuid')->andReturn($reportUuid);\n $result->allows('getMediaType')->andReturn($mediaType);\n\n Storage::fake();\n Log::shouldReceive('info')->times($expectedDeletes);\n\n foreach ($existingFiles as $extension) {\n $filePath = $basePath . $pathSuffix . '.' . $extension;\n Storage::put($filePath, 'dummy content');\n }\n\n // Act\n $this->service->deleteS3Files($result);\n\n // Assert\n foreach ($expectedFileExtensions as $extension) {\n $filePath = $basePath . $pathSuffix . '.' . $extension;\n if (in_array($extension, $existingFiles, true)) {\n Storage::assertMissing($filePath);\n } else {\n // To be sure no unexpected files were created and deleted\n Storage::assertMissing($filePath);\n }\n }\n }\n\n public static function deleteS3FilesDataProvider(): array\n {\n return [\n 'PDF report, all files exist' => [\n 'mediaType' => AutomatedReportsService::MEDIA_TYPE_PDF,\n 'expectedFileExtensions' => ['html', 'MD', 'pdf'],\n 'existingFiles' => ['html', 'MD', 'pdf'],\n 'pathSuffix' => '',\n 'expectedDeletes' => 3,\n ],\n 'PDF report, some files exist' => [\n 'mediaType' => AutomatedReportsService::MEDIA_TYPE_PDF,\n 'expectedFileExtensions' => ['html', 'MD', 'pdf'],\n 'existingFiles' => ['html', 'pdf'],\n 'pathSuffix' => '',\n 'expectedDeletes' => 2,\n ],\n 'PDF report, no files exist' => [\n 'mediaType' => AutomatedReportsService::MEDIA_TYPE_PDF,\n 'expectedFileExtensions' => ['html', 'MD', 'pdf'],\n 'existingFiles' => [],\n 'pathSuffix' => '',\n 'expectedDeletes' => 0,\n ],\n 'Podcast report, all files exist' => [\n 'mediaType' => AutomatedReportsService::MEDIA_TYPE_PODCAST,\n 'expectedFileExtensions' => ['json', 'mp3', 'ssml'],\n 'existingFiles' => ['json', 'mp3', 'ssml'],\n 'pathSuffix' => '_podcast',\n 'expectedDeletes' => 3,\n ],\n 'Podcast report, some files exist' => [\n 'mediaType' => AutomatedReportsService::MEDIA_TYPE_PODCAST,\n 'expectedFileExtensions' => ['json', 'mp3', 'ssml'],\n 'existingFiles' => ['mp3'],\n 'pathSuffix' => '_podcast',\n 'expectedDeletes' => 1,\n ],\n 'Podcast report, no files exist' => [\n 'mediaType' => AutomatedReportsService::MEDIA_TYPE_PODCAST,\n 'expectedFileExtensions' => ['json', 'mp3', 'ssml'],\n 'existingFiles' => [],\n 'pathSuffix' => '_podcast',\n 'expectedDeletes' => 0,\n ],\n 'Other media type, should do nothing' => [\n 'mediaType' => 'some_other_type',\n 'expectedFileExtensions' => [],\n 'existingFiles' => [],\n 'pathSuffix' => '',\n 'expectedDeletes' => 0,\n ],\n ];\n }\n\n public function testDeleteReportsResultsInRetentionPeriodWithLogging(): void\n {\n // Create mocks for the test\n $automatedReportsService = Mockery::mock(AutomatedReportsService::class);\n\n $team = Mockery::mock(Team::class);\n $team->shouldReceive('getId')->andReturn(123);\n\n $from = now()->subDays(30);\n $to = now();\n $source = 'test-source';\n\n // Expect the method to be called with specific parameters\n $automatedReportsService->shouldReceive('deleteReportsResultsInRetentionPeriodWithLogging')\n ->once()\n ->with(\n $team,\n Mockery::on(function ($arg) use ($from) {\n return $arg->timestamp === $from->timestamp;\n }),\n Mockery::on(function ($arg) use ($to) {\n return $arg->timestamp === $to->timestamp;\n }),\n $source\n )\n ->andReturn(5);\n\n // Call the method and verify the result\n $result = $automatedReportsService->deleteReportsResultsInRetentionPeriodWithLogging(\n $team,\n $from,\n $to,\n $source\n );\n\n $this->assertEquals(5, $result);\n }\n\n #[DataProvider('sanitizeFileNameDataProvider')]\n public function testSanitizeFileName(string $input, string $expected): void\n {\n $result = $this->service->sanitizeFileName($input);\n\n $this->assertEquals($expected, $result);\n }\n\n public static function sanitizeFileNameDataProvider(): array\n {\n return [\n 'no special characters' => [\n 'input' => 'Exec Summary - Sep 2025 - Business Development Team',\n 'expected' => 'Exec Summary - Sep 2025 - Business Development Team',\n ],\n 'forward slash in team name' => [\n 'input' => 'Exec Summary - Sep 2025 - ND/IRV',\n 'expected' => 'Exec Summary - Sep 2025 - ND-IRV',\n ],\n 'backslash in team name' => [\n 'input' => 'Exec Summary - Sep 2025 - ND\\IRV',\n 'expected' => 'Exec Summary - Sep 2025 - ND-IRV',\n ],\n 'multiple forward slashes' => [\n 'input' => 'Report - Team A/B/C',\n 'expected' => 'Report - Team A-B-C',\n ],\n 'multiple backslashes' => [\n 'input' => 'Report - Team A\\B\\C',\n 'expected' => 'Report - Team A-B-C',\n ],\n 'mixed slashes and backslashes' => [\n 'input' => 'Report - Team A/B\\C',\n 'expected' => 'Report - Team A-B-C',\n ],\n 'complex team name with slashes' => [\n 'input' => 'Exec Summary - Sep 2025 - Business Development Team - ND/IRV, Net Driven - Acquisition (Sales)',\n 'expected' => 'Exec Summary - Sep 2025 - Business Development Team - ND-IRV, Net Driven - Acquisition (Sales)',\n ],\n 'only slashes' => [\n 'input' => '//\\\\\\\\',\n 'expected' => '----',\n ],\n 'empty string' => [\n 'input' => '',\n 'expected' => '',\n ],\n 'slash at start' => [\n 'input' => '/Report Name',\n 'expected' => '-Report Name',\n ],\n 'slash at end' => [\n 'input' => 'Report Name/',\n 'expected' => 'Report Name-',\n ],\n ];\n }\n\n public function testGetReportFileNameSanitizesOutput(): void\n {\n // Create mock GroupRepository\n $mockGroupRepository = $this->createMock(GroupRepository::class);\n\n // Create mock Group with slash in name\n $mockGroup = $this->createMock(\\Jiminny\\Models\\Group::class);\n $mockGroup->method('getName')->willReturn('ND/IRV, Net Driven - Acquisition (Sales)');\n\n $mockGroupRepository->method('find')->willReturn($mockGroup);\n\n // Create service with mocked GroupRepository\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $mockGroupRepository,\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n // Create mock AutomatedReportResult\n $mockReportResult = $this->createMock(AutomatedReportResult::class);\n\n // Create mock AutomatedReport\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getType')->willReturn('exec_summary');\n $mockReport->method('getFrequency')->willReturn('monthly');\n\n $mockReportResult->method('getReport')->willReturn($mockReport);\n $mockReportResult->method('getFromDate')->willReturn(\n \\Illuminate\\Support\\Carbon::parse('2025-09-01')\n );\n $mockReportResult->method('getToDate')->willReturn(\n \\Illuminate\\Support\\Carbon::parse('2025-09-30')\n );\n $mockReportResult->method('getGroups')->willReturn([123]);\n $mockReportResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PDF);\n\n // Call getReportFileName\n $result = $service->getReportFileName($mockReportResult);\n\n // Verify the result does not contain slashes or backslashes\n $this->assertStringNotContainsString('/', $result);\n $this->assertStringNotContainsString('\\\\', $result);\n\n // Verify the slash was replaced with dash\n $this->assertStringContainsString('ND-IRV', $result);\n }\n\n public function testGetReportFileNameWithExtensionSanitizesOutput(): void\n {\n // Create mock GroupRepository\n $mockGroupRepository = $this->createMock(GroupRepository::class);\n\n // Create mock Group with backslash in name\n $mockGroup = $this->createMock(\\Jiminny\\Models\\Group::class);\n $mockGroup->method('getName')->willReturn('Team\\Name');\n\n $mockGroupRepository->method('find')->willReturn($mockGroup);\n\n // Create service with mocked GroupRepository\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $mockGroupRepository,\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n // Create mock AutomatedReportResult\n $mockReportResult = $this->createMock(AutomatedReportResult::class);\n\n // Create mock AutomatedReport\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getType')->willReturn('exec_summary');\n $mockReport->method('getFrequency')->willReturn('monthly');\n\n $mockReportResult->method('getReport')->willReturn($mockReport);\n $mockReportResult->method('getFromDate')->willReturn(\n \\Illuminate\\Support\\Carbon::parse('2025-09-01')\n );\n $mockReportResult->method('getToDate')->willReturn(\n \\Illuminate\\Support\\Carbon::parse('2025-09-30')\n );\n $mockReportResult->method('getGroups')->willReturn([123]);\n $mockReportResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PDF);\n\n // Call getReportFileNameWithExtension\n $result = $service->getReportFileNameWithExtension($mockReportResult);\n\n // Verify the result does not contain backslashes\n $this->assertStringNotContainsString('\\\\', $result);\n $this->assertStringNotContainsString('/', $result);\n\n // Verify the backslash was replaced with dash\n $this->assertStringContainsString('Team-Name', $result);\n\n // Verify extension is added\n $this->assertStringEndsWith('.pdf', $result);\n }\n\n public function testHasPassedScheduledTimeWithNullGeneratedAt(): void\n {\n $result = $this->service->hasPassedScheduledTime(null, 'America/Chicago');\n\n $this->assertFalse($result);\n }\n\n public function testHasPassedScheduledTimeWhenScheduledTimePassed(): void\n {\n Carbon::setTestNow(Carbon::parse('2026-02-24 10:00:00', 'America/Chicago'));\n\n $generatedAt = Carbon::parse('2026-02-24 01:00:00', 'America/Chicago');\n\n $result = $this->service->hasPassedScheduledTime($generatedAt, 'America/Chicago');\n\n $this->assertTrue($result);\n\n Carbon::setTestNow();\n }\n\n public function testHasPassedScheduledTimeWhenGeneratedAfterScheduledTime(): void\n {\n Carbon::setTestNow(Carbon::parse('2026-02-24 10:00:00', 'America/Chicago'));\n\n $generatedAt = Carbon::parse('2026-02-24 06:00:00', 'America/Chicago');\n\n $result = $this->service->hasPassedScheduledTime($generatedAt, 'America/Chicago');\n\n $this->assertFalse($result);\n\n Carbon::setTestNow();\n }\n\n public function testHasPassedScheduledTimeBeforeScheduledTimeToday(): void\n {\n Carbon::setTestNow(Carbon::parse('2026-02-24 04:00:00', 'America/Chicago'));\n\n $generatedAt = Carbon::parse('2026-02-24 01:00:00', 'America/Chicago');\n\n $result = $this->service->hasPassedScheduledTime($generatedAt, 'America/Chicago');\n\n $this->assertFalse($result);\n\n Carbon::setTestNow();\n }\n\n public function testShouldSendReportWithEmptyUsers(): void\n {\n $result = $this->service->shouldSendReport([]);\n\n $this->assertFalse($result);\n }\n\n public function testShouldSendReportAtScheduledTime(): void\n {\n Carbon::setTestNow(Carbon::parse('2026-02-24 05:00:00', 'America/Chicago'));\n\n $users = [\n ['email' => 'test@example.com', 'name' => 'Test User', 'timezone' => 'America/Chicago'],\n ];\n\n $result = $this->service->shouldSendReport($users);\n\n $this->assertTrue($result);\n\n Carbon::setTestNow();\n }\n\n public function testShouldSendReportNotAtScheduledTimeWithoutGeneratedAt(): void\n {\n Carbon::setTestNow(Carbon::parse('2026-02-24 10:00:00', 'America/Chicago'));\n\n $users = [\n ['email' => 'test@example.com', 'name' => 'Test User', 'timezone' => 'America/Chicago'],\n ];\n\n $result = $this->service->shouldSendReport($users);\n\n $this->assertFalse($result);\n\n Carbon::setTestNow();\n }\n\n public function testShouldSendReportWhenScheduledTimeMissed(): void\n {\n Carbon::setTestNow(Carbon::parse('2026-02-24 10:00:00', 'America/Chicago'));\n\n $users = [\n ['email' => 'test@example.com', 'name' => 'Test User', 'timezone' => 'America/Chicago'],\n ];\n\n $generatedAt = Carbon::parse('2026-02-24 01:00:00', 'America/Chicago');\n\n $result = $this->service->shouldSendReport($users, $generatedAt);\n\n $this->assertTrue($result);\n\n Carbon::setTestNow();\n }\n\n public function testShouldSendReportWhenGeneratedAfterScheduledTime(): void\n {\n Carbon::setTestNow(Carbon::parse('2026-02-24 10:00:00', 'America/Chicago'));\n\n $users = [\n ['email' => 'test@example.com', 'name' => 'Test User', 'timezone' => 'America/Chicago'],\n ];\n\n $generatedAt = Carbon::parse('2026-02-24 06:00:00', 'America/Chicago');\n\n $result = $this->service->shouldSendReport($users, $generatedAt);\n\n $this->assertFalse($result);\n\n Carbon::setTestNow();\n }\n\n public function testGetTypes(): void\n {\n $types = AutomatedReportsService::getTypes();\n\n $this->assertIsArray($types);\n $this->assertContains('exec_summary', $types);\n $this->assertContains('coaching_profiles', $types);\n $this->assertContains('loss_analysis', $types);\n $this->assertNotContains('ask_jiminny', $types);\n }\n\n public function testGetCallTypes(): void\n {\n $callTypes = AutomatedReportsService::getCallTypes();\n\n $this->assertIsArray($callTypes);\n $this->assertContains('conference', $callTypes);\n $this->assertContains('dialer', $callTypes);\n }\n\n public function testGetFrequencies(): void\n {\n $frequencies = AutomatedReportsService::getFrequencies();\n\n $this->assertIsArray($frequencies);\n $this->assertContains('weekly', $frequencies);\n $this->assertContains('monthly', $frequencies);\n $this->assertContains('quarterly', $frequencies);\n $this->assertContains('one_off', $frequencies);\n $this->assertNotContains('daily', $frequencies);\n }\n\n public function testGetAskJiminnyFrequencies(): void\n {\n $frequencies = AutomatedReportsService::getAskJiminnyFrequencies();\n\n $this->assertIsArray($frequencies);\n $this->assertContains('daily', $frequencies);\n $this->assertContains('weekly', $frequencies);\n $this->assertContains('monthly', $frequencies);\n $this->assertNotContains('quarterly', $frequencies);\n $this->assertNotContains('one_off', $frequencies);\n }\n\n public function testGetReportEnabledFieldData(): void\n {\n $result = $this->service->getReportEnabledFieldData(true);\n\n $this->assertEquals('report_enabled', $result['id']);\n $this->assertTrue($result['value']);\n }\n\n public function testGetReportEnabledFieldDataDefault(): void\n {\n $result = $this->service->getReportEnabledFieldData();\n\n $this->assertFalse($result['value']);\n }\n\n public function testGetOrganizationFieldDataShortVersion(): void\n {\n $mockTeamRepository = $this->createMock(TeamRepository::class);\n $mockTeamRepository->method('getTeamsForKiosk')->willReturn(new Collection([]));\n\n $service = $this->getService(mockTeamRepository: $mockTeamRepository);\n $result = $service->getOrganizationFieldData(null, true);\n\n $this->assertEquals('organization', $result['id']);\n $this->assertArrayNotHasKey('inputType', $result);\n $this->assertArrayHasKey('options', $result);\n }\n\n public function testGetOrganizationFieldDataFullVersion(): void\n {\n $mockTeamRepository = $this->createMock(TeamRepository::class);\n $mockTeamRepository->method('getTeamsForKiosk')->willReturn(new Collection([]));\n\n $service = $this->getService(mockTeamRepository: $mockTeamRepository);\n $result = $service->getOrganizationFieldData('team-uuid-1', false);\n\n $this->assertEquals('organization', $result['id']);\n $this->assertArrayHasKey('inputType', $result);\n $this->assertEquals('team-uuid-1', $result['value']);\n $this->assertArrayHasKey('dependencies', $result);\n }\n\n public function testGetTeamFieldDataShortVersion(): void\n {\n $result = $this->service->getTeamFieldData([], [], true);\n\n $this->assertEquals('teams', $result['id']);\n $this->assertArrayNotHasKey('inputType', $result);\n }\n\n public function testGetTeamFieldDataFullVersion(): void\n {\n $result = $this->service->getTeamFieldData(['opt1'], ['val1'], false);\n\n $this->assertEquals('teams', $result['id']);\n $this->assertArrayHasKey('inputType', $result);\n $this->assertEquals(['opt1'], $result['options']);\n $this->assertEquals(['val1'], $result['value']);\n }\n\n public function testGetReportTypeFieldDataShortVersion(): void\n {\n $result = $this->service->getReportTypeFieldData(null, true);\n\n $this->assertEquals('report_type', $result['id']);\n $this->assertArrayNotHasKey('inputType', $result);\n }\n\n public function testGetReportTypeFieldDataFullVersion(): void\n {\n $result = $this->service->getReportTypeFieldData('exec_summary', false);\n\n $this->assertEquals('report_type', $result['id']);\n $this->assertArrayHasKey('inputType', $result);\n $this->assertEquals('exec_summary', $result['value']);\n }\n\n public function testGetReportTypeFieldDataWithTeamHavingBothFeatures(): void\n {\n $team = $this->createMock(\\Jiminny\\Models\\Team::class);\n $team->method('hasFeature')->willReturnMap([\n [\\Jiminny\\Models\\Feature\\FeatureEnum::AUTOMATED_REPORTS, true],\n [\\Jiminny\\Models\\Feature\\FeatureEnum::ASK_JIMINNY_REPORTS, true],\n ]);\n\n $result = $this->service->getReportTypeFieldData(null, true, $team);\n\n $ids = array_column($result['options'], 'id');\n $this->assertContains('exec_summary', $ids);\n $this->assertContains(AutomatedReportsService::TYPE_ASK_JIMINNY, $ids);\n $this->assertLessThan(\n array_search(AutomatedReportsService::TYPE_ASK_JIMINNY, $ids),\n array_search('exec_summary', $ids)\n );\n }\n\n public function testGetReportTypeFieldDataWithTeamHavingOnlyAutomatedReports(): void\n {\n $team = $this->createMock(\\Jiminny\\Models\\Team::class);\n $team->method('hasFeature')->willReturnMap([\n [\\Jiminny\\Models\\Feature\\FeatureEnum::AUTOMATED_REPORTS, true],\n [\\Jiminny\\Models\\Feature\\FeatureEnum::ASK_JIMINNY_REPORTS, false],\n ]);\n\n $result = $this->service->getReportTypeFieldData(null, true, $team);\n\n $ids = array_column($result['options'], 'id');\n $this->assertContains('exec_summary', $ids);\n $this->assertNotContains(AutomatedReportsService::TYPE_ASK_JIMINNY, $ids);\n }\n\n public function testGetReportTypeFieldDataWithTeamHavingOnlyAskJiminny(): void\n {\n $team = $this->createMock(\\Jiminny\\Models\\Team::class);\n $team->method('hasFeature')->willReturnMap([\n [\\Jiminny\\Models\\Feature\\FeatureEnum::AUTOMATED_REPORTS, false],\n [\\Jiminny\\Models\\Feature\\FeatureEnum::ASK_JIMINNY_REPORTS, true],\n ]);\n\n $result = $this->service->getReportTypeFieldData(null, true, $team);\n\n $ids = array_column($result['options'], 'id');\n $this->assertContains(AutomatedReportsService::TYPE_ASK_JIMINNY, $ids);\n $this->assertNotContains('exec_summary', $ids);\n }\n\n public function testGetReportTypeFieldDataWithNullTeamFallsBackToStandardTypes(): void\n {\n $result = $this->service->getReportTypeFieldData(null, true, null);\n\n $ids = array_column($result['options'], 'id');\n $this->assertContains('exec_summary', $ids);\n $this->assertNotContains(AutomatedReportsService::TYPE_ASK_JIMINNY, $ids);\n }\n\n public function testGetFrequencyFieldData(): void\n {\n $result = $this->service->getFrequencyFieldData('weekly');\n\n $this->assertEquals('frequency', $result['id']);\n $this->assertEquals('weekly', $result['value']);\n $this->assertArrayHasKey('options', $result);\n }\n\n public function testGetPeriodFieldData(): void\n {\n $result = $this->service->getPeriodFieldData('2025-01-01', '2025-01-31');\n\n $this->assertEquals('period', $result['id']);\n $this->assertEquals('2025-01-01', $result['value']['startDate']);\n $this->assertEquals('2025-01-31', $result['value']['endDate']);\n }\n\n public function testGetCallDurationFieldData(): void\n {\n $result = $this->service->getCallDurationFieldData(5, 60);\n\n $this->assertEquals('call_duration', $result['id']);\n $this->assertEquals(5, $result['value']['min']);\n $this->assertEquals(60, $result['value']['max']);\n }\n\n public function testGetDealValueFieldData(): void\n {\n $result = $this->service->getDealValueFieldData(1000, 5000);\n\n $this->assertEquals('deal_value', $result['id']);\n $this->assertEquals(1000, $result['value']['min']);\n $this->assertEquals(5000, $result['value']['max']);\n }\n\n public function testGetCustomReportNameFieldData(): void\n {\n $result = $this->service->getCustomReportNameFieldData('My Report');\n\n $this->assertEquals('custom_name', $result['id']);\n $this->assertEquals('My Report', $result['value']);\n }\n\n public function testGetAdditionalPromptInputFieldData(): void\n {\n $result = $this->service->getAdditionalPromptInputFieldData('Some prompt');\n\n $this->assertEquals('additional_prompt_input', $result['id']);\n $this->assertEquals('Some prompt', $result['value']);\n }\n\n public function testGetCallTypeFieldDataBothOn(): void\n {\n $result = $this->service->getCallTypeFieldData(true, true);\n\n $this->assertEquals('call_type', $result['id']);\n $this->assertCount(2, $result['value']);\n }\n\n public function testGetCallTypeFieldDataNoneOn(): void\n {\n $result = $this->service->getCallTypeFieldData(false, false);\n\n $this->assertEquals('call_type', $result['id']);\n $this->assertEmpty($result['value']);\n }\n\n public function testGetCallTypeFieldDataConferenceOnly(): void\n {\n $result = $this->service->getCallTypeFieldData(true, false);\n\n $this->assertCount(1, $result['value']);\n $this->assertEquals('conference', $result['value'][0]['id']);\n }\n\n public function testGetCallTypeFieldDataDialerOnly(): void\n {\n $result = $this->service->getCallTypeFieldData(false, true);\n\n $this->assertCount(1, $result['value']);\n $this->assertEquals('dialer', $result['value'][0]['id']);\n }\n\n public function testTransformDurationToMinutesNull(): void\n {\n $result = $this->service->transformDurationToMinutes(null);\n\n $this->assertNull($result);\n }\n\n public function testTransformDurationToMinutesZero(): void\n {\n $result = $this->service->transformDurationToMinutes(0);\n\n $this->assertNull($result);\n }\n\n public function testTransformDurationToMinutes(): void\n {\n $result = $this->service->transformDurationToMinutes(300);\n\n $this->assertEquals(5, $result);\n }\n\n public function testGetTeam(): void\n {\n $mockTeam = $this->createMock(Team::class);\n $mockTeamRepository = $this->createMock(TeamRepository::class);\n $mockTeamRepository->expects($this->once())\n ->method('idOrUuid')\n ->with('team-uuid')\n ->willReturn($mockTeam);\n\n $service = $this->getService(mockTeamRepository: $mockTeamRepository);\n $result = $service->getTeam('team-uuid');\n\n $this->assertSame($mockTeam, $result);\n }\n\n public function testGetTeamById(): void\n {\n $mockTeam = $this->createMock(Team::class);\n $mockTeamRepository = $this->createMock(TeamRepository::class);\n $mockTeamRepository->expects($this->once())\n ->method('find')\n ->with(42)\n ->willReturn($mockTeam);\n\n $service = $this->getService(mockTeamRepository: $mockTeamRepository);\n $result = $service->getTeamById(42);\n\n $this->assertSame($mockTeam, $result);\n }\n\n public function testGetGroupsUuidsEmpty(): void\n {\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getGroups')->willReturn([]);\n\n $result = $this->service->getGroupsUuids($report);\n\n $this->assertEquals([], $result);\n }\n\n public function testGetGroupsUuidsWithGroups(): void\n {\n $mockGroup = $this->createMock(Group::class);\n $mockGroup->method('getUuid')->willReturn('group-uuid-1');\n\n $mockGroupRepository = $this->createMock(GroupRepository::class);\n $mockGroupRepository->method('find')->willReturnMap([\n [10, $mockGroup],\n [99, null],\n ]);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $mockGroupRepository,\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getGroups')->willReturn([10, 99]);\n\n $result = $service->getGroupsUuids($report);\n\n $this->assertEquals(['group-uuid-1'], $result);\n }\n\n public function testGetPlaybookCategoriesUuidsEmpty(): void\n {\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getPlaybookCategories')->willReturn([]);\n\n $result = $this->service->getPlaybookCategoriesUuids($report);\n\n $this->assertEquals([], $result);\n }\n\n public function testGetPlaybookCategoriesUuidsWithCategories(): void\n {\n $mockCategory = $this->createMock(\\Jiminny\\Models\\PlaybookCategory::class);\n $mockCategory->method('getUuid')->willReturn('cat-uuid-1');\n\n $mockPlaybookCategoryRepository = $this->createMock(PlaybookCategoryRepository::class);\n $mockPlaybookCategoryRepository->method('find')->willReturnMap([\n [1, $mockCategory],\n [2, null],\n ]);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $mockPlaybookCategoryRepository,\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getPlaybookCategories')->willReturn([1, 2]);\n\n $result = $service->getPlaybookCategoriesUuids($report);\n\n $this->assertEquals(['cat-uuid-1'], $result);\n }\n\n public function testGetDealAtCallStagesUuidsEmpty(): void\n {\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getDealAtCallStages')->willReturn([]);\n\n $result = $this->service->getDealAtCallStagesUuids($report);\n\n $this->assertEquals([], $result);\n }\n\n public function testGetDealAtCallStagesUuidsWithStages(): void\n {\n $mockStage = $this->createMock(\\Jiminny\\Models\\Stage::class);\n $mockStage->method('getUuid')->willReturn('stage-uuid-1');\n\n $mockStageRepository = $this->createMock(StageRepository::class);\n $mockStageRepository->method('find')->willReturnMap([\n [5, $mockStage],\n [9, null],\n ]);\n\n $service = $this->getService(mockStageRepository: $mockStageRepository);\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getDealAtCallStages')->willReturn([5, 9]);\n\n $result = $service->getDealAtCallStagesUuids($report);\n\n $this->assertEquals(['stage-uuid-1'], $result);\n }\n\n public function testGetJiminnyUsersUuids(): void\n {\n $mockUser = $this->createMock(User::class);\n $mockUser->method('getUuid')->willReturn('user-uuid-1');\n\n $mockUserRepository = $this->createMock(UserRepository::class);\n $mockUserRepository->method('find')->willReturn($mockUser);\n\n $service = $this->getService(mockUserRepository: $mockUserRepository);\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getJiminnyRecipients')->willReturn(['users' => [1]]);\n\n $result = $service->getJiminnyUsersUuids($report);\n\n $this->assertEquals(['user-uuid-1'], $result);\n }\n\n public function testGetRecipientUsers(): void\n {\n $mockUser = $this->createMock(User::class);\n $mockUser->method('getEmailAddress')->willReturn('user@test.com');\n $mockUser->method('getName')->willReturn('Test User');\n $timezone = $this->createMock(\\DateTimeZone::class);\n $timezone->method('getName')->willReturn('UTC');\n $mockUser->method('getTimezone')->willReturn($timezone);\n\n $mockUserRepository = $this->createMock(UserRepository::class);\n $mockUserRepository->method('find')->willReturn($mockUser);\n\n $service = $this->getService(mockUserRepository: $mockUserRepository);\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getRecipients')->willReturn(['users' => [1]]);\n\n $result = $service->getRecipientUsers($report);\n\n $this->assertCount(1, $result);\n $this->assertEquals('user@test.com', $result[0]['email']);\n $this->assertEquals('Test User', $result[0]['name']);\n }\n\n public function testGetValidRecipientUsersFiltersEmptyEmail(): void\n {\n $mockUserWithEmail = $this->createMock(User::class);\n $mockUserWithEmail->method('getEmailAddress')->willReturn('valid@test.com');\n $mockUserWithEmail->method('getName')->willReturn('Valid User');\n $timezone = $this->createMock(\\DateTimeZone::class);\n $timezone->method('getName')->willReturn('UTC');\n $mockUserWithEmail->method('getTimezone')->willReturn($timezone);\n\n $mockUserNoEmail = $this->createMock(User::class);\n $mockUserNoEmail->method('getEmailAddress')->willReturn('');\n $mockUserNoEmail->method('getName')->willReturn('No Email User');\n $mockUserNoEmail->method('getTimezone')->willReturn($timezone);\n\n $mockUserRepository = $this->createMock(UserRepository::class);\n $mockUserRepository->method('find')->willReturnMap([\n [1, $mockUserWithEmail],\n [2, $mockUserNoEmail],\n ]);\n\n $service = $this->getService(mockUserRepository: $mockUserRepository);\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getRecipients')->willReturn(['users' => [1, 2]]);\n $report->method('getJiminnyRecipients')->willReturn(['users' => []]);\n\n $result = $service->getValidRecipientUsers($report);\n\n $this->assertCount(1, $result);\n $this->assertEquals('valid@test.com', $result[0]['email']);\n }\n\n public function testGetValidRecipientUsersWithJiminny(): void\n {\n $tz = $this->createMock(\\DateTimeZone::class);\n $tz->method('getName')->willReturn('UTC');\n\n $mockUser1 = $this->createMock(User::class);\n $mockUser1->method('getEmailAddress')->willReturn('user1@test.com');\n $mockUser1->method('getName')->willReturn('User1');\n $mockUser1->method('getTimezone')->willReturn($tz);\n\n $mockUser2 = $this->createMock(User::class);\n $mockUser2->method('getEmailAddress')->willReturn('jiminny@test.com');\n $mockUser2->method('getName')->willReturn('Jiminny');\n $mockUser2->method('getTimezone')->willReturn($tz);\n\n $mockUserRepository = $this->createMock(UserRepository::class);\n $mockUserRepository->method('find')->willReturnMap([\n [1, $mockUser1],\n [2, $mockUser2],\n ]);\n\n $service = $this->getService(mockUserRepository: $mockUserRepository);\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getRecipients')->willReturn(['users' => [1]]);\n $report->method('getJiminnyRecipients')->willReturn(['users' => [2]]);\n\n $result = $service->getValidRecipientUsers($report, true);\n\n $this->assertCount(2, $result);\n }\n\n public function testGetReportTypeName(): void\n {\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getType')->willReturn('exec_summary');\n\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getReport')->willReturn($report);\n\n $result = $this->service->getReportTypeName($mockResult);\n\n $this->assertEquals('Exec Summary', $result);\n }\n\n public function testGetReportPeriodNameThrowsOnNullFrom(): void\n {\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getFrequency')->willReturn('weekly');\n\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getReport')->willReturn($report);\n $mockResult->method('getFromDate')->willReturn(null);\n $mockResult->method('getToDate')->willReturn(IlluminateCarbon::parse('2025-01-15'));\n\n $this->expectException(\\Jiminny\\Exceptions\\ApplicationException::class);\n\n $this->service->getReportPeriodName($mockResult);\n }\n\n public function testGetReportPeriodNameThrowsOnNullTo(): void\n {\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getFrequency')->willReturn('weekly');\n\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getReport')->willReturn($report);\n $mockResult->method('getFromDate')->willReturn(IlluminateCarbon::parse('2025-01-08'));\n $mockResult->method('getToDate')->willReturn(null);\n\n $this->expectException(\\Jiminny\\Exceptions\\ApplicationException::class);\n\n $this->service->getReportPeriodName($mockResult);\n }\n\n #[DataProvider('formatReportPeriodNameDataProvider')]\n public function testGetReportPeriodName(\n string $frequency,\n string $from,\n string $to,\n string $expected\n ): void {\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getFrequency')->willReturn($frequency);\n\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getReport')->willReturn($report);\n $mockResult->method('getFromDate')->willReturn(IlluminateCarbon::parse($from));\n $mockResult->method('getToDate')->willReturn(IlluminateCarbon::parse($to));\n\n $result = $this->service->getReportPeriodName($mockResult);\n\n $this->assertEquals($expected, $result);\n }\n\n public static function formatReportPeriodNameDataProvider(): array\n {\n return [\n 'daily' => [\n 'frequency' => 'daily',\n 'from' => '2025-05-15',\n 'to' => '2025-05-15',\n 'expected' => '15 May 2025',\n ],\n 'monthly same year' => [\n 'frequency' => 'monthly',\n 'from' => '2025-05-01',\n 'to' => '2025-05-31',\n 'expected' => 'May 2025',\n ],\n 'weekly same month' => [\n 'frequency' => 'weekly',\n 'from' => '2025-08-04',\n 'to' => '2025-08-08',\n 'expected' => '4 - 8 Aug 2025',\n ],\n 'weekly different months same year' => [\n 'frequency' => 'weekly',\n 'from' => '2025-10-27',\n 'to' => '2025-11-03',\n 'expected' => '27 Oct - 3 Nov 2025',\n ],\n 'weekly different years' => [\n 'frequency' => 'weekly',\n 'from' => '2024-12-28',\n 'to' => '2025-01-03',\n 'expected' => '28 Dec 2024 - 3 Jan 2025',\n ],\n 'quarterly same year' => [\n 'frequency' => 'quarterly',\n 'from' => '2025-01-01',\n 'to' => '2025-04-01',\n 'expected' => 'Jan - Mar 2025',\n ],\n 'quarterly different years' => [\n 'frequency' => 'quarterly',\n 'from' => '2024-11-01',\n 'to' => '2025-02-01',\n 'expected' => 'Nov 2024 - Jan 2025',\n ],\n 'one_off same month' => [\n 'frequency' => 'one_off',\n 'from' => '2025-05-02',\n 'to' => '2025-05-31',\n 'expected' => '2 - 31 May 2025',\n ],\n 'one_off different months same year' => [\n 'frequency' => 'one_off',\n 'from' => '2025-05-15',\n 'to' => '2025-06-15',\n 'expected' => '15 May - 15 Jun 2025',\n ],\n 'one_off different years' => [\n 'frequency' => 'one_off',\n 'from' => '2024-12-15',\n 'to' => '2025-01-15',\n 'expected' => '15 Dec 2024 - 15 Jan 2025',\n ],\n 'unknown frequency falls back to default' => [\n 'frequency' => 'unknown',\n 'from' => '2025-05-01',\n 'to' => '2025-05-31',\n 'expected' => '1 May 2025 - 31 May 2025',\n ],\n ];\n }\n\n public function testGetReportTeamsNameEmpty(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getGroups')->willReturn([]);\n\n $result = $this->service->getReportTeamsName($mockResult);\n\n $this->assertEquals('All', $result);\n }\n\n public function testGetReportTeamsNameSingleGroup(): void\n {\n $mockGroup = $this->createMock(Group::class);\n $mockGroup->method('getName')->willReturn('Sales Team');\n\n $mockGroupRepository = $this->createMock(GroupRepository::class);\n $mockGroupRepository->method('find')->willReturn($mockGroup);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $mockGroupRepository,\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getGroups')->willReturn([10]);\n\n $result = $service->getReportTeamsName($mockResult);\n\n $this->assertEquals('Sales Team', $result);\n }\n\n public function testGetReportTeamsNameMultipleGroups(): void\n {\n $mockGroup1 = $this->createMock(Group::class);\n $mockGroup1->method('getName')->willReturn('Sales Team');\n\n $mockGroup2 = $this->createMock(Group::class);\n $mockGroup2->method('getName')->willReturn('Marketing Team');\n\n $mockGroupRepository = $this->createMock(GroupRepository::class);\n $mockGroupRepository->method('find')->willReturnMap([\n [10, $mockGroup1],\n [20, $mockGroup2],\n [99, null],\n ]);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $mockGroupRepository,\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getGroups')->willReturn([10, 20, 99]);\n\n $result = $service->getReportTeamsName($mockResult);\n\n $this->assertEquals('Sales Team, Marketing Team', $result);\n }\n\n public function testGetReportFound(): void\n {\n $mockReport = $this->createMock(AutomatedReport::class);\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->expects($this->once())\n ->method('findByUuid')\n ->with('report-uuid')\n ->willReturn($mockReport);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $result = $service->getReport('report-uuid');\n\n $this->assertSame($mockReport, $result);\n }\n\n public function testGetReportNotFound(): void\n {\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->method('findByUuid')->willReturn(null);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(ModelNotFoundException::class);\n\n $service->getReport('non-existent-uuid');\n }\n\n public function testDeleteReportNotFound(): void\n {\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->method('findByUuid')->willReturn(null);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(ModelNotFoundException::class);\n\n $service->delete('non-existent-uuid');\n }\n\n public function testDeleteReportSuccess(): void\n {\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->expects($this->once())->method('delete');\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->method('findByUuid')->willReturn($mockReport);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $service->delete('report-uuid');\n }\n\n public function testUpdateStatusNotFound(): void\n {\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->method('findByUuid')->willReturn(null);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(ModelNotFoundException::class);\n\n $service->updateStatus('non-existent-uuid', ['report_enabled' => true]);\n }\n\n public function testGetReportResultFound(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->expects($this->once())\n ->method('findResultByUuid')\n ->with('result-uuid')\n ->willReturn($mockResult);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $result = $service->getReportResult('result-uuid');\n\n $this->assertSame($mockResult, $result);\n }\n\n public function testGetReportResultNotFound(): void\n {\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->method('findResultByUuid')->willReturn(null);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(ModelNotFoundException::class);\n\n $service->getReportResult('non-existent-uuid');\n }\n\n public function testFindChildResult(): void\n {\n $mockParent = $this->createMock(AutomatedReportResult::class);\n $mockChild = $this->createMock(AutomatedReportResult::class);\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->expects($this->once())\n ->method('findChildResult')\n ->with($mockParent, 'podcast')\n ->willReturn($mockChild);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $result = $service->findChildResult($mockParent, 'podcast');\n\n $this->assertSame($mockChild, $result);\n }\n\n #[DataProvider('calculateFromAndToDatePeriodDataProvider')]\n public function testCalculateFromAndToDatePeriod(string $frequency): void\n {\n Carbon::setTestNow(Carbon::parse('2025-06-15 12:00:00'));\n\n $result = $this->service->calculateFromAndToDatePeriod($frequency);\n\n $this->assertArrayHasKey('fromDate', $result);\n $this->assertArrayHasKey('toDate', $result);\n $this->assertInstanceOf(Carbon::class, $result['fromDate']);\n $this->assertInstanceOf(Carbon::class, $result['toDate']);\n\n Carbon::setTestNow();\n }\n\n public static function calculateFromAndToDatePeriodDataProvider(): array\n {\n return [\n 'daily' => ['daily'],\n 'weekly' => ['weekly'],\n 'monthly' => ['monthly'],\n 'quarterly' => ['quarterly'],\n ];\n }\n\n public function testCalculateFromAndToDatePeriodOneOff(): void\n {\n $from = IlluminateCarbon::parse('2025-01-01');\n $to = IlluminateCarbon::parse('2025-01-31');\n\n $result = $this->service->calculateFromAndToDatePeriod('one_off', $from, $to);\n\n $this->assertSame($from, $result['fromDate']);\n $this->assertSame($to, $result['toDate']);\n }\n\n public function testCalculateFromAndToDatePeriodInvalidFrequency(): void\n {\n $this->expectException(InvalidArgumentException::class);\n\n $this->service->calculateFromAndToDatePeriod('invalid_frequency');\n }\n\n public function testGetMediaPath(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PDF);\n $mockResult->method('getPdfUrl')->willReturn('https://example.com/reports/file.pdf');\n\n $result = $this->service->getMediaPath($mockResult);\n\n $this->assertEquals('/reports/file.pdf', $result);\n }\n\n public function testGetMediaPathPodcast(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PODCAST);\n $mockResult->method('getPodcastAudioUrl')->willReturn('https://example.com/audio/file.mp3');\n\n $result = $this->service->getMediaPath($mockResult);\n\n $this->assertEquals('/audio/file.mp3', $result);\n }\n\n public function testGetMediaPathNullUrl(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getMediaType')->willReturn('unknown_type');\n\n $result = $this->service->getMediaPath($mockResult);\n\n $this->assertNull($result);\n }\n\n public function testGetMediaPathPdfNullUrl(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PDF);\n $mockResult->method('getPdfUrl')->willReturn(null);\n\n $result = $this->service->getMediaPath($mockResult);\n\n $this->assertNull($result);\n }\n\n public function testGetFilenameSuffixPodcast(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PODCAST);\n\n $result = $this->service->getFilenameSuffix($mockResult);\n\n $this->assertEquals('Podcast', $result);\n }\n\n public function testGetFilenameSuffixPdf(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PDF);\n\n $result = $this->service->getFilenameSuffix($mockResult);\n\n $this->assertNull($result);\n }\n\n public function testGetMailSubjectSuffixPdf(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PDF);\n\n $result = $this->service->getMailSubjectSuffix($mockResult);\n\n $this->assertEquals('report', $result);\n }\n\n public function testGetMailSubjectSuffixPodcast(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PODCAST);\n\n $result = $this->service->getMailSubjectSuffix($mockResult);\n\n $this->assertEquals('podcast', $result);\n }\n\n public function testGetMailSubjectSuffixUnknown(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getMediaType')->willReturn('unknown_type');\n\n $result = $this->service->getMailSubjectSuffix($mockResult);\n\n $this->assertEquals('', $result);\n }\n\n public function testGetMediaTypeMetadataPdf(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PDF);\n\n $result = $this->service->getMediaTypeMetadata($mockResult);\n\n $this->assertEquals('pdf', $result['extension']);\n $this->assertEquals('application/pdf', $result['mime']);\n }\n\n public function testGetMediaTypeMetadataPodcast(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PODCAST);\n\n $result = $this->service->getMediaTypeMetadata($mockResult);\n\n $this->assertEquals('mp3', $result['extension']);\n $this->assertEquals('audio/mpeg', $result['mime']);\n }\n\n public function testGetMediaTypeMetadataUnknown(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getMediaType')->willReturn('unknown');\n\n $result = $this->service->getMediaTypeMetadata($mockResult);\n\n $this->assertNull($result['extension']);\n $this->assertNull($result['mime']);\n }\n\n public function testGetTeamIdsWithReportsResults(): void\n {\n $expected = new Collection([1, 2, 3]);\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->expects($this->once())\n ->method('getTeamIdsWithReportsResults')\n ->with(5)\n ->willReturn($expected);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $result = $service->getTeamIdsWithReportsResults(5);\n\n $this->assertSame($expected, $result);\n }\n\n public function testGetTeamReports(): void\n {\n $mockTeam = $this->createMock(Team::class);\n $expected = new \\Illuminate\\Database\\Eloquent\\Collection();\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->expects($this->once())\n ->method('getReportsByTeam')\n ->with($mockTeam)\n ->willReturn($expected);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $result = $service->getTeamReports($mockTeam);\n\n $this->assertSame($expected, $result);\n }\n\n public function testGetReportResults(): void\n {\n $mockReport = $this->createMock(AutomatedReport::class);\n $expected = new \\Illuminate\\Database\\Eloquent\\Collection();\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->expects($this->once())\n ->method('getResultsByReport')\n ->with($mockReport)\n ->willReturn($expected);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $result = $service->getReportResults($mockReport);\n\n $this->assertSame($expected, $result);\n }\n\n public function testDeleteReportsResultsInRetentionPeriodNoReports(): void\n {\n $mockTeam = $this->createMock(Team::class);\n $retentionDate = \\Carbon\\CarbonImmutable::parse('2025-01-01');\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->expects($this->once())\n ->method('getReportIdsByTeam')\n ->willReturn(new Collection([]));\n $mockRepo->expects($this->never())\n ->method('getReportResultsQueryForRetention');\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $result = $service->deleteReportsResultsInRetentionPeriod($mockTeam, $retentionDate);\n\n $this->assertEquals(0, $result);\n }\n\n public function testDeleteReportsResultsInRetentionPeriodWithNoQueryResults(): void\n {\n $mockTeam = $this->createMock(Team::class);\n $mockTeam->method('getId')->willReturn(1);\n $retentionDate = \\Carbon\\CarbonImmutable::parse('2025-01-01');\n\n $mockQuery = Mockery::mock(Builder::class);\n $mockQuery->shouldReceive('exists')->andReturn(false);\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->method('getReportIdsByTeam')->willReturn(new Collection([1, 2]));\n $mockRepo->method('getReportResultsQueryForRetention')->willReturn($mockQuery);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n Log::shouldReceive('info')->zeroOrMoreTimes();\n\n $result = $service->deleteReportsResultsInRetentionPeriod($mockTeam, $retentionDate);\n\n $this->assertEquals(0, $result);\n }\n\n public function testUpdateAskJiminnyReportStatusNotAskJiminny(): void\n {\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('isAskJiminnyReport')->willReturn(false);\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $mockUser = $this->createMock(User::class);\n\n $this->expectException(InvalidArgumentException::class);\n $this->expectExceptionMessage('Report is not an Ask Jiminny report');\n\n $service->updateAskJiminnyReport($mockReport, [], $mockUser);\n }\n\n public function testGetAskJiminnyReportFilters(): void\n {\n $mockUser = $this->createMock(User::class);\n\n $mockSearch = $this->createMock(Search::class);\n $mockSearch->method('getUuid')->willReturn('search-uuid-1');\n $mockSearch->method('getName')->willReturn('My Search');\n\n $mockSearchRepository = $this->createMock(SearchRepository::class);\n $mockSearchRepository->expects($this->once())\n ->method('findByUserOrderedByName')\n ->with($mockUser)\n ->willReturn(new Collection([$mockSearch]));\n\n $mockPromptDto = new AskAnythingPromptDto(\n id: 'prompt-uuid-1',\n title: 'My Prompt',\n content: 'Prompt text',\n target: AskAnythingPromptTarget::on_demand,\n );\n\n $mockPromptService = $this->createMock(AskAnythingPromptService::class);\n $mockPromptService->expects($this->once())\n ->method('get')\n ->with($mockUser, AskAnythingPromptTarget::on_demand)\n ->willReturn([$mockPromptDto]);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $mockPromptService,\n $mockSearchRepository,\n $this->createMock(AskAnythingRepository::class),\n );\n\n $result = $service->getAskJiminnyReportFilters($mockUser);\n\n $this->assertCount(2, $result);\n $promptFilter = collect($result)->firstWhere('id', 'prompt');\n $searchFilter = collect($result)->firstWhere('id', 'saved_search');\n\n $this->assertCount(1, $promptFilter['options']);\n $this->assertEquals('prompt-uuid-1', $promptFilter['options'][0]['id']);\n $this->assertCount(1, $searchFilter['options']);\n $this->assertEquals('search-uuid-1', $searchFilter['options'][0]['id']);\n }\n\n public function testGetAskJiminnyReportFormDataWithoutReport(): void\n {\n $timezone = new \\DateTimeZone('UTC');\n\n $mockUser = $this->createMock(User::class);\n $mockUser->method('getTimezone')->willReturn($timezone);\n\n $mockTeam = $this->createMock(Team::class);\n $mockUser->method('getTeam')->willReturn($mockTeam);\n\n $mockSearchRepository = $this->createMock(SearchRepository::class);\n $mockSearchRepository->method('findByUserOrderedByName')->willReturn(new Collection([]));\n\n $mockPromptService = $this->createMock(AskAnythingPromptService::class);\n $mockPromptService->method('get')->willReturn([]);\n\n $mockGroupRepository = $this->createMock(GroupRepository::class);\n $mockGroupRepository->method('getAllByTeam')->willReturn(new \\Illuminate\\Database\\Eloquent\\Collection([]));\n\n $mockRecipientsService = $this->createMock(RecipientsService::class);\n $mockRecipientsService->method('getRecipientsFieldData')->willReturn(['options' => []]);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $mockGroupRepository,\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $mockRecipientsService,\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $mockPromptService,\n $mockSearchRepository,\n $this->createMock(AskAnythingRepository::class),\n );\n\n $result = $service->getAskJiminnyReportFormData($mockUser);\n\n $this->assertArrayHasKey('fields', $result);\n $this->assertIsArray($result['fields']);\n\n $fieldIds = array_column($result['fields'], 'id');\n $this->assertContains('enabled', $fieldIds);\n $this->assertContains('report_name', $fieldIds);\n $this->assertContains('frequency', $fieldIds);\n $this->assertContains('expires_on', $fieldIds);\n $this->assertContains('saved_search', $fieldIds);\n $this->assertContains('ask_jiminny_prompt', $fieldIds);\n }\n\n public function testGetAskJiminnyReportFormDataWithReport(): void\n {\n $timezone = new \\DateTimeZone('UTC');\n\n $mockUser = $this->createMock(User::class);\n $mockUser->method('getTimezone')->willReturn($timezone);\n\n $mockTeam = $this->createMock(Team::class);\n $mockUser->method('getTeam')->willReturn($mockTeam);\n\n $mockSavedSearch = $this->createMock(Search::class);\n $mockSavedSearch->method('getUuid')->willReturn('search-uuid');\n $mockSavedSearch->method('getName')->willReturn('My Search');\n\n $mockPromptModel = $this->createMock(AskAnythingPrompt::class);\n $mockPromptModel->method('getUuid')->willReturn('prompt-uuid');\n $mockPromptModel->method('getTitle')->willReturn('My Prompt');\n\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getStatus')->willReturn(true);\n $mockReport->method('getCustomName')->willReturn('Test Report');\n $mockReport->method('getFrequency')->willReturn('daily');\n $mockReport->method('getExpiresAt')->willReturn(IlluminateCarbon::parse('2025-12-31'));\n $mockReport->method('getGroups')->willReturn([]);\n $mockReport->method('getRecipients')->willReturn(['users' => []]);\n $mockReport->method('getAttribute')->with('created_by')->willReturn(1);\n $mockReport->method('getSavedSearch')->willReturn($mockSavedSearch);\n $mockReport->method('getAskAnythingPrompt')->willReturn($mockPromptModel);\n\n $mockSearchRepository = $this->createMock(SearchRepository::class);\n $mockSearchRepository->method('findByUserOrderedByName')->willReturn(new Collection([]));\n\n $mockPromptService = $this->createMock(AskAnythingPromptService::class);\n $mockPromptService->method('get')->willReturn([]);\n\n $mockGroupRepository = $this->createMock(GroupRepository::class);\n $mockGroupRepository->method('getAllByTeam')->willReturn(new \\Illuminate\\Database\\Eloquent\\Collection([]));\n\n $mockRecipientsService = $this->createMock(RecipientsService::class);\n $mockRecipientsService->method('getRecipientsFieldData')->willReturn(['options' => []]);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $mockGroupRepository,\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $mockRecipientsService,\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $mockPromptService,\n $mockSearchRepository,\n $this->createMock(AskAnythingRepository::class),\n );\n\n $result = $service->getAskJiminnyReportFormData($mockUser, $mockReport);\n\n $fields = collect($result['fields'])->keyBy('id');\n\n $this->assertTrue($fields['enabled']['value']);\n $this->assertEquals('Test Report', $fields['report_name']['value']);\n }\n\n public function testValidateAskJiminnyReportDataMissingName(): void\n {\n $mockUser = $this->createMock(User::class);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(InvalidArgumentException::class);\n $this->expectExceptionMessage('Report name is required');\n\n $service->createAskJiminnyReport(['report_name' => ''], $mockUser);\n }\n\n public function testValidateAskJiminnyReportDataNameTooLong(): void\n {\n $mockUser = $this->createMock(User::class);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(InvalidArgumentException::class);\n $this->expectExceptionMessage('Report name must be 50 characters or less');\n\n $service->createAskJiminnyReport(['report_name' => str_repeat('a', 51)], $mockUser);\n }\n\n public function testValidateAskJiminnyReportDataInvalidFrequency(): void\n {\n $mockUser = $this->createMock(User::class);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(InvalidArgumentException::class);\n $this->expectExceptionMessage('Frequency must be daily, weekly, or monthly');\n\n $service->createAskJiminnyReport(['report_name' => 'Valid Name', 'frequency' => 'quarterly'], $mockUser);\n }\n\n public function testValidateAskJiminnyReportDataMissingExpiresOn(): void\n {\n $mockUser = $this->createMock(User::class);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(InvalidArgumentException::class);\n $this->expectExceptionMessage('Expiration date is required');\n\n $service->createAskJiminnyReport(\n ['report_name' => 'Valid Name', 'frequency' => 'daily'],\n $mockUser\n );\n }\n\n public function testValidateAskJiminnyReportDataExpiresInPast(): void\n {\n $mockUser = $this->createMock(User::class);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(InvalidArgumentException::class);\n $this->expectExceptionMessage('Expiration date cannot be in the past');\n\n $service->createAskJiminnyReport(\n ['report_name' => 'Valid Name', 'frequency' => 'daily', 'expires_on' => '2020-01-01'],\n $mockUser\n );\n }\n\n public function testValidateAskJiminnyReportDataExpiresTooFar(): void\n {\n $mockUser = $this->createMock(User::class);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(InvalidArgumentException::class);\n $this->expectExceptionMessage('Expiration date cannot be more than 1 year from now');\n\n $service->createAskJiminnyReport(\n ['report_name' => 'Valid Name', 'frequency' => 'daily', 'expires_on' => '2099-01-01'],\n $mockUser\n );\n }\n\n public function testValidateAskJiminnyReportDataExpiresExactlyOneYearLaterTimeOfDayIsAccepted(): void\n {\n Carbon::setTestNow(Carbon::parse('2026-04-20 09:00:00'));\n\n try {\n $mockUser = $this->createMock(User::class);\n $mockUser->method('getId')->willReturn(1);\n $mockUser->method('getTeamId')->willReturn(1);\n\n $savedSearch = $this->createMock(Search::class);\n $savedSearch->method('getId')->willReturn(10);\n\n $prompt = $this->createMock(AskAnythingPrompt::class);\n $prompt->method('getId')->willReturn(5);\n\n $activitySearchRepository = $this->createMock(SearchRepository::class);\n $activitySearchRepository->method('findByUuidAndUser')->willReturn($savedSearch);\n\n $askAnythingRepository = $this->createMock(AskAnythingRepository::class);\n $askAnythingRepository->method('getPromptByUuid')->willReturn($prompt);\n\n $automatedReportsRepository = $this->createMock(AutomatedReportsRepository::class);\n $automatedReportsRepository->method('create')->willReturn($this->createMock(AutomatedReport::class));\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $automatedReportsRepository,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $activitySearchRepository,\n $askAnythingRepository,\n );\n\n $service->createAskJiminnyReport([\n 'report_name' => 'Valid Name',\n 'frequency' => 'daily',\n 'expires_on' => '2027-04-20T23:00:00',\n 'saved_search' => 'some-uuid',\n 'ask_jiminny_prompt' => 'prompt-uuid',\n ], $mockUser);\n\n $this->assertTrue(true);\n } finally {\n Carbon::setTestNow();\n }\n }\n\n public function testValidateAskJiminnyReportDataMissingSavedSearch(): void\n {\n $mockUser = $this->createMock(User::class);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(InvalidArgumentException::class);\n $this->expectExceptionMessage('Saved search is required');\n\n $service->createAskJiminnyReport(\n ['report_name' => 'Valid Name', 'frequency' => 'daily', 'expires_on' => now()->addMonth()->toDateString()],\n $mockUser\n );\n }\n\n public function testValidateAskJiminnyReportDataSavedSearchNotFound(): void\n {\n $mockUser = $this->createMock(User::class);\n\n $mockSearchRepository = $this->createMock(SearchRepository::class);\n $mockSearchRepository->method('findByUuidAndUser')->willReturn(null);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $mockSearchRepository,\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(InvalidArgumentException::class);\n $this->expectExceptionMessage('Saved search not found or does not belong to you');\n\n $service->createAskJiminnyReport(\n [\n 'report_name' => 'Valid Name',\n 'frequency' => 'daily',\n 'expires_on' => now()->addMonth()->toDateString(),\n 'saved_search' => 'non-existent-uuid',\n ],\n $mockUser\n );\n }\n\n public function testValidateAskJiminnyReportDataMissingPrompt(): void\n {\n $mockUser = $this->createMock(User::class);\n\n $mockSearch = $this->createMock(Search::class);\n $mockSearchRepository = $this->createMock(SearchRepository::class);\n $mockSearchRepository->method('findByUuidAndUser')->willReturn($mockSearch);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $mockSearchRepository,\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(InvalidArgumentException::class);\n $this->expectExceptionMessage('Ask Jiminny prompt is required');\n\n $service->createAskJiminnyReport(\n [\n 'report_name' => 'Valid Name',\n 'frequency' => 'daily',\n 'expires_on' => now()->addMonth()->toDateString(),\n 'saved_search' => 'search-uuid',\n ],\n $mockUser\n );\n }\n\n public function testValidateAskJiminnyReportDataPromptNotFound(): void\n {\n $mockUser = $this->createMock(User::class);\n\n $mockSearch = $this->createMock(Search::class);\n $mockSearchRepository = $this->createMock(SearchRepository::class);\n $mockSearchRepository->method('findByUuidAndUser')->willReturn($mockSearch);\n\n $mockAskAnythingRepository = $this->createMock(AskAnythingRepository::class);\n $mockAskAnythingRepository->method('getPromptByUuid')->willReturn(null);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $mockSearchRepository,\n $mockAskAnythingRepository,\n );\n\n $this->expectException(InvalidArgumentException::class);\n $this->expectExceptionMessage('Ask Jiminny prompt not found');\n\n $service->createAskJiminnyReport(\n [\n 'report_name' => 'Valid Name',\n 'frequency' => 'daily',\n 'expires_on' => now()->addMonth()->toDateString(),\n 'saved_search' => 'search-uuid',\n 'ask_jiminny_prompt' => 'non-existent-prompt-uuid',\n ],\n $mockUser\n );\n }\n\n public function testTransformRecipientsWithNullUsers(): void\n {\n $reflection = new \\ReflectionClass(AutomatedReportsService::class);\n $method = $reflection->getMethod('transformRecipients');\n $method->setAccessible(true);\n\n $result = $method->invoke($this->service, []);\n\n $this->assertEquals([], $result);\n }\n\n public function testTransformRecipientsWithUsersKey(): void\n {\n $mockUser = $this->createMock(User::class);\n $mockUser->method('getUuid')->willReturn('user-uuid-1');\n $mockUser->method('getName')->willReturn('User One');\n $mockUser->method('getEmailAddress')->willReturn('user1@test.com');\n $mockUser->method('getPhotoUrl')->willReturn(null);\n\n $mockUserRepository = $this->createMock(UserRepository::class);\n $mockUserRepository->method('find')->willReturn($mockUser);\n\n $service = $this->getService(mockUserRepository: $mockUserRepository);\n\n $reflection = new \\ReflectionClass(AutomatedReportsService::class);\n $method = $reflection->getMethod('transformRecipients');\n $method->setAccessible(true);\n\n $result = $method->invoke($service, ['users' => [1]]);\n\n $this->assertCount(1, $result);\n $this->assertEquals('user-uuid-1', $result[0]['id']);\n }\n\n public function testGetTeamsGroupsOptions(): void\n {\n $mockTeamRepository = $this->createMock(TeamRepository::class);\n\n $mockTeam = $this->createMock(Team::class);\n $mockTeam->method('getUuid')->willReturn('team-uuid-1');\n $mockTeam->method('getName')->willReturn('Sales Team');\n $mockTeam->method('hasFeature')\n ->with(FeatureEnum::AUTOMATED_REPORTS)\n ->willReturn(true);\n\n $mockGroupsRelation = $this->createMock(HasMany::class);\n $mockGroupsRelation->method('get')->willReturn(new \\Illuminate\\Database\\Eloquent\\Collection([]));\n $mockTeam->method('groups')->willReturn($mockGroupsRelation);\n\n $mockTeamRepository->method('getTeamsForKiosk')->willReturn(new Collection([$mockTeam]));\n $mockTeamRepository->method('idOrUuid')->willReturn($mockTeam);\n\n $service = $this->getService(mockTeamRepository: $mockTeamRepository);\n\n $result = $service->getTeamsGroupsOptions();\n\n $this->assertCount(1, $result);\n $this->assertEquals('Sales Team', $result[0]['label']);\n $this->assertArrayHasKey('groups', $result[0]);\n }\n\n public function testGetTeamsGroupsOptionsWithFilter(): void\n {\n $mockTeamRepository = $this->createMock(TeamRepository::class);\n\n $mockTeam1 = $this->createMock(Team::class);\n $mockTeam1->method('getUuid')->willReturn('team-uuid-1');\n $mockTeam1->method('getName')->willReturn('Sales Team');\n $mockTeam1->method('hasFeature')->willReturn(true);\n\n $mockTeam2 = $this->createMock(Team::class);\n $mockTeam2->method('getUuid')->willReturn('team-uuid-2');\n $mockTeam2->method('getName')->willReturn('Marketing Team');\n $mockTeam2->method('hasFeature')->willReturn(true);\n\n $mockTeamRepository->method('getTeamsForKiosk')\n ->willReturn(new Collection([$mockTeam1, $mockTeam2]));\n\n $mockGroupsRelation = $this->createMock(HasMany::class);\n $mockGroupsRelation->method('get')->willReturn(new \\Illuminate\\Database\\Eloquent\\Collection([]));\n $mockTeam1->method('groups')->willReturn($mockGroupsRelation);\n\n $mockTeamRepository->method('idOrUuid')->willReturn($mockTeam1);\n\n $service = $this->getService(mockTeamRepository: $mockTeamRepository);\n\n $result = $service->getTeamsGroupsOptions(['team-uuid-1']);\n\n $this->assertCount(1, $result);\n $this->assertEquals('Sales Team', $result[0]['label']);\n }\n\n public function testGetReturnsTransformedReport(): void\n {\n $mockTeam = $this->createMock(Team::class);\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getType')->willReturn('exec_summary');\n $mockReport->method('getUuid')->willReturn('report-uuid');\n $mockReport->method('getFrequency')->willReturn('weekly');\n $mockReport->method('getTeam')->willReturn($mockTeam);\n $mockReport->method('getStatus')->willReturn(true);\n $mockReport->method('getFrom')->willReturn(null);\n $mockReport->method('getTo')->willReturn(null);\n $mockReport->method('getDealValueMin')->willReturn(null);\n $mockReport->method('getDealValueMax')->willReturn(null);\n $mockReport->method('getCallTypes')->willReturn([]);\n $mockReport->method('getMediaTypes')->willReturn([]);\n $mockReport->method('getCallDurationMin')->willReturn(null);\n $mockReport->method('getCallDurationMax')->willReturn(null);\n $mockReport->method('getGroups')->willReturn([]);\n $mockReport->method('getDealAtCallStages')->willReturn([]);\n $mockReport->method('getCurrentDealStages')->willReturn([]);\n $mockReport->method('getRecipients')->willReturn([]);\n $mockReport->method('getCreator')->willReturn(null);\n $mockReport->method('getAdditionalPromptInput')->willReturn(null);\n $mockReport->method('getCustomName')->willReturn('My Report');\n $mockReport->method('getCreatedAt')->willReturn(IlluminateCarbon::parse('2025-01-01'));\n $mockReport->method('getUpdatedAt')->willReturn(IlluminateCarbon::parse('2025-01-01'));\n $mockReport->method('getDeletedAt')->willReturn(null);\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->expects($this->once())\n ->method('findByUuid')\n ->with('report-uuid')\n ->willReturn($mockReport);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $result = $service->get('report-uuid');\n\n $this->assertIsArray($result);\n $this->assertEquals('report-uuid', $result['id']);\n }\n\n public function testGetThrowsWhenReportNotFound(): void\n {\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->method('findByUuid')->willReturn(null);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(ModelNotFoundException::class);\n\n $service->get('missing-uuid');\n }\n\n public function testListReturnsData(): void\n {\n $mockTeam = $this->createMock(Team::class);\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getType')->willReturn('exec_summary');\n $mockReport->method('getUuid')->willReturn('report-uuid');\n $mockReport->method('getFrequency')->willReturn('weekly');\n $mockReport->method('getTeam')->willReturn($mockTeam);\n $mockReport->method('getStatus')->willReturn(true);\n $mockReport->method('getFrom')->willReturn(null);\n $mockReport->method('getTo')->willReturn(null);\n $mockReport->method('getDealValueMin')->willReturn(null);\n $mockReport->method('getDealValueMax')->willReturn(null);\n $mockReport->method('getCallTypes')->willReturn([]);\n $mockReport->method('getMediaTypes')->willReturn([]);\n $mockReport->method('getCallDurationMin')->willReturn(null);\n $mockReport->method('getCallDurationMax')->willReturn(null);\n $mockReport->method('getGroups')->willReturn([]);\n $mockReport->method('getDealAtCallStages')->willReturn([]);\n $mockReport->method('getCurrentDealStages')->willReturn([]);\n $mockReport->method('getRecipients')->willReturn([]);\n $mockReport->method('getCreator')->willReturn(null);\n $mockReport->method('getAdditionalPromptInput')->willReturn(null);\n $mockReport->method('getCustomName')->willReturn('My Report');\n $mockReport->method('getCreatedAt')->willReturn(IlluminateCarbon::parse('2025-01-01'));\n $mockReport->method('getUpdatedAt')->willReturn(IlluminateCarbon::parse('2025-01-01'));\n $mockReport->method('getDeletedAt')->willReturn(null);\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->expects($this->once())\n ->method('getAllStandardReports')\n ->willReturn(new \\Illuminate\\Database\\Eloquent\\Collection([$mockReport]));\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $result = $service->list();\n\n $this->assertArrayHasKey('data', $result);\n $this->assertCount(1, $result['data']);\n }\n\n public function testListAskJiminnyReportsReturnsData(): void\n {\n $mockUser = $this->createMock(User::class);\n $mockTeam = $this->createMock(Team::class);\n\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getType')->willReturn('ask_jiminny');\n $mockReport->method('getUuid')->willReturn('report-uuid');\n $mockReport->method('getFrequency')->willReturn('daily');\n $mockReport->method('getTeam')->willReturn($mockTeam);\n $mockReport->method('getStatus')->willReturn(true);\n $mockReport->method('getGroups')->willReturn([]);\n $mockReport->method('getRecipients')->willReturn([]);\n $mockReport->method('getCustomName')->willReturn('AJ Report');\n $mockReport->method('getExpiresAt')->willReturn(null);\n $mockReport->method('getSavedSearch')->willReturn(null);\n $mockReport->method('getAskAnythingPrompt')->willReturn(null);\n $mockReport->method('getAttribute')->with('created_by')->willReturn(null);\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->expects($this->once())\n ->method('getAskJiminnyReportsByUser')\n ->with($mockUser, 'created_at', 'desc')\n ->willReturn(new \\Illuminate\\Database\\Eloquent\\Collection([$mockReport]));\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $result = $service->listAskJiminnyReports($mockUser);\n\n $this->assertArrayHasKey('data', $result);\n $this->assertCount(1, $result['data']);\n }\n\n public function testGetActivityTypesFieldDataDelegatesToService(): void\n {\n $mockTeam = $this->createMock(Team::class);\n $mockActivityTypeService = $this->createMock(ActivityTypeService::class);\n $mockActivityTypeService->expects($this->once())\n ->method('getActivityTypeFieldData')\n ->with(team: $mockTeam, value: ['a'], groupIds: ['g1'])\n ->willReturn(['id' => 'activity_types', 'options' => []]);\n\n $reflection = new \\ReflectionClass(AutomatedReportsService::class);\n $service = $reflection->newInstanceWithoutConstructor();\n $prop = $reflection->getProperty('activityTypeService');\n $prop->setAccessible(true);\n $prop->setValue($service, $mockActivityTypeService);\n\n $result = $service->getActivityTypesFieldData($mockTeam, ['a'], ['g1']);\n\n $this->assertEquals(['id' => 'activity_types', 'options' => []], $result);\n }\n\n public function testGetDealStageAtCallFieldDataDelegatesToService(): void\n {\n $mockTeam = $this->createMock(Team::class);\n $mockDealStagesService = $this->createMock(DealStagesService::class);\n $mockDealStagesService->expects($this->once())\n ->method('getDealStageAtCallFieldData')\n ->with(team: $mockTeam, value: [])\n ->willReturn(['id' => 'deal_stage_at_call']);\n\n $reflection = new \\ReflectionClass(AutomatedReportsService::class);\n $service = $reflection->newInstanceWithoutConstructor();\n $prop = $reflection->getProperty('dealStagesService');\n $prop->setAccessible(true);\n $prop->setValue($service, $mockDealStagesService);\n\n $result = $service->getDealStageAtCallFieldData($mockTeam);\n\n $this->assertEquals(['id' => 'deal_stage_at_call'], $result);\n }\n\n public function testGetCurrentDealStageFieldDataDelegatesToService(): void\n {\n $mockTeam = $this->createMock(Team::class);\n $mockDealStagesService = $this->createMock(DealStagesService::class);\n $mockDealStagesService->expects($this->once())\n ->method('getCurrentDealStageFieldData')\n ->with(team: $mockTeam, value: [])\n ->willReturn(['id' => 'current_deal_stage']);\n\n $reflection = new \\ReflectionClass(AutomatedReportsService::class);\n $service = $reflection->newInstanceWithoutConstructor();\n $prop = $reflection->getProperty('dealStagesService');\n $prop->setAccessible(true);\n $prop->setValue($service, $mockDealStagesService);\n\n $result = $service->getCurrentDealStageFieldData($mockTeam);\n\n $this->assertEquals(['id' => 'current_deal_stage'], $result);\n }\n\n public function testGetRecipientsFieldDataDelegatesToService(): void\n {\n $mockTeam = $this->createMock(Team::class);\n $mockRecipientsService = $this->createMock(RecipientsService::class);\n $mockRecipientsService->expects($this->once())\n ->method('getRecipientsFieldData')\n ->with(team: $mockTeam, value: [])\n ->willReturn(['id' => 'recipients']);\n\n $reflection = new \\ReflectionClass(AutomatedReportsService::class);\n $service = $reflection->newInstanceWithoutConstructor();\n $prop = $reflection->getProperty('recipientsService');\n $prop->setAccessible(true);\n $prop->setValue($service, $mockRecipientsService);\n\n $result = $service->getRecipientsFieldData($mockTeam);\n\n $this->assertEquals(['id' => 'recipients'], $result);\n }\n\n public function testGetJiminnyRecipientsFieldDataDelegatesToService(): void\n {\n $mockRecipientsService = $this->createMock(RecipientsService::class);\n $mockRecipientsService->expects($this->once())\n ->method('getJiminnyRecipientsFieldData')\n ->with(['user-1'])\n ->willReturn(['id' => 'jiminny_recipients']);\n\n $reflection = new \\ReflectionClass(AutomatedReportsService::class);\n $service = $reflection->newInstanceWithoutConstructor();\n $prop = $reflection->getProperty('recipientsService');\n $prop->setAccessible(true);\n $prop->setValue($service, $mockRecipientsService);\n\n $result = $service->getJiminnyRecipientsFieldData(['user-1']);\n\n $this->assertEquals(['id' => 'jiminny_recipients'], $result);\n }\n\n public function testCreateReportResultDelegatesToRepository(): void\n {\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getId')->willReturn(42);\n\n $mockResult = $this->createMock(AutomatedReportResult::class);\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->expects($this->once())\n ->method('createResult')\n ->willReturn($mockResult);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $result = $service->createReportResult($mockReport);\n\n $this->assertSame($mockResult, $result);\n }\n\n public function testDeleteReportResultDeletesS3AndModel(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getReport')->willReturn($this->createMock(AutomatedReport::class));\n $mockResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PDF);\n $mockResult->expects($this->once())->method('delete');\n\n $reflection = new \\ReflectionClass(AutomatedReportsService::class);\n $service = $reflection->newInstanceWithoutConstructor();\n\n foreach ([\n 'teamRepository' => TeamRepository::class,\n 'groupRepository' => GroupRepository::class,\n 'userRepository' => UserRepository::class,\n 'stageRepository' => StageRepository::class,\n 'dealStagesService' => DealStagesService::class,\n 'recipientsService' => RecipientsService::class,\n 'automatedReportsRepository' => AutomatedReportsRepository::class,\n 'webhookService' => Webhook::class,\n 'dispatcher' => Dispatcher::class,\n 'activityTypeService' => ActivityTypeService::class,\n 'playbookCategoryRepository' => PlaybookCategoryRepository::class,\n 'askAnythingPromptService' => AskAnythingPromptService::class,\n 'activitySearchRepository' => SearchRepository::class,\n 'askAnythingRepository' => AskAnythingRepository::class,\n ] as $propName => $class) {\n $prop = $reflection->getProperty($propName);\n $prop->setAccessible(true);\n $prop->setValue($service, $this->createMock($class));\n }\n\n Storage::shouldReceive('exists')->andReturn(false);\n Log::shouldReceive('info')->zeroOrMoreTimes();\n\n $service->deleteReportResult($mockResult);\n }\n\n public function testDeleteAllReportResultsIteratesAndDeletes(): void\n {\n $mockResult1 = $this->createMock(AutomatedReportResult::class);\n $mockResult1->method('getId')->willReturn(1);\n $mockResult1->method('getReport')->willReturn($this->createMock(AutomatedReport::class));\n $mockResult1->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PDF);\n $mockResult1->expects($this->once())->method('delete');\n\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getId')->willReturn(10);\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->expects($this->once())\n ->method('getResultsByReport')\n ->with($mockReport)\n ->willReturn(new \\Illuminate\\Database\\Eloquent\\Collection([$mockResult1]));\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n Storage::shouldReceive('exists')->andReturn(false);\n Log::shouldReceive('info')->zeroOrMoreTimes();\n\n $service->deleteAllReportResults($mockReport);\n }\n\n public function testDeleteAllDataDeletesReportsAndResults(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getId')->willReturn(1);\n $mockResult->method('getReport')->willReturn($this->createMock(AutomatedReport::class));\n $mockResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PDF);\n $mockResult->expects($this->once())->method('delete');\n\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getId')->willReturn(10);\n $mockReport->expects($this->once())->method('delete');\n\n $mockTeam = $this->createMock(Team::class);\n $mockTeam->method('getId')->willReturn(1);\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->expects($this->once())\n ->method('getReportsByTeam')\n ->with($mockTeam)\n ->willReturn(new \\Illuminate\\Database\\Eloquent\\Collection([$mockReport]));\n $mockRepo->expects($this->once())\n ->method('getResultsByReport')\n ->with($mockReport)\n ->willReturn(new \\Illuminate\\Database\\Eloquent\\Collection([$mockResult]));\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n Storage::shouldReceive('exists')->andReturn(false);\n Log::shouldReceive('info')->zeroOrMoreTimes();\n\n $service->deleteAllData($mockTeam);\n }\n\n public function testDeleteReportResultsThrowsWhenReportNotFound(): void\n {\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->method('findByUuid')->willReturn(null);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(ModelNotFoundException::class);\n\n $service->deleteReportResults('missing-uuid');\n }\n\n public function testGetValidRecipientUsersAskJiminnyIncludesCreator(): void\n {\n $tz = $this->createMock(\\DateTimeZone::class);\n $tz->method('getName')->willReturn('UTC');\n\n $creator = $this->createMock(User::class);\n $creator->method('getEmailAddress')->willReturn('creator@test.com');\n $creator->method('getName')->willReturn('Creator');\n $creator->method('getTimezone')->willReturn($tz);\n\n $mockUserRepository = $this->createMock(UserRepository::class);\n $mockUserRepository->method('find')->willReturn($creator);\n\n $mockGroupRepository = $this->createMock(GroupRepository::class);\n $mockGroupRepository->method('find')->willReturn(null);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $mockGroupRepository,\n $mockUserRepository,\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('isAskJiminnyReport')->willReturn(true);\n $report->method('getCreator')->willReturn($creator);\n $report->method('getRecipients')->willReturn(['users' => []]);\n $report->method('getGroups')->willReturn([]);\n\n $result = $service->getValidRecipientUsers($report);\n\n $this->assertCount(1, $result);\n $this->assertEquals('creator@test.com', $result[0]['email']);\n }\n\n public function testGetValidRecipientUsersAskJiminnyDeduplicatesCreatorAndExplicitRecipient(): void\n {\n $tz = $this->createMock(\\DateTimeZone::class);\n $tz->method('getName')->willReturn('UTC');\n\n $creator = $this->createMock(User::class);\n $creator->method('getEmailAddress')->willReturn('shared@test.com');\n $creator->method('getName')->willReturn('Creator');\n $creator->method('getTimezone')->willReturn($tz);\n\n $mockUserRepository = $this->createMock(UserRepository::class);\n $mockUserRepository->method('find')->willReturn($creator);\n\n $mockGroupRepository = $this->createMock(GroupRepository::class);\n $mockGroupRepository->method('find')->willReturn(null);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $mockGroupRepository,\n $mockUserRepository,\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('isAskJiminnyReport')->willReturn(true);\n $report->method('getCreator')->willReturn($creator);\n $report->method('getRecipients')->willReturn(['users' => [1]]);\n $report->method('getGroups')->willReturn([]);\n\n $result = $service->getValidRecipientUsers($report);\n\n $this->assertCount(1, $result);\n $this->assertEquals('shared@test.com', $result[0]['email']);\n }\n\n public function testGetValidRecipientUsersAskJiminnyIncludesGroupMembers(): void\n {\n $tz = $this->createMock(\\DateTimeZone::class);\n $tz->method('getName')->willReturn('UTC');\n\n $creator = $this->createMock(User::class);\n $creator->method('getEmailAddress')->willReturn('creator@test.com');\n $creator->method('getName')->willReturn('Creator');\n $creator->method('getTimezone')->willReturn($tz);\n\n $member = $this->createMock(User::class);\n $member->method('getEmailAddress')->willReturn('member@test.com');\n $member->method('getName')->willReturn('Member');\n $member->method('getTimezone')->willReturn($tz);\n\n $mockUserRepository = $this->createMock(UserRepository::class);\n $mockUserRepository->method('find')->willReturn($creator);\n\n $mockGroup = $this->createMock(Group::class);\n $mockGroup->method('getMembers')->willReturn(new \\Illuminate\\Database\\Eloquent\\Collection([$member]));\n\n $mockGroupRepository = $this->createMock(GroupRepository::class);\n $mockGroupRepository->method('find')->willReturn($mockGroup);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $mockGroupRepository,\n $mockUserRepository,\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('isAskJiminnyReport')->willReturn(true);\n $report->method('getCreator')->willReturn($creator);\n $report->method('getRecipients')->willReturn(['users' => []]);\n $report->method('getGroups')->willReturn([10]);\n\n $result = $service->getValidRecipientUsers($report);\n\n $this->assertCount(2, $result);\n $emails = array_column($result, 'email');\n $this->assertContains('creator@test.com', $emails);\n $this->assertContains('member@test.com', $emails);\n }\n\n public function testGetValidRecipientUsersAskJiminnyNullCreatorSkipped(): void\n {\n $tz = $this->createMock(\\DateTimeZone::class);\n $tz->method('getName')->willReturn('UTC');\n\n $shareUser = $this->createMock(User::class);\n $shareUser->method('getEmailAddress')->willReturn('shared@test.com');\n $shareUser->method('getName')->willReturn('Shared');\n $shareUser->method('getTimezone')->willReturn($tz);\n\n $mockUserRepository = $this->createMock(UserRepository::class);\n $mockUserRepository->method('find')->willReturnMap([\n [1, null],\n [2, $shareUser],\n ]);\n\n $mockGroupRepository = $this->createMock(GroupRepository::class);\n $mockGroupRepository->method('find')->willReturn(null);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $mockGroupRepository,\n $mockUserRepository,\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('isAskJiminnyReport')->willReturn(true);\n $report->method('getCreator')->willReturn(null);\n $report->method('getRecipients')->willReturn(['users' => [2]]);\n $report->method('getGroups')->willReturn([]);\n\n $result = $service->getValidRecipientUsers($report);\n\n $this->assertCount(1, $result);\n $this->assertEquals('shared@test.com', $result[0]['email']);\n }\n\n public function testGetValidRecipientUsersStandardReportDoesNotIncludeCreator(): void\n {\n $tz = $this->createMock(\\DateTimeZone::class);\n $tz->method('getName')->willReturn('UTC');\n\n $user = $this->createMock(User::class);\n $user->method('getEmailAddress')->willReturn('user@test.com');\n $user->method('getName')->willReturn('User');\n $user->method('getTimezone')->willReturn($tz);\n\n $mockUserRepository = $this->createMock(UserRepository::class);\n $mockUserRepository->method('find')->willReturn($user);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $mockUserRepository,\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('isAskJiminnyReport')->willReturn(false);\n $report->method('getRecipients')->willReturn(['users' => [5]]);\n $report->method('getJiminnyRecipients')->willReturn(['users' => []]);\n $report->method('getGroups')->willReturn([]);\n\n $result = $service->getValidRecipientUsers($report);\n\n $this->assertCount(1, $result);\n $this->assertEquals('user@test.com', $result[0]['email']);\n }\n\n public function testGetReportPeriodNameAskJiminnyMonthlyFallback(): void\n {\n Carbon::setTestNow(Carbon::parse('2026-03-07 00:00:00'));\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getFrequency')->willReturn('monthly');\n $report->method('isAskJiminnyReport')->willReturn(true);\n\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getReport')->willReturn($report);\n $mockResult->method('getFromDate')->willReturn(null);\n $mockResult->method('getToDate')->willReturn(null);\n\n $result = $this->service->getReportPeriodName($mockResult);\n\n $this->assertMatchesRegularExpression('/^[A-Z][a-z]+ \\d{4}$/', $result);\n $this->assertStringContainsString('2026', $result);\n\n Carbon::setTestNow();\n }\n\n public function testGetReportPeriodNameAskJiminnyWeeklyFallback(): void\n {\n Carbon::setTestNow(Carbon::parse('2026-04-07 00:00:00'));\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getFrequency')->willReturn('weekly');\n $report->method('isAskJiminnyReport')->willReturn(true);\n\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getReport')->willReturn($report);\n $mockResult->method('getFromDate')->willReturn(null);\n $mockResult->method('getToDate')->willReturn(null);\n\n $result = $this->service->getReportPeriodName($mockResult);\n\n $this->assertStringContainsString(' - ', $result);\n $this->assertStringContainsString('2026', $result);\n\n Carbon::setTestNow();\n }\n\n public function testGetReportPeriodNameAskJiminnyDailyFallback(): void\n {\n Carbon::setTestNow(Carbon::parse('2026-04-07 00:00:00'));\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getFrequency')->willReturn('daily');\n $report->method('isAskJiminnyReport')->willReturn(true);\n\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getReport')->willReturn($report);\n $mockResult->method('getFromDate')->willReturn(null);\n $mockResult->method('getToDate')->willReturn(null);\n\n $result = $this->service->getReportPeriodName($mockResult);\n\n $this->assertStringNotContainsString(' - ', $result);\n $this->assertStringContainsString('2026', $result);\n\n Carbon::setTestNow();\n }\n\n public function testGetReportPeriodNameAskJiminnyWithExplicitDates(): void\n {\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getFrequency')->willReturn('monthly');\n $report->method('isAskJiminnyReport')->willReturn(true);\n\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getReport')->willReturn($report);\n $mockResult->method('getFromDate')->willReturn(IlluminateCarbon::parse('2026-02-07'));\n $mockResult->method('getToDate')->willReturn(IlluminateCarbon::parse('2026-03-07'));\n\n $result = $this->service->getReportPeriodName($mockResult);\n\n $this->assertEquals('Feb 2026', $result);\n }\n}","depth":4,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Tests\\Unit\\Services\\Kiosk\\AutomatedReports;\n\nuse Carbon\\Carbon;\nuse Illuminate\\Support\\Carbon as IlluminateCarbon;\nuse Illuminate\\Contracts\\Bus\\Dispatcher;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Database\\Eloquent\\Relations\\HasMany;\nuse Illuminate\\Support\\Facades\\Log;\nuse Illuminate\\Support\\Facades\\Storage;\nuse Jiminny\\Component\\AskAnything\\AskAnythingPromptService;\nuse Jiminny\\Component\\AskAnything\\Dtos\\AskAnythingPromptDto;\nuse Jiminny\\Component\\UrlGenerator\\Webhook;\nuse Jiminny\\Contracts\\Repositories\\PlaybookCategoryRepository;\nuse Jiminny\\Contracts\\Repositories\\TeamRepository;\nuse Jiminny\\Contracts\\Repositories\\UserRepository;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Exceptions\\ModelNotFoundException;\nuse Illuminate\\Support\\Collection;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPrompt;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPromptTarget;\nuse Jiminny\\Models\\Activity\\Search;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Group;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Repositories\\AskAnythingRepository;\nuse Jiminny\\Repositories\\AutomatedReportsRepository;\nuse Jiminny\\Repositories\\GroupRepository;\nuse Jiminny\\Repositories\\SearchRepository;\nuse Jiminny\\Repositories\\StageRepository;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\ActivityTypeService;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\AutomatedReportsService;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\DealStagesService;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\RecipientsService;\nuse Mockery;\nuse PHPUnit\\Framework\\Attributes\\DataProvider;\nuse Tests\\TestCase;\n\nclass AutomatedReportsServiceTest extends TestCase\n{\n private AutomatedReportsService $service;\n\n protected function setUp(): void\n {\n parent::setUp();\n\n // Create a real instance of the service without calling the constructor\n $reflection = new \\ReflectionClass(AutomatedReportsService::class);\n $this->service = $reflection->newInstanceWithoutConstructor();\n\n // Manually set the dependencies using reflection\n $dependencies = [\n 'teamRepository' => TeamRepository::class,\n 'groupRepository' => GroupRepository::class,\n 'userRepository' => UserRepository::class,\n 'stageRepository' => StageRepository::class,\n 'dealStagesService' => DealStagesService::class,\n 'recipientsService' => RecipientsService::class,\n 'automatedReportsRepository' => AutomatedReportsRepository::class,\n 'webhookService' => Webhook::class,\n 'dispatcher' => Dispatcher::class,\n 'activityTypeService' => ActivityTypeService::class,\n 'playbookCategoryRepository' => PlaybookCategoryRepository::class,\n 'askAnythingPromptService' => AskAnythingPromptService::class,\n 'activitySearchRepository' => SearchRepository::class,\n 'askAnythingRepository' => AskAnythingRepository::class,\n ];\n\n foreach ($dependencies as $propertyName => $class) {\n $property = $reflection->getProperty($propertyName);\n $property->setAccessible(true);\n $property->setValue($this->service, $this->createMock($class));\n }\n }\n\n protected function tearDown(): void\n {\n parent::tearDown();\n Mockery::close();\n }\n\n private function getService(\n $mockUserRepository = null,\n $mockStageRepository = null,\n $mockTeamRepository = null,\n ): AutomatedReportsService {\n return new AutomatedReportsService(\n ($mockTeamRepository ?? $this->createMock(TeamRepository::class)),\n $this->createMock(GroupRepository::class),\n ($mockUserRepository ?? $this->createMock(UserRepository::class)),\n ($mockStageRepository ?? $this->createMock(StageRepository::class)),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n }\n\n #[DataProvider('transformMediaTypesDataProvider')]\n public function testTransformMediaTypes(array $mediaTypes, array $expected): void\n {\n $report = new AutomatedReport(['media_types' => $mediaTypes]);\n\n $reflection = new \\ReflectionClass(AutomatedReportsService::class);\n $method = $reflection->getMethod('transformMediaTypes');\n\n $result = $method->invoke($this->service, $report);\n\n $this->assertEquals($expected, $result);\n }\n\n public function testGetMediaTypeFieldDataWithoutReport(): void\n {\n $result = $this->service->getMediaTypeFieldData(null);\n\n $this->assertIsArray($result);\n $this->assertArrayHasKey('value', $result);\n $this->assertEmpty($result['value']);\n $this->assertEquals('media_types', $result['id']);\n }\n\n public function testGetMediaTypeFieldDataWithReport(): void\n {\n $mediaTypes = ['pdf', 'podcast'];\n $report = new AutomatedReport(['media_types' => $mediaTypes]);\n\n $result = $this->service->getMediaTypeFieldData($report);\n\n $expectedValue = [\n ['id' => 'pdf', 'name' => 'PDF'],\n ['id' => 'podcast', 'name' => 'Podcast'],\n ];\n\n $this->assertIsArray($result);\n $this->assertArrayHasKey('value', $result);\n $this->assertEquals($expectedValue, $result['value']);\n }\n\n public static function transformMediaTypesDataProvider(): array\n {\n return [\n 'empty array' => [\n 'mediaTypes' => [],\n 'expected' => [],\n ],\n 'pdf only' => [\n 'mediaTypes' => ['pdf'],\n 'expected' => [\n ['id' => 'pdf', 'name' => 'PDF'],\n ],\n ],\n 'podcast only' => [\n 'mediaTypes' => ['podcast'],\n 'expected' => [\n ['id' => 'podcast', 'name' => 'Podcast'],\n ],\n ],\n 'both pdf and podcast' => [\n 'mediaTypes' => ['pdf', 'podcast'],\n 'expected' => [\n ['id' => 'pdf', 'name' => 'PDF'],\n ['id' => 'podcast', 'name' => 'Podcast'],\n ],\n ],\n 'with invalid type' => [\n 'mediaTypes' => ['pdf', 'invalid', 'podcast'],\n 'expected' => [\n ['id' => 'pdf', 'name' => 'PDF'],\n ['id' => 'podcast', 'name' => 'Podcast'],\n ],\n ],\n ];\n }\n\n #[DataProvider('hasCallTypeConferenceDataProvider')]\n public function testHasCallTypeConference(array $callTypes, bool $expected): void\n {\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getCallTypes')->willReturn($callTypes);\n\n $result = $this->service->hasCallTypeConference($report);\n\n $this->assertEquals($expected, $result);\n }\n\n #[DataProvider('hasCallTypeDialerDataProvider')]\n public function testHasCallTypeDialer(array $callTypes, bool $expected): void\n {\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getCallTypes')->willReturn($callTypes);\n\n $result = $this->service->hasCallTypeDialer($report);\n\n $this->assertEquals($expected, $result);\n }\n\n public static function hasCallTypeConferenceDataProvider(): array\n {\n return [\n 'has conference' => [\n 'callTypes' => ['conference', 'dialer'],\n 'expected' => true,\n ],\n 'does not have conference' => [\n 'callTypes' => ['dialer', 'other'],\n 'expected' => false,\n ],\n 'empty call types' => [\n 'callTypes' => [],\n 'expected' => false,\n ],\n ];\n }\n\n public static function hasCallTypeDialerDataProvider(): array\n {\n return [\n 'has dialer' => [\n 'callTypes' => ['conference', 'dialer'],\n 'expected' => true,\n ],\n 'does not have dialer' => [\n 'callTypes' => ['conference', 'other'],\n 'expected' => false,\n ],\n 'empty call types' => [\n 'callTypes' => [],\n 'expected' => false,\n ],\n ];\n }\n\n public function testTransformReportResultsWithEmptyCollection(): void\n {\n $emptyCollection = new Collection([]);\n\n $result = $this->service->transformReportResults($emptyCollection);\n\n $this->assertIsArray($result);\n $this->assertEmpty($result);\n }\n\n public function testTransformReportResultsStructure(): void\n {\n // Create a mock AutomatedReportResult with minimal setup to test structure\n $mockReportResult = $this->createMockReportResult();\n $collection = new Collection([$mockReportResult]);\n\n $result = $this->service->transformReportResults($collection);\n\n $this->assertIsArray($result);\n $this->assertCount(1, $result);\n\n $transformedResult = $result[0];\n\n // Verify all expected keys are present\n $expectedKeys = [\n 'id', 'name', 'frequency', 'recipients',\n 'report_type', 'media_type', 'downloadUrl', 'viewUrl', 'generated_at',\n ];\n\n foreach ($expectedKeys as $key) {\n $this->assertArrayHasKey($key, $transformedResult);\n }\n\n // Verify structure of nested arrays\n $this->assertIsArray($transformedResult['frequency']);\n $this->assertArrayHasKey('id', $transformedResult['frequency']);\n $this->assertArrayHasKey('name', $transformedResult['frequency']);\n\n $this->assertIsArray($transformedResult['report_type']);\n $this->assertArrayHasKey('id', $transformedResult['report_type']);\n $this->assertArrayHasKey('name', $transformedResult['report_type']);\n\n $this->assertIsArray($transformedResult['recipients']);\n\n // Verify TODO fields are null as expected\n $this->assertEquals(AutomatedReportsService::MEDIA_TYPE_PODCAST, $transformedResult['media_type']);\n $this->assertEquals(route('ai-reports.audio.download', ['uuid' => 'test-uuid']), $transformedResult['downloadUrl']);\n $this->assertEquals(route('ai-reports.audio.view', ['uuid' => 'test-uuid']), $transformedResult['viewUrl']);\n }\n\n public function testTransformReportResultsWithMultipleResults(): void\n {\n $mockReportResult1 = $this->createMockReportResult('result-uuid-1', 'exec_summary');\n $mockReportResult2 = $this->createMockReportResult('result-uuid-2', 'coaching_profiles');\n $collection = new Collection([$mockReportResult1, $mockReportResult2]);\n\n $result = $this->service->transformReportResults($collection);\n\n $this->assertIsArray($result);\n $this->assertCount(2, $result);\n\n // Verify different UUIDs\n $this->assertEquals('result-uuid-1', $result[0]['id']);\n $this->assertEquals('result-uuid-2', $result[1]['id']);\n\n // Verify both results have the expected structure\n foreach ($result as $transformedResult) {\n $this->assertArrayHasKey('id', $transformedResult);\n $this->assertArrayHasKey('name', $transformedResult);\n $this->assertArrayHasKey('frequency', $transformedResult);\n $this->assertArrayHasKey('recipients', $transformedResult);\n $this->assertArrayHasKey('report_type', $transformedResult);\n }\n }\n\n #[DataProvider('isUserRecipientOfReportDataProvider')]\n public function testIsUserRecipientOfReport(int $userId, array $recipients, bool $expected): void\n {\n // Create mock User\n $mockUser = $this->createMock(\\Jiminny\\Models\\User::class);\n $mockUser->method('getId')->willReturn($userId);\n\n // Create mock AutomatedReport\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getRecipients')->willReturn($recipients);\n\n $result = $this->service->isUserRecipientOfReport($mockUser, $mockReport);\n\n $this->assertEquals($expected, $result);\n }\n\n public function testIsUserRecipientOfReportWithEmptyRecipients(): void\n {\n // Create mock User\n $mockUser = $this->createMock(\\Jiminny\\Models\\User::class);\n $mockUser->method('getId')->willReturn(123);\n\n // Create mock AutomatedReport with no recipients\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getRecipients')->willReturn([]);\n\n $result = $this->service->isUserRecipientOfReport($mockUser, $mockReport);\n\n $this->assertFalse($result);\n }\n\n public function testIsUserRecipientOfReportWithNoUsersKey(): void\n {\n // Create mock User\n $mockUser = $this->createMock(\\Jiminny\\Models\\User::class);\n $mockUser->method('getId')->willReturn(123);\n\n // Create mock AutomatedReport with recipients but no 'users' key\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getRecipients')->willReturn(['other_key' => [456, 789]]);\n\n $result = $this->service->isUserRecipientOfReport($mockUser, $mockReport);\n\n $this->assertFalse($result);\n }\n\n public static function isUserRecipientOfReportDataProvider(): array\n {\n return [\n 'user is recipient - single user' => [\n 'userId' => 123,\n 'recipients' => ['users' => [123]],\n 'expected' => true,\n ],\n 'user is recipient - multiple users' => [\n 'userId' => 456,\n 'recipients' => ['users' => [123, 456, 789]],\n 'expected' => true,\n ],\n 'user is not recipient - single user' => [\n 'userId' => 999,\n 'recipients' => ['users' => [123]],\n 'expected' => false,\n ],\n 'user is not recipient - multiple users' => [\n 'userId' => 999,\n 'recipients' => ['users' => [123, 456, 789]],\n 'expected' => false,\n ],\n 'user is recipient - string IDs converted to int' => [\n 'userId' => 123,\n 'recipients' => ['users' => ['123', '456']],\n 'expected' => true,\n ],\n 'user is not recipient - string IDs converted to int' => [\n 'userId' => 999,\n 'recipients' => ['users' => ['123', '456']],\n 'expected' => false,\n ],\n 'empty users array' => [\n 'userId' => 123,\n 'recipients' => ['users' => []],\n 'expected' => false,\n ],\n ];\n }\n\n private function createMockReportResult(string $uuid = 'test-uuid', string $reportType = 'exec_summary'): AutomatedReportResult\n {\n // Create mock AutomatedReport\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getFrequency')->willReturn('weekly');\n $mockReport->method('getRecipients')->willReturn(['users' => [1, 2]]);\n $mockReport->method('getGroups')->willReturn([10, 20]);\n $mockReport->method('getType')->willReturn($reportType);\n\n // Create mock Team\n $mockTeam = $this->createMock(\\Jiminny\\Models\\Team::class);\n\n // Create mock Group\n $mockGroup = $this->createMock(\\Jiminny\\Models\\Group::class);\n $mockGroup->method('getUuid')->willReturn('group-uuid-10');\n $mockGroup->method('getName')->willReturn('Test Team');\n\n $mockQueryBuilder = Mockery::mock();\n $mockQueryBuilder->shouldReceive('where')->andReturnSelf();\n $mockQueryBuilder->shouldReceive('first')->andReturn($mockGroup);\n\n $dataRelation = Mockery::mock(HasMany::class);\n $dataRelation->shouldReceive('where')->andReturn($mockQueryBuilder);\n $dataRelation->shouldReceive('get')->andReturn(\n new \\Illuminate\\Database\\Eloquent\\Collection([$mockGroup])\n );\n\n $mockTeam->method('groups')->willReturn($dataRelation);\n $mockReport->method('getTeam')->willReturn($mockTeam);\n\n // Create mock AutomatedReportResult\n $mockReportResult = $this->createMock(AutomatedReportResult::class);\n $mockReportResult->method('getUuid')->willReturn($uuid);\n $mockReportResult->method('getGeneratedAt')->willReturn(\n \\Illuminate\\Support\\Carbon::parse('2024-01-15T10:30:00Z')\n );\n\n $mockReportResult->method('getReport')->willReturn($mockReport);\n\n // Mock methods used in getReportFileName\n $mockReportResult->method('getReportType')->willReturn($reportType);\n $mockReportResult->method('getFromDate')->willReturn(\n \\Illuminate\\Support\\Carbon::parse('2024-01-08')\n );\n $mockReportResult->method('getToDate')->willReturn(\n \\Illuminate\\Support\\Carbon::parse('2024-01-15')\n );\n $mockReportResult->method('getGroups')->willReturn([10]);\n $mockReportResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PODCAST);\n\n return $mockReportResult;\n }\n\n #[DataProvider('getUsersUuidsDataProvider')]\n public function testGetUsersUuids(array $recipients, array $mockUsers, array $expectedUuids): void\n {\n // Create mock UserRepository\n $mockUserRepository = $this->createMock(UserRepository::class);\n\n // Configure the mock to return specific users for specific IDs using a callback\n $mockUserRepository->method('find')\n ->willReturnCallback(function ($userId) use ($mockUsers) {\n if (! isset($mockUsers[$userId])) {\n return null;\n }\n\n $userUuid = $mockUsers[$userId]['uuid'] ?? null;\n\n if ($userUuid === null) {\n return null;\n }\n\n $mockUser = $this->createMock(\\Jiminny\\Models\\User::class);\n $mockUser->method('getUuid')->willReturn((string) $userUuid);\n\n return $mockUser;\n });\n\n // Create service with mocked UserRepository\n $automatedReportsService = $this->getService(mockUserRepository: $mockUserRepository);\n\n // Create mock AutomatedReport\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getRecipients')->willReturn($recipients);\n\n $result = $automatedReportsService->getUsersUuids($mockReport);\n\n $this->assertEquals($expectedUuids, $result);\n }\n\n public function testGetUsersUuidsWithEmptyRecipients(): void\n {\n // Create mock AutomatedReport with empty recipients\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getRecipients')->willReturn([]);\n\n $result = $this->service->getUsersUuids($mockReport);\n\n $this->assertEquals([], $result);\n }\n\n public function testGetUsersUuidsWithNoUsersKey(): void\n {\n // Create mock AutomatedReport with recipients but no 'users' key\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getRecipients')->willReturn(['other_key' => [1, 2, 3]]);\n\n $result = $this->service->getUsersUuids($mockReport);\n\n $this->assertEquals([], $result);\n }\n\n public function testGetUsersUuidsWithNonExistentUsers(): void\n {\n // Create mock UserRepository that returns null for all users\n $mockUserRepository = $this->createMock(UserRepository::class);\n $mockUserRepository->method('find')->willReturn(null);\n\n // Create service with mocked UserRepository\n $automatedReportsService = $this->getService(mockUserRepository: $mockUserRepository);\n\n // Create mock AutomatedReport\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getRecipients')->willReturn(['users' => [1, 2, 3]]);\n\n $result = $automatedReportsService->getUsersUuids($mockReport);\n\n // Should return array with null values for non-existent users\n $this->assertEquals([], $result);\n }\n\n public static function getUsersUuidsDataProvider(): array\n {\n return [\n 'single user found' => [\n 'recipients' => ['users' => [123]],\n 'mockUsers' => [\n 123 => ['id' => 123, 'uuid' => 'user-uuid-123'],\n ],\n 'expectedUuids' => ['user-uuid-123'],\n ],\n 'multiple users found' => [\n 'recipients' => ['users' => [123, 456, 789]],\n 'mockUsers' => [\n 123 => ['id' => 123, 'uuid' => 'user-uuid-123'],\n 456 => ['id' => 456, 'uuid' => 'user-uuid-456'],\n 789 => ['id' => 789, 'uuid' => 'user-uuid-789'],\n ],\n 'expectedUuids' => ['user-uuid-123', 'user-uuid-456', 'user-uuid-789'],\n ],\n 'mixed found and not found users' => [\n 'recipients' => ['users' => [123, 456, 789]],\n 'mockUsers' => [\n 123 => ['id' => 123, 'uuid' => 'user-uuid-123'],\n // 456 not found in DB\n 789 => ['id' => 789, 'uuid' => 'user-uuid-789'],\n ],\n 'expectedUuids' => ['user-uuid-123', 'user-uuid-789'], // Updated to reflect that nulls are filtered out\n ],\n 'empty users array' => [\n 'recipients' => ['users' => []],\n 'mockUsers' => [],\n 'expectedUuids' => [],\n ],\n 'all users not found' => [\n 'recipients' => ['users' => [123, 456]],\n 'mockUsers' => [], // No users found\n 'expectedUuids' => [], // Updated to reflect that nulls are filtered out\n ],\n ];\n }\n\n #[DataProvider('getCurrentDealStagesUuidsDataProvider')]\n public function testGetCurrentDealStagesUuids(array $currentDealStages, array $mockStages, array $expectedUuids): void\n {\n // Create mock StageRepository\n $mockStageRepository = $this->createMock(StageRepository::class);\n\n // Configure the mock to return specific stages for specific IDs using a callback\n $mockStageRepository->method('find')\n ->willReturnCallback(function ($stageId) use ($mockStages) {\n if (! isset($mockStages[$stageId])) {\n return null;\n }\n\n $stageUuid = $mockStages[$stageId]['uuid'] ?? null;\n\n if ($stageUuid === null) {\n return null;\n }\n\n $mockStage = $this->createMock(\\Jiminny\\Models\\Stage::class);\n $mockStage->method('getUuid')->willReturn((string) $stageUuid);\n\n return $mockStage;\n });\n\n // Create service with mocked StageRepository\n $automatedReportsService = $this->getService(mockStageRepository: $mockStageRepository);\n\n // Create mock AutomatedReport\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getCurrentDealStages')->willReturn($currentDealStages);\n\n $result = $automatedReportsService->getCurrentDealStagesUuids($mockReport);\n\n $this->assertEquals($expectedUuids, $result);\n }\n\n public function testGetCurrentDealStagesUuidsWithEmptyStages(): void\n {\n // Create mock AutomatedReport with empty current deal stages\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getCurrentDealStages')->willReturn([]);\n\n $result = $this->service->getCurrentDealStagesUuids($mockReport);\n\n $this->assertEquals([], $result);\n }\n\n public function testGetCurrentDealStagesUuidsWithNonExistentStages(): void\n {\n // Create mock StageRepository that returns null for all stages\n $mockStageRepository = $this->createMock(StageRepository::class);\n $mockStageRepository->method('find')->willReturn(null);\n\n // Create service with mocked StageRepository\n $automatedReportsService = $this->getService(mockStageRepository: $mockStageRepository);\n\n // Create mock AutomatedReport\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getCurrentDealStages')->willReturn([1, 2, 3]);\n\n $result = $automatedReportsService->getCurrentDealStagesUuids($mockReport);\n\n // Should return array with null values for non-existent stages\n $this->assertEquals([], $result);\n }\n\n public static function getCurrentDealStagesUuidsDataProvider(): array\n {\n return [\n 'single stage found' => [\n 'currentDealStages' => [10],\n 'mockStages' => [\n 10 => ['id' => 10, 'uuid' => 'stage-uuid-10'],\n ],\n 'expectedUuids' => ['stage-uuid-10'],\n ],\n 'multiple stages found' => [\n 'currentDealStages' => [10, 20, 30],\n 'mockStages' => [\n 10 => ['id' => 10, 'uuid' => 'stage-uuid-10'],\n 20 => ['id' => 20, 'uuid' => 'stage-uuid-20'],\n 30 => ['id' => 30, 'uuid' => 'stage-uuid-30'],\n ],\n 'expectedUuids' => ['stage-uuid-10', 'stage-uuid-20', 'stage-uuid-30'],\n ],\n 'mixed found and not found stages' => [\n 'currentDealStages' => [10, 20, 30],\n 'mockStages' => [\n 10 => ['id' => 10, 'uuid' => 'stage-uuid-10'],\n // 20 not found in DB\n 30 => ['id' => 30, 'uuid' => 'stage-uuid-30'],\n ],\n 'expectedUuids' => ['stage-uuid-10', 'stage-uuid-30'], // Updated to reflect that nulls are filtered out\n ],\n 'empty stages array' => [\n 'currentDealStages' => [],\n 'mockStages' => [],\n 'expectedUuids' => [],\n ],\n 'all stages not found' => [\n 'currentDealStages' => [10, 20],\n 'mockStages' => [], // No stages found\n 'expectedUuids' => [], // Updated to reflect that nulls are filtered out\n ],\n ];\n }\n\n #[DataProvider('getTeamGroupsDataProvider')]\n public function testGetTeamGroups(string $teamUuid, ?array $mockTeamData, array $mockGroups, array $expectedResult): void\n {\n // Create mock TeamRepository\n $mockTeamRepository = $this->createMock(TeamRepository::class);\n\n if ($mockTeamData === null) {\n // Team not found\n $mockTeamRepository->method('idOrUuid')\n ->with($teamUuid)\n ->willReturn(null);\n } else {\n // Team found - create mock team with groups\n $mockTeam = $this->createMock(\\Jiminny\\Models\\Team::class);\n\n // Create mock groups collection\n $mockGroupsCollection = $this->createMock(\\Illuminate\\Database\\Eloquent\\Collection::class);\n\n // Create mock Group objects\n $groupObjects = [];\n foreach ($mockGroups as $groupData) {\n $mockGroup = $this->createMock(\\Jiminny\\Models\\Group::class);\n $mockGroup->method('getUuid')->willReturn($groupData['id']);\n $mockGroup->method('getName')->willReturn($groupData['name']);\n $groupObjects[] = $mockGroup;\n }\n\n // Mock the groups collection to return our mock groups\n $mockGroupsCollection->method('getIterator')->willReturn(new \\ArrayIterator($groupObjects));\n\n // Mock the groups() relation\n $mockGroupsRelation = $this->createMock(\\Illuminate\\Database\\Eloquent\\Relations\\HasMany::class);\n $mockGroupsRelation->method('get')->willReturn($mockGroupsCollection);\n $mockTeam->method('groups')->willReturn($mockGroupsRelation);\n\n $mockTeamRepository->method('idOrUuid')\n ->with($teamUuid)\n ->willReturn($mockTeam);\n }\n\n // Create service with mocked TeamRepository\n $automatedReportsService = $this->getService(mockTeamRepository: $mockTeamRepository);\n\n $result = $automatedReportsService->getTeamGroups($teamUuid);\n\n $this->assertEquals($expectedResult, $result);\n }\n\n public function testGetTeamGroupsWithNonExistentTeam(): void\n {\n // Create mock TeamRepository that returns null (team not found)\n $mockTeamRepository = $this->createMock(TeamRepository::class);\n $mockTeamRepository->method('idOrUuid')->willReturn(null);\n\n // Create service with mocked TeamRepository\n $automatedReportsService = $this->getService(mockTeamRepository: $mockTeamRepository);\n\n $result = $automatedReportsService->getTeamGroups('non-existent-team-uuid');\n\n $this->assertEquals([], $result);\n }\n\n public function testGetTeamGroupsWithEmptyGroups(): void\n {\n // Create mock team with no groups\n $mockTeam = $this->createMock(\\Jiminny\\Models\\Team::class);\n\n // Create empty groups collection\n $mockGroupsCollection = $this->createMock(\\Illuminate\\Database\\Eloquent\\Collection::class);\n $mockGroupsCollection->method('getIterator')->willReturn(new \\ArrayIterator([]));\n\n $mockGroupsRelation = $this->createMock(\\Illuminate\\Database\\Eloquent\\Relations\\HasMany::class);\n $mockGroupsRelation->method('get')->willReturn($mockGroupsCollection);\n $mockTeam->method('groups')->willReturn($mockGroupsRelation);\n\n // Create mock TeamRepository\n $mockTeamRepository = $this->createMock(TeamRepository::class);\n $mockTeamRepository->method('idOrUuid')->willReturn($mockTeam);\n\n // Create service with mocked TeamRepository\n $automatedReportsService = $this->getService(mockTeamRepository: $mockTeamRepository);\n\n $result = $automatedReportsService->getTeamGroups('team-with-no-groups');\n\n $this->assertEquals([], $result);\n }\n\n public static function getTeamGroupsDataProvider(): array\n {\n return [\n 'team with single group' => [\n 'teamUuid' => 'team-uuid-123',\n 'mockTeamData' => ['id' => 'team-uuid-123', 'name' => 'Test Team'],\n 'mockGroups' => [\n ['id' => 'group-uuid-1', 'name' => 'Sales Team'],\n ],\n 'expectedResult' => [\n ['id' => 'group-uuid-1', 'name' => 'Sales Team'],\n ],\n ],\n 'team with multiple groups' => [\n 'teamUuid' => 'team-uuid-456',\n 'mockTeamData' => ['id' => 'team-uuid-456', 'name' => 'Another Team'],\n 'mockGroups' => [\n ['id' => 'group-uuid-1', 'name' => 'Sales Team'],\n ['id' => 'group-uuid-2', 'name' => 'Marketing Team'],\n ['id' => 'group-uuid-3', 'name' => 'Support Team'],\n ],\n 'expectedResult' => [\n ['id' => 'group-uuid-1', 'name' => 'Sales Team'],\n ['id' => 'group-uuid-2', 'name' => 'Marketing Team'],\n ['id' => 'group-uuid-3', 'name' => 'Support Team'],\n ],\n ],\n 'team not found' => [\n 'teamUuid' => 'non-existent-uuid',\n 'mockTeamData' => null,\n 'mockGroups' => [],\n 'expectedResult' => [],\n ],\n 'team with no groups' => [\n 'teamUuid' => 'team-uuid-empty',\n 'mockTeamData' => ['id' => 'team-uuid-empty', 'name' => 'Empty Team'],\n 'mockGroups' => [],\n 'expectedResult' => [],\n ],\n ];\n }\n\n #[DataProvider('getTeamsDataProvider')]\n public function testGetTeams(array $mockTeams, array $expectedResult): void\n {\n // Create mock TeamRepository\n $mockTeamRepository = $this->createMock(TeamRepository::class);\n\n // Create mock Team objects\n $teamObjects = [];\n foreach ($mockTeams as $teamData) {\n $mockTeam = $this->createMock(\\Jiminny\\Models\\Team::class);\n $mockTeam->method('getUuid')->willReturn($teamData['id']);\n $mockTeam->method('getName')->willReturn($teamData['name']);\n $mockTeam->method('hasFeature')\n ->with(\\Jiminny\\Models\\Feature\\FeatureEnum::AUTOMATED_REPORTS)\n ->willReturn($teamData['hasAutomatedReports']);\n $teamObjects[] = $mockTeam;\n }\n\n // Mock the repository to return a Collection (not array)\n $mockTeamRepository->method('getTeamsForKiosk')\n ->with('active')\n ->willReturn(new Collection($teamObjects));\n\n // Create service with mocked TeamRepository\n $automatedReportsService = $this->getService(mockTeamRepository: $mockTeamRepository);\n\n $result = $automatedReportsService->getTeams();\n\n $this->assertEquals($expectedResult, $result);\n }\n\n public function testGetTeamsWithNoTeams(): void\n {\n // Create mock TeamRepository that returns empty Collection\n $mockTeamRepository = $this->createMock(TeamRepository::class);\n $mockTeamRepository->method('getTeamsForKiosk')->willReturn(new Collection([]));\n\n // Create service with mocked TeamRepository\n $automatedReportsService = $this->getService(mockTeamRepository: $mockTeamRepository);\n\n $result = $automatedReportsService->getTeams();\n\n $this->assertEquals([], $result);\n }\n\n public function testGetTeamsWithAllTeamsWithoutFeature(): void\n {\n // Create mock teams without AUTOMATED_REPORTS feature\n $mockTeam1 = $this->createMock(\\Jiminny\\Models\\Team::class);\n $mockTeam1->method('hasFeature')\n ->with(\\Jiminny\\Models\\Feature\\FeatureEnum::AUTOMATED_REPORTS)\n ->willReturn(false);\n\n $mockTeam2 = $this->createMock(\\Jiminny\\Models\\Team::class);\n $mockTeam2->method('hasFeature')\n ->with(\\Jiminny\\Models\\Feature\\FeatureEnum::AUTOMATED_REPORTS)\n ->willReturn(false);\n\n // Create mock TeamRepository that returns Collection\n $mockTeamRepository = $this->createMock(TeamRepository::class);\n $mockTeamRepository->method('getTeamsForKiosk')->willReturn(new Collection([$mockTeam1, $mockTeam2]));\n\n // Create service with mocked TeamRepository\n $automatedReportsService = $this->getService(mockTeamRepository: $mockTeamRepository);\n\n $result = $automatedReportsService->getTeams();\n\n $this->assertEquals([], $result);\n }\n\n public static function getTeamsDataProvider(): array\n {\n return [\n 'single team with feature' => [\n 'mockTeams' => [\n [\n 'id' => 'team-uuid-1',\n 'name' => 'Sales Team',\n 'hasAutomatedReports' => true,\n ],\n ],\n 'expectedResult' => [\n ['id' => 'team-uuid-1', 'name' => 'Sales Team'],\n ],\n ],\n 'multiple teams with feature' => [\n 'mockTeams' => [\n [\n 'id' => 'team-uuid-1',\n 'name' => 'Sales Team',\n 'hasAutomatedReports' => true,\n ],\n [\n 'id' => 'team-uuid-2',\n 'name' => 'Marketing Team',\n 'hasAutomatedReports' => true,\n ],\n [\n 'id' => 'team-uuid-3',\n 'name' => 'Support Team',\n 'hasAutomatedReports' => true,\n ],\n ],\n 'expectedResult' => [\n ['id' => 'team-uuid-1', 'name' => 'Sales Team'],\n ['id' => 'team-uuid-2', 'name' => 'Marketing Team'],\n ['id' => 'team-uuid-3', 'name' => 'Support Team'],\n ],\n ],\n 'mixed teams - some with feature, some without' => [\n 'mockTeams' => [\n [\n 'id' => 'team-uuid-1',\n 'name' => 'Sales Team',\n 'hasAutomatedReports' => true,\n ],\n [\n 'id' => 'team-uuid-2',\n 'name' => 'Marketing Team',\n 'hasAutomatedReports' => false,\n ],\n [\n 'id' => 'team-uuid-3',\n 'name' => 'Support Team',\n 'hasAutomatedReports' => true,\n ],\n ],\n 'expectedResult' => [\n ['id' => 'team-uuid-1', 'name' => 'Sales Team'],\n ['id' => 'team-uuid-3', 'name' => 'Support Team'],\n ],\n ],\n 'all teams without feature' => [\n 'mockTeams' => [\n [\n 'id' => 'team-uuid-1',\n 'name' => 'Sales Team',\n 'hasAutomatedReports' => false,\n ],\n [\n 'id' => 'team-uuid-2',\n 'name' => 'Marketing Team',\n 'hasAutomatedReports' => false,\n ],\n ],\n 'expectedResult' => [],\n ],\n 'empty teams array' => [\n 'mockTeams' => [],\n 'expectedResult' => [],\n ],\n ];\n }\n\n #[DataProvider('deleteS3FilesDataProvider')]\n public function testDeleteS3Files(\n string $mediaType,\n array $expectedFileExtensions,\n array $existingFiles,\n string $pathSuffix,\n int $expectedDeletes\n ): void {\n // Arrange\n $teamUuid = 'team-uuid-123';\n $reportUuid = 'report-uuid-456';\n $basePath = sprintf('%s/reports/%s', $teamUuid, $reportUuid);\n\n $team = Mockery::mock(Team::class);\n $team->allows('getUuid')->andReturn($teamUuid);\n\n $report = Mockery::mock(AutomatedReport::class);\n $report->allows('getTeam')->andReturn($team);\n\n $result = Mockery::mock(AutomatedReportResult::class);\n $result->allows('getReport')->andReturn($report);\n $result->allows('getUuid')->andReturn($reportUuid);\n $result->allows('getMediaType')->andReturn($mediaType);\n\n Storage::fake();\n Log::shouldReceive('info')->times($expectedDeletes);\n\n foreach ($existingFiles as $extension) {\n $filePath = $basePath . $pathSuffix . '.' . $extension;\n Storage::put($filePath, 'dummy content');\n }\n\n // Act\n $this->service->deleteS3Files($result);\n\n // Assert\n foreach ($expectedFileExtensions as $extension) {\n $filePath = $basePath . $pathSuffix . '.' . $extension;\n if (in_array($extension, $existingFiles, true)) {\n Storage::assertMissing($filePath);\n } else {\n // To be sure no unexpected files were created and deleted\n Storage::assertMissing($filePath);\n }\n }\n }\n\n public static function deleteS3FilesDataProvider(): array\n {\n return [\n 'PDF report, all files exist' => [\n 'mediaType' => AutomatedReportsService::MEDIA_TYPE_PDF,\n 'expectedFileExtensions' => ['html', 'MD', 'pdf'],\n 'existingFiles' => ['html', 'MD', 'pdf'],\n 'pathSuffix' => '',\n 'expectedDeletes' => 3,\n ],\n 'PDF report, some files exist' => [\n 'mediaType' => AutomatedReportsService::MEDIA_TYPE_PDF,\n 'expectedFileExtensions' => ['html', 'MD', 'pdf'],\n 'existingFiles' => ['html', 'pdf'],\n 'pathSuffix' => '',\n 'expectedDeletes' => 2,\n ],\n 'PDF report, no files exist' => [\n 'mediaType' => AutomatedReportsService::MEDIA_TYPE_PDF,\n 'expectedFileExtensions' => ['html', 'MD', 'pdf'],\n 'existingFiles' => [],\n 'pathSuffix' => '',\n 'expectedDeletes' => 0,\n ],\n 'Podcast report, all files exist' => [\n 'mediaType' => AutomatedReportsService::MEDIA_TYPE_PODCAST,\n 'expectedFileExtensions' => ['json', 'mp3', 'ssml'],\n 'existingFiles' => ['json', 'mp3', 'ssml'],\n 'pathSuffix' => '_podcast',\n 'expectedDeletes' => 3,\n ],\n 'Podcast report, some files exist' => [\n 'mediaType' => AutomatedReportsService::MEDIA_TYPE_PODCAST,\n 'expectedFileExtensions' => ['json', 'mp3', 'ssml'],\n 'existingFiles' => ['mp3'],\n 'pathSuffix' => '_podcast',\n 'expectedDeletes' => 1,\n ],\n 'Podcast report, no files exist' => [\n 'mediaType' => AutomatedReportsService::MEDIA_TYPE_PODCAST,\n 'expectedFileExtensions' => ['json', 'mp3', 'ssml'],\n 'existingFiles' => [],\n 'pathSuffix' => '_podcast',\n 'expectedDeletes' => 0,\n ],\n 'Other media type, should do nothing' => [\n 'mediaType' => 'some_other_type',\n 'expectedFileExtensions' => [],\n 'existingFiles' => [],\n 'pathSuffix' => '',\n 'expectedDeletes' => 0,\n ],\n ];\n }\n\n public function testDeleteReportsResultsInRetentionPeriodWithLogging(): void\n {\n // Create mocks for the test\n $automatedReportsService = Mockery::mock(AutomatedReportsService::class);\n\n $team = Mockery::mock(Team::class);\n $team->shouldReceive('getId')->andReturn(123);\n\n $from = now()->subDays(30);\n $to = now();\n $source = 'test-source';\n\n // Expect the method to be called with specific parameters\n $automatedReportsService->shouldReceive('deleteReportsResultsInRetentionPeriodWithLogging')\n ->once()\n ->with(\n $team,\n Mockery::on(function ($arg) use ($from) {\n return $arg->timestamp === $from->timestamp;\n }),\n Mockery::on(function ($arg) use ($to) {\n return $arg->timestamp === $to->timestamp;\n }),\n $source\n )\n ->andReturn(5);\n\n // Call the method and verify the result\n $result = $automatedReportsService->deleteReportsResultsInRetentionPeriodWithLogging(\n $team,\n $from,\n $to,\n $source\n );\n\n $this->assertEquals(5, $result);\n }\n\n #[DataProvider('sanitizeFileNameDataProvider')]\n public function testSanitizeFileName(string $input, string $expected): void\n {\n $result = $this->service->sanitizeFileName($input);\n\n $this->assertEquals($expected, $result);\n }\n\n public static function sanitizeFileNameDataProvider(): array\n {\n return [\n 'no special characters' => [\n 'input' => 'Exec Summary - Sep 2025 - Business Development Team',\n 'expected' => 'Exec Summary - Sep 2025 - Business Development Team',\n ],\n 'forward slash in team name' => [\n 'input' => 'Exec Summary - Sep 2025 - ND/IRV',\n 'expected' => 'Exec Summary - Sep 2025 - ND-IRV',\n ],\n 'backslash in team name' => [\n 'input' => 'Exec Summary - Sep 2025 - ND\\IRV',\n 'expected' => 'Exec Summary - Sep 2025 - ND-IRV',\n ],\n 'multiple forward slashes' => [\n 'input' => 'Report - Team A/B/C',\n 'expected' => 'Report - Team A-B-C',\n ],\n 'multiple backslashes' => [\n 'input' => 'Report - Team A\\B\\C',\n 'expected' => 'Report - Team A-B-C',\n ],\n 'mixed slashes and backslashes' => [\n 'input' => 'Report - Team A/B\\C',\n 'expected' => 'Report - Team A-B-C',\n ],\n 'complex team name with slashes' => [\n 'input' => 'Exec Summary - Sep 2025 - Business Development Team - ND/IRV, Net Driven - Acquisition (Sales)',\n 'expected' => 'Exec Summary - Sep 2025 - Business Development Team - ND-IRV, Net Driven - Acquisition (Sales)',\n ],\n 'only slashes' => [\n 'input' => '//\\\\\\\\',\n 'expected' => '----',\n ],\n 'empty string' => [\n 'input' => '',\n 'expected' => '',\n ],\n 'slash at start' => [\n 'input' => '/Report Name',\n 'expected' => '-Report Name',\n ],\n 'slash at end' => [\n 'input' => 'Report Name/',\n 'expected' => 'Report Name-',\n ],\n ];\n }\n\n public function testGetReportFileNameSanitizesOutput(): void\n {\n // Create mock GroupRepository\n $mockGroupRepository = $this->createMock(GroupRepository::class);\n\n // Create mock Group with slash in name\n $mockGroup = $this->createMock(\\Jiminny\\Models\\Group::class);\n $mockGroup->method('getName')->willReturn('ND/IRV, Net Driven - Acquisition (Sales)');\n\n $mockGroupRepository->method('find')->willReturn($mockGroup);\n\n // Create service with mocked GroupRepository\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $mockGroupRepository,\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n // Create mock AutomatedReportResult\n $mockReportResult = $this->createMock(AutomatedReportResult::class);\n\n // Create mock AutomatedReport\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getType')->willReturn('exec_summary');\n $mockReport->method('getFrequency')->willReturn('monthly');\n\n $mockReportResult->method('getReport')->willReturn($mockReport);\n $mockReportResult->method('getFromDate')->willReturn(\n \\Illuminate\\Support\\Carbon::parse('2025-09-01')\n );\n $mockReportResult->method('getToDate')->willReturn(\n \\Illuminate\\Support\\Carbon::parse('2025-09-30')\n );\n $mockReportResult->method('getGroups')->willReturn([123]);\n $mockReportResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PDF);\n\n // Call getReportFileName\n $result = $service->getReportFileName($mockReportResult);\n\n // Verify the result does not contain slashes or backslashes\n $this->assertStringNotContainsString('/', $result);\n $this->assertStringNotContainsString('\\\\', $result);\n\n // Verify the slash was replaced with dash\n $this->assertStringContainsString('ND-IRV', $result);\n }\n\n public function testGetReportFileNameWithExtensionSanitizesOutput(): void\n {\n // Create mock GroupRepository\n $mockGroupRepository = $this->createMock(GroupRepository::class);\n\n // Create mock Group with backslash in name\n $mockGroup = $this->createMock(\\Jiminny\\Models\\Group::class);\n $mockGroup->method('getName')->willReturn('Team\\Name');\n\n $mockGroupRepository->method('find')->willReturn($mockGroup);\n\n // Create service with mocked GroupRepository\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $mockGroupRepository,\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n // Create mock AutomatedReportResult\n $mockReportResult = $this->createMock(AutomatedReportResult::class);\n\n // Create mock AutomatedReport\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getType')->willReturn('exec_summary');\n $mockReport->method('getFrequency')->willReturn('monthly');\n\n $mockReportResult->method('getReport')->willReturn($mockReport);\n $mockReportResult->method('getFromDate')->willReturn(\n \\Illuminate\\Support\\Carbon::parse('2025-09-01')\n );\n $mockReportResult->method('getToDate')->willReturn(\n \\Illuminate\\Support\\Carbon::parse('2025-09-30')\n );\n $mockReportResult->method('getGroups')->willReturn([123]);\n $mockReportResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PDF);\n\n // Call getReportFileNameWithExtension\n $result = $service->getReportFileNameWithExtension($mockReportResult);\n\n // Verify the result does not contain backslashes\n $this->assertStringNotContainsString('\\\\', $result);\n $this->assertStringNotContainsString('/', $result);\n\n // Verify the backslash was replaced with dash\n $this->assertStringContainsString('Team-Name', $result);\n\n // Verify extension is added\n $this->assertStringEndsWith('.pdf', $result);\n }\n\n public function testHasPassedScheduledTimeWithNullGeneratedAt(): void\n {\n $result = $this->service->hasPassedScheduledTime(null, 'America/Chicago');\n\n $this->assertFalse($result);\n }\n\n public function testHasPassedScheduledTimeWhenScheduledTimePassed(): void\n {\n Carbon::setTestNow(Carbon::parse('2026-02-24 10:00:00', 'America/Chicago'));\n\n $generatedAt = Carbon::parse('2026-02-24 01:00:00', 'America/Chicago');\n\n $result = $this->service->hasPassedScheduledTime($generatedAt, 'America/Chicago');\n\n $this->assertTrue($result);\n\n Carbon::setTestNow();\n }\n\n public function testHasPassedScheduledTimeWhenGeneratedAfterScheduledTime(): void\n {\n Carbon::setTestNow(Carbon::parse('2026-02-24 10:00:00', 'America/Chicago'));\n\n $generatedAt = Carbon::parse('2026-02-24 06:00:00', 'America/Chicago');\n\n $result = $this->service->hasPassedScheduledTime($generatedAt, 'America/Chicago');\n\n $this->assertFalse($result);\n\n Carbon::setTestNow();\n }\n\n public function testHasPassedScheduledTimeBeforeScheduledTimeToday(): void\n {\n Carbon::setTestNow(Carbon::parse('2026-02-24 04:00:00', 'America/Chicago'));\n\n $generatedAt = Carbon::parse('2026-02-24 01:00:00', 'America/Chicago');\n\n $result = $this->service->hasPassedScheduledTime($generatedAt, 'America/Chicago');\n\n $this->assertFalse($result);\n\n Carbon::setTestNow();\n }\n\n public function testShouldSendReportWithEmptyUsers(): void\n {\n $result = $this->service->shouldSendReport([]);\n\n $this->assertFalse($result);\n }\n\n public function testShouldSendReportAtScheduledTime(): void\n {\n Carbon::setTestNow(Carbon::parse('2026-02-24 05:00:00', 'America/Chicago'));\n\n $users = [\n ['email' => 'test@example.com', 'name' => 'Test User', 'timezone' => 'America/Chicago'],\n ];\n\n $result = $this->service->shouldSendReport($users);\n\n $this->assertTrue($result);\n\n Carbon::setTestNow();\n }\n\n public function testShouldSendReportNotAtScheduledTimeWithoutGeneratedAt(): void\n {\n Carbon::setTestNow(Carbon::parse('2026-02-24 10:00:00', 'America/Chicago'));\n\n $users = [\n ['email' => 'test@example.com', 'name' => 'Test User', 'timezone' => 'America/Chicago'],\n ];\n\n $result = $this->service->shouldSendReport($users);\n\n $this->assertFalse($result);\n\n Carbon::setTestNow();\n }\n\n public function testShouldSendReportWhenScheduledTimeMissed(): void\n {\n Carbon::setTestNow(Carbon::parse('2026-02-24 10:00:00', 'America/Chicago'));\n\n $users = [\n ['email' => 'test@example.com', 'name' => 'Test User', 'timezone' => 'America/Chicago'],\n ];\n\n $generatedAt = Carbon::parse('2026-02-24 01:00:00', 'America/Chicago');\n\n $result = $this->service->shouldSendReport($users, $generatedAt);\n\n $this->assertTrue($result);\n\n Carbon::setTestNow();\n }\n\n public function testShouldSendReportWhenGeneratedAfterScheduledTime(): void\n {\n Carbon::setTestNow(Carbon::parse('2026-02-24 10:00:00', 'America/Chicago'));\n\n $users = [\n ['email' => 'test@example.com', 'name' => 'Test User', 'timezone' => 'America/Chicago'],\n ];\n\n $generatedAt = Carbon::parse('2026-02-24 06:00:00', 'America/Chicago');\n\n $result = $this->service->shouldSendReport($users, $generatedAt);\n\n $this->assertFalse($result);\n\n Carbon::setTestNow();\n }\n\n public function testGetTypes(): void\n {\n $types = AutomatedReportsService::getTypes();\n\n $this->assertIsArray($types);\n $this->assertContains('exec_summary', $types);\n $this->assertContains('coaching_profiles', $types);\n $this->assertContains('loss_analysis', $types);\n $this->assertNotContains('ask_jiminny', $types);\n }\n\n public function testGetCallTypes(): void\n {\n $callTypes = AutomatedReportsService::getCallTypes();\n\n $this->assertIsArray($callTypes);\n $this->assertContains('conference', $callTypes);\n $this->assertContains('dialer', $callTypes);\n }\n\n public function testGetFrequencies(): void\n {\n $frequencies = AutomatedReportsService::getFrequencies();\n\n $this->assertIsArray($frequencies);\n $this->assertContains('weekly', $frequencies);\n $this->assertContains('monthly', $frequencies);\n $this->assertContains('quarterly', $frequencies);\n $this->assertContains('one_off', $frequencies);\n $this->assertNotContains('daily', $frequencies);\n }\n\n public function testGetAskJiminnyFrequencies(): void\n {\n $frequencies = AutomatedReportsService::getAskJiminnyFrequencies();\n\n $this->assertIsArray($frequencies);\n $this->assertContains('daily', $frequencies);\n $this->assertContains('weekly', $frequencies);\n $this->assertContains('monthly', $frequencies);\n $this->assertNotContains('quarterly', $frequencies);\n $this->assertNotContains('one_off', $frequencies);\n }\n\n public function testGetReportEnabledFieldData(): void\n {\n $result = $this->service->getReportEnabledFieldData(true);\n\n $this->assertEquals('report_enabled', $result['id']);\n $this->assertTrue($result['value']);\n }\n\n public function testGetReportEnabledFieldDataDefault(): void\n {\n $result = $this->service->getReportEnabledFieldData();\n\n $this->assertFalse($result['value']);\n }\n\n public function testGetOrganizationFieldDataShortVersion(): void\n {\n $mockTeamRepository = $this->createMock(TeamRepository::class);\n $mockTeamRepository->method('getTeamsForKiosk')->willReturn(new Collection([]));\n\n $service = $this->getService(mockTeamRepository: $mockTeamRepository);\n $result = $service->getOrganizationFieldData(null, true);\n\n $this->assertEquals('organization', $result['id']);\n $this->assertArrayNotHasKey('inputType', $result);\n $this->assertArrayHasKey('options', $result);\n }\n\n public function testGetOrganizationFieldDataFullVersion(): void\n {\n $mockTeamRepository = $this->createMock(TeamRepository::class);\n $mockTeamRepository->method('getTeamsForKiosk')->willReturn(new Collection([]));\n\n $service = $this->getService(mockTeamRepository: $mockTeamRepository);\n $result = $service->getOrganizationFieldData('team-uuid-1', false);\n\n $this->assertEquals('organization', $result['id']);\n $this->assertArrayHasKey('inputType', $result);\n $this->assertEquals('team-uuid-1', $result['value']);\n $this->assertArrayHasKey('dependencies', $result);\n }\n\n public function testGetTeamFieldDataShortVersion(): void\n {\n $result = $this->service->getTeamFieldData([], [], true);\n\n $this->assertEquals('teams', $result['id']);\n $this->assertArrayNotHasKey('inputType', $result);\n }\n\n public function testGetTeamFieldDataFullVersion(): void\n {\n $result = $this->service->getTeamFieldData(['opt1'], ['val1'], false);\n\n $this->assertEquals('teams', $result['id']);\n $this->assertArrayHasKey('inputType', $result);\n $this->assertEquals(['opt1'], $result['options']);\n $this->assertEquals(['val1'], $result['value']);\n }\n\n public function testGetReportTypeFieldDataShortVersion(): void\n {\n $result = $this->service->getReportTypeFieldData(null, true);\n\n $this->assertEquals('report_type', $result['id']);\n $this->assertArrayNotHasKey('inputType', $result);\n }\n\n public function testGetReportTypeFieldDataFullVersion(): void\n {\n $result = $this->service->getReportTypeFieldData('exec_summary', false);\n\n $this->assertEquals('report_type', $result['id']);\n $this->assertArrayHasKey('inputType', $result);\n $this->assertEquals('exec_summary', $result['value']);\n }\n\n public function testGetReportTypeFieldDataWithTeamHavingBothFeatures(): void\n {\n $team = $this->createMock(\\Jiminny\\Models\\Team::class);\n $team->method('hasFeature')->willReturnMap([\n [\\Jiminny\\Models\\Feature\\FeatureEnum::AUTOMATED_REPORTS, true],\n [\\Jiminny\\Models\\Feature\\FeatureEnum::ASK_JIMINNY_REPORTS, true],\n ]);\n\n $result = $this->service->getReportTypeFieldData(null, true, $team);\n\n $ids = array_column($result['options'], 'id');\n $this->assertContains('exec_summary', $ids);\n $this->assertContains(AutomatedReportsService::TYPE_ASK_JIMINNY, $ids);\n $this->assertLessThan(\n array_search(AutomatedReportsService::TYPE_ASK_JIMINNY, $ids),\n array_search('exec_summary', $ids)\n );\n }\n\n public function testGetReportTypeFieldDataWithTeamHavingOnlyAutomatedReports(): void\n {\n $team = $this->createMock(\\Jiminny\\Models\\Team::class);\n $team->method('hasFeature')->willReturnMap([\n [\\Jiminny\\Models\\Feature\\FeatureEnum::AUTOMATED_REPORTS, true],\n [\\Jiminny\\Models\\Feature\\FeatureEnum::ASK_JIMINNY_REPORTS, false],\n ]);\n\n $result = $this->service->getReportTypeFieldData(null, true, $team);\n\n $ids = array_column($result['options'], 'id');\n $this->assertContains('exec_summary', $ids);\n $this->assertNotContains(AutomatedReportsService::TYPE_ASK_JIMINNY, $ids);\n }\n\n public function testGetReportTypeFieldDataWithTeamHavingOnlyAskJiminny(): void\n {\n $team = $this->createMock(\\Jiminny\\Models\\Team::class);\n $team->method('hasFeature')->willReturnMap([\n [\\Jiminny\\Models\\Feature\\FeatureEnum::AUTOMATED_REPORTS, false],\n [\\Jiminny\\Models\\Feature\\FeatureEnum::ASK_JIMINNY_REPORTS, true],\n ]);\n\n $result = $this->service->getReportTypeFieldData(null, true, $team);\n\n $ids = array_column($result['options'], 'id');\n $this->assertContains(AutomatedReportsService::TYPE_ASK_JIMINNY, $ids);\n $this->assertNotContains('exec_summary', $ids);\n }\n\n public function testGetReportTypeFieldDataWithNullTeamFallsBackToStandardTypes(): void\n {\n $result = $this->service->getReportTypeFieldData(null, true, null);\n\n $ids = array_column($result['options'], 'id');\n $this->assertContains('exec_summary', $ids);\n $this->assertNotContains(AutomatedReportsService::TYPE_ASK_JIMINNY, $ids);\n }\n\n public function testGetFrequencyFieldData(): void\n {\n $result = $this->service->getFrequencyFieldData('weekly');\n\n $this->assertEquals('frequency', $result['id']);\n $this->assertEquals('weekly', $result['value']);\n $this->assertArrayHasKey('options', $result);\n }\n\n public function testGetPeriodFieldData(): void\n {\n $result = $this->service->getPeriodFieldData('2025-01-01', '2025-01-31');\n\n $this->assertEquals('period', $result['id']);\n $this->assertEquals('2025-01-01', $result['value']['startDate']);\n $this->assertEquals('2025-01-31', $result['value']['endDate']);\n }\n\n public function testGetCallDurationFieldData(): void\n {\n $result = $this->service->getCallDurationFieldData(5, 60);\n\n $this->assertEquals('call_duration', $result['id']);\n $this->assertEquals(5, $result['value']['min']);\n $this->assertEquals(60, $result['value']['max']);\n }\n\n public function testGetDealValueFieldData(): void\n {\n $result = $this->service->getDealValueFieldData(1000, 5000);\n\n $this->assertEquals('deal_value', $result['id']);\n $this->assertEquals(1000, $result['value']['min']);\n $this->assertEquals(5000, $result['value']['max']);\n }\n\n public function testGetCustomReportNameFieldData(): void\n {\n $result = $this->service->getCustomReportNameFieldData('My Report');\n\n $this->assertEquals('custom_name', $result['id']);\n $this->assertEquals('My Report', $result['value']);\n }\n\n public function testGetAdditionalPromptInputFieldData(): void\n {\n $result = $this->service->getAdditionalPromptInputFieldData('Some prompt');\n\n $this->assertEquals('additional_prompt_input', $result['id']);\n $this->assertEquals('Some prompt', $result['value']);\n }\n\n public function testGetCallTypeFieldDataBothOn(): void\n {\n $result = $this->service->getCallTypeFieldData(true, true);\n\n $this->assertEquals('call_type', $result['id']);\n $this->assertCount(2, $result['value']);\n }\n\n public function testGetCallTypeFieldDataNoneOn(): void\n {\n $result = $this->service->getCallTypeFieldData(false, false);\n\n $this->assertEquals('call_type', $result['id']);\n $this->assertEmpty($result['value']);\n }\n\n public function testGetCallTypeFieldDataConferenceOnly(): void\n {\n $result = $this->service->getCallTypeFieldData(true, false);\n\n $this->assertCount(1, $result['value']);\n $this->assertEquals('conference', $result['value'][0]['id']);\n }\n\n public function testGetCallTypeFieldDataDialerOnly(): void\n {\n $result = $this->service->getCallTypeFieldData(false, true);\n\n $this->assertCount(1, $result['value']);\n $this->assertEquals('dialer', $result['value'][0]['id']);\n }\n\n public function testTransformDurationToMinutesNull(): void\n {\n $result = $this->service->transformDurationToMinutes(null);\n\n $this->assertNull($result);\n }\n\n public function testTransformDurationToMinutesZero(): void\n {\n $result = $this->service->transformDurationToMinutes(0);\n\n $this->assertNull($result);\n }\n\n public function testTransformDurationToMinutes(): void\n {\n $result = $this->service->transformDurationToMinutes(300);\n\n $this->assertEquals(5, $result);\n }\n\n public function testGetTeam(): void\n {\n $mockTeam = $this->createMock(Team::class);\n $mockTeamRepository = $this->createMock(TeamRepository::class);\n $mockTeamRepository->expects($this->once())\n ->method('idOrUuid')\n ->with('team-uuid')\n ->willReturn($mockTeam);\n\n $service = $this->getService(mockTeamRepository: $mockTeamRepository);\n $result = $service->getTeam('team-uuid');\n\n $this->assertSame($mockTeam, $result);\n }\n\n public function testGetTeamById(): void\n {\n $mockTeam = $this->createMock(Team::class);\n $mockTeamRepository = $this->createMock(TeamRepository::class);\n $mockTeamRepository->expects($this->once())\n ->method('find')\n ->with(42)\n ->willReturn($mockTeam);\n\n $service = $this->getService(mockTeamRepository: $mockTeamRepository);\n $result = $service->getTeamById(42);\n\n $this->assertSame($mockTeam, $result);\n }\n\n public function testGetGroupsUuidsEmpty(): void\n {\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getGroups')->willReturn([]);\n\n $result = $this->service->getGroupsUuids($report);\n\n $this->assertEquals([], $result);\n }\n\n public function testGetGroupsUuidsWithGroups(): void\n {\n $mockGroup = $this->createMock(Group::class);\n $mockGroup->method('getUuid')->willReturn('group-uuid-1');\n\n $mockGroupRepository = $this->createMock(GroupRepository::class);\n $mockGroupRepository->method('find')->willReturnMap([\n [10, $mockGroup],\n [99, null],\n ]);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $mockGroupRepository,\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getGroups')->willReturn([10, 99]);\n\n $result = $service->getGroupsUuids($report);\n\n $this->assertEquals(['group-uuid-1'], $result);\n }\n\n public function testGetPlaybookCategoriesUuidsEmpty(): void\n {\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getPlaybookCategories')->willReturn([]);\n\n $result = $this->service->getPlaybookCategoriesUuids($report);\n\n $this->assertEquals([], $result);\n }\n\n public function testGetPlaybookCategoriesUuidsWithCategories(): void\n {\n $mockCategory = $this->createMock(\\Jiminny\\Models\\PlaybookCategory::class);\n $mockCategory->method('getUuid')->willReturn('cat-uuid-1');\n\n $mockPlaybookCategoryRepository = $this->createMock(PlaybookCategoryRepository::class);\n $mockPlaybookCategoryRepository->method('find')->willReturnMap([\n [1, $mockCategory],\n [2, null],\n ]);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $mockPlaybookCategoryRepository,\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getPlaybookCategories')->willReturn([1, 2]);\n\n $result = $service->getPlaybookCategoriesUuids($report);\n\n $this->assertEquals(['cat-uuid-1'], $result);\n }\n\n public function testGetDealAtCallStagesUuidsEmpty(): void\n {\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getDealAtCallStages')->willReturn([]);\n\n $result = $this->service->getDealAtCallStagesUuids($report);\n\n $this->assertEquals([], $result);\n }\n\n public function testGetDealAtCallStagesUuidsWithStages(): void\n {\n $mockStage = $this->createMock(\\Jiminny\\Models\\Stage::class);\n $mockStage->method('getUuid')->willReturn('stage-uuid-1');\n\n $mockStageRepository = $this->createMock(StageRepository::class);\n $mockStageRepository->method('find')->willReturnMap([\n [5, $mockStage],\n [9, null],\n ]);\n\n $service = $this->getService(mockStageRepository: $mockStageRepository);\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getDealAtCallStages')->willReturn([5, 9]);\n\n $result = $service->getDealAtCallStagesUuids($report);\n\n $this->assertEquals(['stage-uuid-1'], $result);\n }\n\n public function testGetJiminnyUsersUuids(): void\n {\n $mockUser = $this->createMock(User::class);\n $mockUser->method('getUuid')->willReturn('user-uuid-1');\n\n $mockUserRepository = $this->createMock(UserRepository::class);\n $mockUserRepository->method('find')->willReturn($mockUser);\n\n $service = $this->getService(mockUserRepository: $mockUserRepository);\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getJiminnyRecipients')->willReturn(['users' => [1]]);\n\n $result = $service->getJiminnyUsersUuids($report);\n\n $this->assertEquals(['user-uuid-1'], $result);\n }\n\n public function testGetRecipientUsers(): void\n {\n $mockUser = $this->createMock(User::class);\n $mockUser->method('getEmailAddress')->willReturn('user@test.com');\n $mockUser->method('getName')->willReturn('Test User');\n $timezone = $this->createMock(\\DateTimeZone::class);\n $timezone->method('getName')->willReturn('UTC');\n $mockUser->method('getTimezone')->willReturn($timezone);\n\n $mockUserRepository = $this->createMock(UserRepository::class);\n $mockUserRepository->method('find')->willReturn($mockUser);\n\n $service = $this->getService(mockUserRepository: $mockUserRepository);\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getRecipients')->willReturn(['users' => [1]]);\n\n $result = $service->getRecipientUsers($report);\n\n $this->assertCount(1, $result);\n $this->assertEquals('user@test.com', $result[0]['email']);\n $this->assertEquals('Test User', $result[0]['name']);\n }\n\n public function testGetValidRecipientUsersFiltersEmptyEmail(): void\n {\n $mockUserWithEmail = $this->createMock(User::class);\n $mockUserWithEmail->method('getEmailAddress')->willReturn('valid@test.com');\n $mockUserWithEmail->method('getName')->willReturn('Valid User');\n $timezone = $this->createMock(\\DateTimeZone::class);\n $timezone->method('getName')->willReturn('UTC');\n $mockUserWithEmail->method('getTimezone')->willReturn($timezone);\n\n $mockUserNoEmail = $this->createMock(User::class);\n $mockUserNoEmail->method('getEmailAddress')->willReturn('');\n $mockUserNoEmail->method('getName')->willReturn('No Email User');\n $mockUserNoEmail->method('getTimezone')->willReturn($timezone);\n\n $mockUserRepository = $this->createMock(UserRepository::class);\n $mockUserRepository->method('find')->willReturnMap([\n [1, $mockUserWithEmail],\n [2, $mockUserNoEmail],\n ]);\n\n $service = $this->getService(mockUserRepository: $mockUserRepository);\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getRecipients')->willReturn(['users' => [1, 2]]);\n $report->method('getJiminnyRecipients')->willReturn(['users' => []]);\n\n $result = $service->getValidRecipientUsers($report);\n\n $this->assertCount(1, $result);\n $this->assertEquals('valid@test.com', $result[0]['email']);\n }\n\n public function testGetValidRecipientUsersWithJiminny(): void\n {\n $tz = $this->createMock(\\DateTimeZone::class);\n $tz->method('getName')->willReturn('UTC');\n\n $mockUser1 = $this->createMock(User::class);\n $mockUser1->method('getEmailAddress')->willReturn('user1@test.com');\n $mockUser1->method('getName')->willReturn('User1');\n $mockUser1->method('getTimezone')->willReturn($tz);\n\n $mockUser2 = $this->createMock(User::class);\n $mockUser2->method('getEmailAddress')->willReturn('jiminny@test.com');\n $mockUser2->method('getName')->willReturn('Jiminny');\n $mockUser2->method('getTimezone')->willReturn($tz);\n\n $mockUserRepository = $this->createMock(UserRepository::class);\n $mockUserRepository->method('find')->willReturnMap([\n [1, $mockUser1],\n [2, $mockUser2],\n ]);\n\n $service = $this->getService(mockUserRepository: $mockUserRepository);\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getRecipients')->willReturn(['users' => [1]]);\n $report->method('getJiminnyRecipients')->willReturn(['users' => [2]]);\n\n $result = $service->getValidRecipientUsers($report, true);\n\n $this->assertCount(2, $result);\n }\n\n public function testGetReportTypeName(): void\n {\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getType')->willReturn('exec_summary');\n\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getReport')->willReturn($report);\n\n $result = $this->service->getReportTypeName($mockResult);\n\n $this->assertEquals('Exec Summary', $result);\n }\n\n public function testGetReportPeriodNameThrowsOnNullFrom(): void\n {\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getFrequency')->willReturn('weekly');\n\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getReport')->willReturn($report);\n $mockResult->method('getFromDate')->willReturn(null);\n $mockResult->method('getToDate')->willReturn(IlluminateCarbon::parse('2025-01-15'));\n\n $this->expectException(\\Jiminny\\Exceptions\\ApplicationException::class);\n\n $this->service->getReportPeriodName($mockResult);\n }\n\n public function testGetReportPeriodNameThrowsOnNullTo(): void\n {\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getFrequency')->willReturn('weekly');\n\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getReport')->willReturn($report);\n $mockResult->method('getFromDate')->willReturn(IlluminateCarbon::parse('2025-01-08'));\n $mockResult->method('getToDate')->willReturn(null);\n\n $this->expectException(\\Jiminny\\Exceptions\\ApplicationException::class);\n\n $this->service->getReportPeriodName($mockResult);\n }\n\n #[DataProvider('formatReportPeriodNameDataProvider')]\n public function testGetReportPeriodName(\n string $frequency,\n string $from,\n string $to,\n string $expected\n ): void {\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getFrequency')->willReturn($frequency);\n\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getReport')->willReturn($report);\n $mockResult->method('getFromDate')->willReturn(IlluminateCarbon::parse($from));\n $mockResult->method('getToDate')->willReturn(IlluminateCarbon::parse($to));\n\n $result = $this->service->getReportPeriodName($mockResult);\n\n $this->assertEquals($expected, $result);\n }\n\n public static function formatReportPeriodNameDataProvider(): array\n {\n return [\n 'daily' => [\n 'frequency' => 'daily',\n 'from' => '2025-05-15',\n 'to' => '2025-05-15',\n 'expected' => '15 May 2025',\n ],\n 'monthly same year' => [\n 'frequency' => 'monthly',\n 'from' => '2025-05-01',\n 'to' => '2025-05-31',\n 'expected' => 'May 2025',\n ],\n 'weekly same month' => [\n 'frequency' => 'weekly',\n 'from' => '2025-08-04',\n 'to' => '2025-08-08',\n 'expected' => '4 - 8 Aug 2025',\n ],\n 'weekly different months same year' => [\n 'frequency' => 'weekly',\n 'from' => '2025-10-27',\n 'to' => '2025-11-03',\n 'expected' => '27 Oct - 3 Nov 2025',\n ],\n 'weekly different years' => [\n 'frequency' => 'weekly',\n 'from' => '2024-12-28',\n 'to' => '2025-01-03',\n 'expected' => '28 Dec 2024 - 3 Jan 2025',\n ],\n 'quarterly same year' => [\n 'frequency' => 'quarterly',\n 'from' => '2025-01-01',\n 'to' => '2025-04-01',\n 'expected' => 'Jan - Mar 2025',\n ],\n 'quarterly different years' => [\n 'frequency' => 'quarterly',\n 'from' => '2024-11-01',\n 'to' => '2025-02-01',\n 'expected' => 'Nov 2024 - Jan 2025',\n ],\n 'one_off same month' => [\n 'frequency' => 'one_off',\n 'from' => '2025-05-02',\n 'to' => '2025-05-31',\n 'expected' => '2 - 31 May 2025',\n ],\n 'one_off different months same year' => [\n 'frequency' => 'one_off',\n 'from' => '2025-05-15',\n 'to' => '2025-06-15',\n 'expected' => '15 May - 15 Jun 2025',\n ],\n 'one_off different years' => [\n 'frequency' => 'one_off',\n 'from' => '2024-12-15',\n 'to' => '2025-01-15',\n 'expected' => '15 Dec 2024 - 15 Jan 2025',\n ],\n 'unknown frequency falls back to default' => [\n 'frequency' => 'unknown',\n 'from' => '2025-05-01',\n 'to' => '2025-05-31',\n 'expected' => '1 May 2025 - 31 May 2025',\n ],\n ];\n }\n\n public function testGetReportTeamsNameEmpty(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getGroups')->willReturn([]);\n\n $result = $this->service->getReportTeamsName($mockResult);\n\n $this->assertEquals('All', $result);\n }\n\n public function testGetReportTeamsNameSingleGroup(): void\n {\n $mockGroup = $this->createMock(Group::class);\n $mockGroup->method('getName')->willReturn('Sales Team');\n\n $mockGroupRepository = $this->createMock(GroupRepository::class);\n $mockGroupRepository->method('find')->willReturn($mockGroup);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $mockGroupRepository,\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getGroups')->willReturn([10]);\n\n $result = $service->getReportTeamsName($mockResult);\n\n $this->assertEquals('Sales Team', $result);\n }\n\n public function testGetReportTeamsNameMultipleGroups(): void\n {\n $mockGroup1 = $this->createMock(Group::class);\n $mockGroup1->method('getName')->willReturn('Sales Team');\n\n $mockGroup2 = $this->createMock(Group::class);\n $mockGroup2->method('getName')->willReturn('Marketing Team');\n\n $mockGroupRepository = $this->createMock(GroupRepository::class);\n $mockGroupRepository->method('find')->willReturnMap([\n [10, $mockGroup1],\n [20, $mockGroup2],\n [99, null],\n ]);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $mockGroupRepository,\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getGroups')->willReturn([10, 20, 99]);\n\n $result = $service->getReportTeamsName($mockResult);\n\n $this->assertEquals('Sales Team, Marketing Team', $result);\n }\n\n public function testGetReportFound(): void\n {\n $mockReport = $this->createMock(AutomatedReport::class);\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->expects($this->once())\n ->method('findByUuid')\n ->with('report-uuid')\n ->willReturn($mockReport);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $result = $service->getReport('report-uuid');\n\n $this->assertSame($mockReport, $result);\n }\n\n public function testGetReportNotFound(): void\n {\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->method('findByUuid')->willReturn(null);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(ModelNotFoundException::class);\n\n $service->getReport('non-existent-uuid');\n }\n\n public function testDeleteReportNotFound(): void\n {\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->method('findByUuid')->willReturn(null);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(ModelNotFoundException::class);\n\n $service->delete('non-existent-uuid');\n }\n\n public function testDeleteReportSuccess(): void\n {\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->expects($this->once())->method('delete');\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->method('findByUuid')->willReturn($mockReport);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $service->delete('report-uuid');\n }\n\n public function testUpdateStatusNotFound(): void\n {\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->method('findByUuid')->willReturn(null);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(ModelNotFoundException::class);\n\n $service->updateStatus('non-existent-uuid', ['report_enabled' => true]);\n }\n\n public function testGetReportResultFound(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->expects($this->once())\n ->method('findResultByUuid')\n ->with('result-uuid')\n ->willReturn($mockResult);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $result = $service->getReportResult('result-uuid');\n\n $this->assertSame($mockResult, $result);\n }\n\n public function testGetReportResultNotFound(): void\n {\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->method('findResultByUuid')->willReturn(null);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(ModelNotFoundException::class);\n\n $service->getReportResult('non-existent-uuid');\n }\n\n public function testFindChildResult(): void\n {\n $mockParent = $this->createMock(AutomatedReportResult::class);\n $mockChild = $this->createMock(AutomatedReportResult::class);\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->expects($this->once())\n ->method('findChildResult')\n ->with($mockParent, 'podcast')\n ->willReturn($mockChild);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $result = $service->findChildResult($mockParent, 'podcast');\n\n $this->assertSame($mockChild, $result);\n }\n\n #[DataProvider('calculateFromAndToDatePeriodDataProvider')]\n public function testCalculateFromAndToDatePeriod(string $frequency): void\n {\n Carbon::setTestNow(Carbon::parse('2025-06-15 12:00:00'));\n\n $result = $this->service->calculateFromAndToDatePeriod($frequency);\n\n $this->assertArrayHasKey('fromDate', $result);\n $this->assertArrayHasKey('toDate', $result);\n $this->assertInstanceOf(Carbon::class, $result['fromDate']);\n $this->assertInstanceOf(Carbon::class, $result['toDate']);\n\n Carbon::setTestNow();\n }\n\n public static function calculateFromAndToDatePeriodDataProvider(): array\n {\n return [\n 'daily' => ['daily'],\n 'weekly' => ['weekly'],\n 'monthly' => ['monthly'],\n 'quarterly' => ['quarterly'],\n ];\n }\n\n public function testCalculateFromAndToDatePeriodOneOff(): void\n {\n $from = IlluminateCarbon::parse('2025-01-01');\n $to = IlluminateCarbon::parse('2025-01-31');\n\n $result = $this->service->calculateFromAndToDatePeriod('one_off', $from, $to);\n\n $this->assertSame($from, $result['fromDate']);\n $this->assertSame($to, $result['toDate']);\n }\n\n public function testCalculateFromAndToDatePeriodInvalidFrequency(): void\n {\n $this->expectException(InvalidArgumentException::class);\n\n $this->service->calculateFromAndToDatePeriod('invalid_frequency');\n }\n\n public function testGetMediaPath(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PDF);\n $mockResult->method('getPdfUrl')->willReturn('https://example.com/reports/file.pdf');\n\n $result = $this->service->getMediaPath($mockResult);\n\n $this->assertEquals('/reports/file.pdf', $result);\n }\n\n public function testGetMediaPathPodcast(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PODCAST);\n $mockResult->method('getPodcastAudioUrl')->willReturn('https://example.com/audio/file.mp3');\n\n $result = $this->service->getMediaPath($mockResult);\n\n $this->assertEquals('/audio/file.mp3', $result);\n }\n\n public function testGetMediaPathNullUrl(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getMediaType')->willReturn('unknown_type');\n\n $result = $this->service->getMediaPath($mockResult);\n\n $this->assertNull($result);\n }\n\n public function testGetMediaPathPdfNullUrl(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PDF);\n $mockResult->method('getPdfUrl')->willReturn(null);\n\n $result = $this->service->getMediaPath($mockResult);\n\n $this->assertNull($result);\n }\n\n public function testGetFilenameSuffixPodcast(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PODCAST);\n\n $result = $this->service->getFilenameSuffix($mockResult);\n\n $this->assertEquals('Podcast', $result);\n }\n\n public function testGetFilenameSuffixPdf(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PDF);\n\n $result = $this->service->getFilenameSuffix($mockResult);\n\n $this->assertNull($result);\n }\n\n public function testGetMailSubjectSuffixPdf(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PDF);\n\n $result = $this->service->getMailSubjectSuffix($mockResult);\n\n $this->assertEquals('report', $result);\n }\n\n public function testGetMailSubjectSuffixPodcast(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PODCAST);\n\n $result = $this->service->getMailSubjectSuffix($mockResult);\n\n $this->assertEquals('podcast', $result);\n }\n\n public function testGetMailSubjectSuffixUnknown(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getMediaType')->willReturn('unknown_type');\n\n $result = $this->service->getMailSubjectSuffix($mockResult);\n\n $this->assertEquals('', $result);\n }\n\n public function testGetMediaTypeMetadataPdf(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PDF);\n\n $result = $this->service->getMediaTypeMetadata($mockResult);\n\n $this->assertEquals('pdf', $result['extension']);\n $this->assertEquals('application/pdf', $result['mime']);\n }\n\n public function testGetMediaTypeMetadataPodcast(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PODCAST);\n\n $result = $this->service->getMediaTypeMetadata($mockResult);\n\n $this->assertEquals('mp3', $result['extension']);\n $this->assertEquals('audio/mpeg', $result['mime']);\n }\n\n public function testGetMediaTypeMetadataUnknown(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getMediaType')->willReturn('unknown');\n\n $result = $this->service->getMediaTypeMetadata($mockResult);\n\n $this->assertNull($result['extension']);\n $this->assertNull($result['mime']);\n }\n\n public function testGetTeamIdsWithReportsResults(): void\n {\n $expected = new Collection([1, 2, 3]);\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->expects($this->once())\n ->method('getTeamIdsWithReportsResults')\n ->with(5)\n ->willReturn($expected);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $result = $service->getTeamIdsWithReportsResults(5);\n\n $this->assertSame($expected, $result);\n }\n\n public function testGetTeamReports(): void\n {\n $mockTeam = $this->createMock(Team::class);\n $expected = new \\Illuminate\\Database\\Eloquent\\Collection();\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->expects($this->once())\n ->method('getReportsByTeam')\n ->with($mockTeam)\n ->willReturn($expected);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $result = $service->getTeamReports($mockTeam);\n\n $this->assertSame($expected, $result);\n }\n\n public function testGetReportResults(): void\n {\n $mockReport = $this->createMock(AutomatedReport::class);\n $expected = new \\Illuminate\\Database\\Eloquent\\Collection();\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->expects($this->once())\n ->method('getResultsByReport')\n ->with($mockReport)\n ->willReturn($expected);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $result = $service->getReportResults($mockReport);\n\n $this->assertSame($expected, $result);\n }\n\n public function testDeleteReportsResultsInRetentionPeriodNoReports(): void\n {\n $mockTeam = $this->createMock(Team::class);\n $retentionDate = \\Carbon\\CarbonImmutable::parse('2025-01-01');\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->expects($this->once())\n ->method('getReportIdsByTeam')\n ->willReturn(new Collection([]));\n $mockRepo->expects($this->never())\n ->method('getReportResultsQueryForRetention');\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $result = $service->deleteReportsResultsInRetentionPeriod($mockTeam, $retentionDate);\n\n $this->assertEquals(0, $result);\n }\n\n public function testDeleteReportsResultsInRetentionPeriodWithNoQueryResults(): void\n {\n $mockTeam = $this->createMock(Team::class);\n $mockTeam->method('getId')->willReturn(1);\n $retentionDate = \\Carbon\\CarbonImmutable::parse('2025-01-01');\n\n $mockQuery = Mockery::mock(Builder::class);\n $mockQuery->shouldReceive('exists')->andReturn(false);\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->method('getReportIdsByTeam')->willReturn(new Collection([1, 2]));\n $mockRepo->method('getReportResultsQueryForRetention')->willReturn($mockQuery);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n Log::shouldReceive('info')->zeroOrMoreTimes();\n\n $result = $service->deleteReportsResultsInRetentionPeriod($mockTeam, $retentionDate);\n\n $this->assertEquals(0, $result);\n }\n\n public function testUpdateAskJiminnyReportStatusNotAskJiminny(): void\n {\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('isAskJiminnyReport')->willReturn(false);\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $mockUser = $this->createMock(User::class);\n\n $this->expectException(InvalidArgumentException::class);\n $this->expectExceptionMessage('Report is not an Ask Jiminny report');\n\n $service->updateAskJiminnyReport($mockReport, [], $mockUser);\n }\n\n public function testGetAskJiminnyReportFilters(): void\n {\n $mockUser = $this->createMock(User::class);\n\n $mockSearch = $this->createMock(Search::class);\n $mockSearch->method('getUuid')->willReturn('search-uuid-1');\n $mockSearch->method('getName')->willReturn('My Search');\n\n $mockSearchRepository = $this->createMock(SearchRepository::class);\n $mockSearchRepository->expects($this->once())\n ->method('findByUserOrderedByName')\n ->with($mockUser)\n ->willReturn(new Collection([$mockSearch]));\n\n $mockPromptDto = new AskAnythingPromptDto(\n id: 'prompt-uuid-1',\n title: 'My Prompt',\n content: 'Prompt text',\n target: AskAnythingPromptTarget::on_demand,\n );\n\n $mockPromptService = $this->createMock(AskAnythingPromptService::class);\n $mockPromptService->expects($this->once())\n ->method('get')\n ->with($mockUser, AskAnythingPromptTarget::on_demand)\n ->willReturn([$mockPromptDto]);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $mockPromptService,\n $mockSearchRepository,\n $this->createMock(AskAnythingRepository::class),\n );\n\n $result = $service->getAskJiminnyReportFilters($mockUser);\n\n $this->assertCount(2, $result);\n $promptFilter = collect($result)->firstWhere('id', 'prompt');\n $searchFilter = collect($result)->firstWhere('id', 'saved_search');\n\n $this->assertCount(1, $promptFilter['options']);\n $this->assertEquals('prompt-uuid-1', $promptFilter['options'][0]['id']);\n $this->assertCount(1, $searchFilter['options']);\n $this->assertEquals('search-uuid-1', $searchFilter['options'][0]['id']);\n }\n\n public function testGetAskJiminnyReportFormDataWithoutReport(): void\n {\n $timezone = new \\DateTimeZone('UTC');\n\n $mockUser = $this->createMock(User::class);\n $mockUser->method('getTimezone')->willReturn($timezone);\n\n $mockTeam = $this->createMock(Team::class);\n $mockUser->method('getTeam')->willReturn($mockTeam);\n\n $mockSearchRepository = $this->createMock(SearchRepository::class);\n $mockSearchRepository->method('findByUserOrderedByName')->willReturn(new Collection([]));\n\n $mockPromptService = $this->createMock(AskAnythingPromptService::class);\n $mockPromptService->method('get')->willReturn([]);\n\n $mockGroupRepository = $this->createMock(GroupRepository::class);\n $mockGroupRepository->method('getAllByTeam')->willReturn(new \\Illuminate\\Database\\Eloquent\\Collection([]));\n\n $mockRecipientsService = $this->createMock(RecipientsService::class);\n $mockRecipientsService->method('getRecipientsFieldData')->willReturn(['options' => []]);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $mockGroupRepository,\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $mockRecipientsService,\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $mockPromptService,\n $mockSearchRepository,\n $this->createMock(AskAnythingRepository::class),\n );\n\n $result = $service->getAskJiminnyReportFormData($mockUser);\n\n $this->assertArrayHasKey('fields', $result);\n $this->assertIsArray($result['fields']);\n\n $fieldIds = array_column($result['fields'], 'id');\n $this->assertContains('enabled', $fieldIds);\n $this->assertContains('report_name', $fieldIds);\n $this->assertContains('frequency', $fieldIds);\n $this->assertContains('expires_on', $fieldIds);\n $this->assertContains('saved_search', $fieldIds);\n $this->assertContains('ask_jiminny_prompt', $fieldIds);\n }\n\n public function testGetAskJiminnyReportFormDataWithReport(): void\n {\n $timezone = new \\DateTimeZone('UTC');\n\n $mockUser = $this->createMock(User::class);\n $mockUser->method('getTimezone')->willReturn($timezone);\n\n $mockTeam = $this->createMock(Team::class);\n $mockUser->method('getTeam')->willReturn($mockTeam);\n\n $mockSavedSearch = $this->createMock(Search::class);\n $mockSavedSearch->method('getUuid')->willReturn('search-uuid');\n $mockSavedSearch->method('getName')->willReturn('My Search');\n\n $mockPromptModel = $this->createMock(AskAnythingPrompt::class);\n $mockPromptModel->method('getUuid')->willReturn('prompt-uuid');\n $mockPromptModel->method('getTitle')->willReturn('My Prompt');\n\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getStatus')->willReturn(true);\n $mockReport->method('getCustomName')->willReturn('Test Report');\n $mockReport->method('getFrequency')->willReturn('daily');\n $mockReport->method('getExpiresAt')->willReturn(IlluminateCarbon::parse('2025-12-31'));\n $mockReport->method('getGroups')->willReturn([]);\n $mockReport->method('getRecipients')->willReturn(['users' => []]);\n $mockReport->method('getAttribute')->with('created_by')->willReturn(1);\n $mockReport->method('getSavedSearch')->willReturn($mockSavedSearch);\n $mockReport->method('getAskAnythingPrompt')->willReturn($mockPromptModel);\n\n $mockSearchRepository = $this->createMock(SearchRepository::class);\n $mockSearchRepository->method('findByUserOrderedByName')->willReturn(new Collection([]));\n\n $mockPromptService = $this->createMock(AskAnythingPromptService::class);\n $mockPromptService->method('get')->willReturn([]);\n\n $mockGroupRepository = $this->createMock(GroupRepository::class);\n $mockGroupRepository->method('getAllByTeam')->willReturn(new \\Illuminate\\Database\\Eloquent\\Collection([]));\n\n $mockRecipientsService = $this->createMock(RecipientsService::class);\n $mockRecipientsService->method('getRecipientsFieldData')->willReturn(['options' => []]);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $mockGroupRepository,\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $mockRecipientsService,\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $mockPromptService,\n $mockSearchRepository,\n $this->createMock(AskAnythingRepository::class),\n );\n\n $result = $service->getAskJiminnyReportFormData($mockUser, $mockReport);\n\n $fields = collect($result['fields'])->keyBy('id');\n\n $this->assertTrue($fields['enabled']['value']);\n $this->assertEquals('Test Report', $fields['report_name']['value']);\n }\n\n public function testValidateAskJiminnyReportDataMissingName(): void\n {\n $mockUser = $this->createMock(User::class);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(InvalidArgumentException::class);\n $this->expectExceptionMessage('Report name is required');\n\n $service->createAskJiminnyReport(['report_name' => ''], $mockUser);\n }\n\n public function testValidateAskJiminnyReportDataNameTooLong(): void\n {\n $mockUser = $this->createMock(User::class);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(InvalidArgumentException::class);\n $this->expectExceptionMessage('Report name must be 50 characters or less');\n\n $service->createAskJiminnyReport(['report_name' => str_repeat('a', 51)], $mockUser);\n }\n\n public function testValidateAskJiminnyReportDataInvalidFrequency(): void\n {\n $mockUser = $this->createMock(User::class);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(InvalidArgumentException::class);\n $this->expectExceptionMessage('Frequency must be daily, weekly, or monthly');\n\n $service->createAskJiminnyReport(['report_name' => 'Valid Name', 'frequency' => 'quarterly'], $mockUser);\n }\n\n public function testValidateAskJiminnyReportDataMissingExpiresOn(): void\n {\n $mockUser = $this->createMock(User::class);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(InvalidArgumentException::class);\n $this->expectExceptionMessage('Expiration date is required');\n\n $service->createAskJiminnyReport(\n ['report_name' => 'Valid Name', 'frequency' => 'daily'],\n $mockUser\n );\n }\n\n public function testValidateAskJiminnyReportDataExpiresInPast(): void\n {\n $mockUser = $this->createMock(User::class);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(InvalidArgumentException::class);\n $this->expectExceptionMessage('Expiration date cannot be in the past');\n\n $service->createAskJiminnyReport(\n ['report_name' => 'Valid Name', 'frequency' => 'daily', 'expires_on' => '2020-01-01'],\n $mockUser\n );\n }\n\n public function testValidateAskJiminnyReportDataExpiresTooFar(): void\n {\n $mockUser = $this->createMock(User::class);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(InvalidArgumentException::class);\n $this->expectExceptionMessage('Expiration date cannot be more than 1 year from now');\n\n $service->createAskJiminnyReport(\n ['report_name' => 'Valid Name', 'frequency' => 'daily', 'expires_on' => '2099-01-01'],\n $mockUser\n );\n }\n\n public function testValidateAskJiminnyReportDataExpiresExactlyOneYearLaterTimeOfDayIsAccepted(): void\n {\n Carbon::setTestNow(Carbon::parse('2026-04-20 09:00:00'));\n\n try {\n $mockUser = $this->createMock(User::class);\n $mockUser->method('getId')->willReturn(1);\n $mockUser->method('getTeamId')->willReturn(1);\n\n $savedSearch = $this->createMock(Search::class);\n $savedSearch->method('getId')->willReturn(10);\n\n $prompt = $this->createMock(AskAnythingPrompt::class);\n $prompt->method('getId')->willReturn(5);\n\n $activitySearchRepository = $this->createMock(SearchRepository::class);\n $activitySearchRepository->method('findByUuidAndUser')->willReturn($savedSearch);\n\n $askAnythingRepository = $this->createMock(AskAnythingRepository::class);\n $askAnythingRepository->method('getPromptByUuid')->willReturn($prompt);\n\n $automatedReportsRepository = $this->createMock(AutomatedReportsRepository::class);\n $automatedReportsRepository->method('create')->willReturn($this->createMock(AutomatedReport::class));\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $automatedReportsRepository,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $activitySearchRepository,\n $askAnythingRepository,\n );\n\n $service->createAskJiminnyReport([\n 'report_name' => 'Valid Name',\n 'frequency' => 'daily',\n 'expires_on' => '2027-04-20T23:00:00',\n 'saved_search' => 'some-uuid',\n 'ask_jiminny_prompt' => 'prompt-uuid',\n ], $mockUser);\n\n $this->assertTrue(true);\n } finally {\n Carbon::setTestNow();\n }\n }\n\n public function testValidateAskJiminnyReportDataMissingSavedSearch(): void\n {\n $mockUser = $this->createMock(User::class);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(InvalidArgumentException::class);\n $this->expectExceptionMessage('Saved search is required');\n\n $service->createAskJiminnyReport(\n ['report_name' => 'Valid Name', 'frequency' => 'daily', 'expires_on' => now()->addMonth()->toDateString()],\n $mockUser\n );\n }\n\n public function testValidateAskJiminnyReportDataSavedSearchNotFound(): void\n {\n $mockUser = $this->createMock(User::class);\n\n $mockSearchRepository = $this->createMock(SearchRepository::class);\n $mockSearchRepository->method('findByUuidAndUser')->willReturn(null);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $mockSearchRepository,\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(InvalidArgumentException::class);\n $this->expectExceptionMessage('Saved search not found or does not belong to you');\n\n $service->createAskJiminnyReport(\n [\n 'report_name' => 'Valid Name',\n 'frequency' => 'daily',\n 'expires_on' => now()->addMonth()->toDateString(),\n 'saved_search' => 'non-existent-uuid',\n ],\n $mockUser\n );\n }\n\n public function testValidateAskJiminnyReportDataMissingPrompt(): void\n {\n $mockUser = $this->createMock(User::class);\n\n $mockSearch = $this->createMock(Search::class);\n $mockSearchRepository = $this->createMock(SearchRepository::class);\n $mockSearchRepository->method('findByUuidAndUser')->willReturn($mockSearch);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $mockSearchRepository,\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(InvalidArgumentException::class);\n $this->expectExceptionMessage('Ask Jiminny prompt is required');\n\n $service->createAskJiminnyReport(\n [\n 'report_name' => 'Valid Name',\n 'frequency' => 'daily',\n 'expires_on' => now()->addMonth()->toDateString(),\n 'saved_search' => 'search-uuid',\n ],\n $mockUser\n );\n }\n\n public function testValidateAskJiminnyReportDataPromptNotFound(): void\n {\n $mockUser = $this->createMock(User::class);\n\n $mockSearch = $this->createMock(Search::class);\n $mockSearchRepository = $this->createMock(SearchRepository::class);\n $mockSearchRepository->method('findByUuidAndUser')->willReturn($mockSearch);\n\n $mockAskAnythingRepository = $this->createMock(AskAnythingRepository::class);\n $mockAskAnythingRepository->method('getPromptByUuid')->willReturn(null);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $mockSearchRepository,\n $mockAskAnythingRepository,\n );\n\n $this->expectException(InvalidArgumentException::class);\n $this->expectExceptionMessage('Ask Jiminny prompt not found');\n\n $service->createAskJiminnyReport(\n [\n 'report_name' => 'Valid Name',\n 'frequency' => 'daily',\n 'expires_on' => now()->addMonth()->toDateString(),\n 'saved_search' => 'search-uuid',\n 'ask_jiminny_prompt' => 'non-existent-prompt-uuid',\n ],\n $mockUser\n );\n }\n\n public function testTransformRecipientsWithNullUsers(): void\n {\n $reflection = new \\ReflectionClass(AutomatedReportsService::class);\n $method = $reflection->getMethod('transformRecipients');\n $method->setAccessible(true);\n\n $result = $method->invoke($this->service, []);\n\n $this->assertEquals([], $result);\n }\n\n public function testTransformRecipientsWithUsersKey(): void\n {\n $mockUser = $this->createMock(User::class);\n $mockUser->method('getUuid')->willReturn('user-uuid-1');\n $mockUser->method('getName')->willReturn('User One');\n $mockUser->method('getEmailAddress')->willReturn('user1@test.com');\n $mockUser->method('getPhotoUrl')->willReturn(null);\n\n $mockUserRepository = $this->createMock(UserRepository::class);\n $mockUserRepository->method('find')->willReturn($mockUser);\n\n $service = $this->getService(mockUserRepository: $mockUserRepository);\n\n $reflection = new \\ReflectionClass(AutomatedReportsService::class);\n $method = $reflection->getMethod('transformRecipients');\n $method->setAccessible(true);\n\n $result = $method->invoke($service, ['users' => [1]]);\n\n $this->assertCount(1, $result);\n $this->assertEquals('user-uuid-1', $result[0]['id']);\n }\n\n public function testGetTeamsGroupsOptions(): void\n {\n $mockTeamRepository = $this->createMock(TeamRepository::class);\n\n $mockTeam = $this->createMock(Team::class);\n $mockTeam->method('getUuid')->willReturn('team-uuid-1');\n $mockTeam->method('getName')->willReturn('Sales Team');\n $mockTeam->method('hasFeature')\n ->with(FeatureEnum::AUTOMATED_REPORTS)\n ->willReturn(true);\n\n $mockGroupsRelation = $this->createMock(HasMany::class);\n $mockGroupsRelation->method('get')->willReturn(new \\Illuminate\\Database\\Eloquent\\Collection([]));\n $mockTeam->method('groups')->willReturn($mockGroupsRelation);\n\n $mockTeamRepository->method('getTeamsForKiosk')->willReturn(new Collection([$mockTeam]));\n $mockTeamRepository->method('idOrUuid')->willReturn($mockTeam);\n\n $service = $this->getService(mockTeamRepository: $mockTeamRepository);\n\n $result = $service->getTeamsGroupsOptions();\n\n $this->assertCount(1, $result);\n $this->assertEquals('Sales Team', $result[0]['label']);\n $this->assertArrayHasKey('groups', $result[0]);\n }\n\n public function testGetTeamsGroupsOptionsWithFilter(): void\n {\n $mockTeamRepository = $this->createMock(TeamRepository::class);\n\n $mockTeam1 = $this->createMock(Team::class);\n $mockTeam1->method('getUuid')->willReturn('team-uuid-1');\n $mockTeam1->method('getName')->willReturn('Sales Team');\n $mockTeam1->method('hasFeature')->willReturn(true);\n\n $mockTeam2 = $this->createMock(Team::class);\n $mockTeam2->method('getUuid')->willReturn('team-uuid-2');\n $mockTeam2->method('getName')->willReturn('Marketing Team');\n $mockTeam2->method('hasFeature')->willReturn(true);\n\n $mockTeamRepository->method('getTeamsForKiosk')\n ->willReturn(new Collection([$mockTeam1, $mockTeam2]));\n\n $mockGroupsRelation = $this->createMock(HasMany::class);\n $mockGroupsRelation->method('get')->willReturn(new \\Illuminate\\Database\\Eloquent\\Collection([]));\n $mockTeam1->method('groups')->willReturn($mockGroupsRelation);\n\n $mockTeamRepository->method('idOrUuid')->willReturn($mockTeam1);\n\n $service = $this->getService(mockTeamRepository: $mockTeamRepository);\n\n $result = $service->getTeamsGroupsOptions(['team-uuid-1']);\n\n $this->assertCount(1, $result);\n $this->assertEquals('Sales Team', $result[0]['label']);\n }\n\n public function testGetReturnsTransformedReport(): void\n {\n $mockTeam = $this->createMock(Team::class);\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getType')->willReturn('exec_summary');\n $mockReport->method('getUuid')->willReturn('report-uuid');\n $mockReport->method('getFrequency')->willReturn('weekly');\n $mockReport->method('getTeam')->willReturn($mockTeam);\n $mockReport->method('getStatus')->willReturn(true);\n $mockReport->method('getFrom')->willReturn(null);\n $mockReport->method('getTo')->willReturn(null);\n $mockReport->method('getDealValueMin')->willReturn(null);\n $mockReport->method('getDealValueMax')->willReturn(null);\n $mockReport->method('getCallTypes')->willReturn([]);\n $mockReport->method('getMediaTypes')->willReturn([]);\n $mockReport->method('getCallDurationMin')->willReturn(null);\n $mockReport->method('getCallDurationMax')->willReturn(null);\n $mockReport->method('getGroups')->willReturn([]);\n $mockReport->method('getDealAtCallStages')->willReturn([]);\n $mockReport->method('getCurrentDealStages')->willReturn([]);\n $mockReport->method('getRecipients')->willReturn([]);\n $mockReport->method('getCreator')->willReturn(null);\n $mockReport->method('getAdditionalPromptInput')->willReturn(null);\n $mockReport->method('getCustomName')->willReturn('My Report');\n $mockReport->method('getCreatedAt')->willReturn(IlluminateCarbon::parse('2025-01-01'));\n $mockReport->method('getUpdatedAt')->willReturn(IlluminateCarbon::parse('2025-01-01'));\n $mockReport->method('getDeletedAt')->willReturn(null);\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->expects($this->once())\n ->method('findByUuid')\n ->with('report-uuid')\n ->willReturn($mockReport);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $result = $service->get('report-uuid');\n\n $this->assertIsArray($result);\n $this->assertEquals('report-uuid', $result['id']);\n }\n\n public function testGetThrowsWhenReportNotFound(): void\n {\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->method('findByUuid')->willReturn(null);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(ModelNotFoundException::class);\n\n $service->get('missing-uuid');\n }\n\n public function testListReturnsData(): void\n {\n $mockTeam = $this->createMock(Team::class);\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getType')->willReturn('exec_summary');\n $mockReport->method('getUuid')->willReturn('report-uuid');\n $mockReport->method('getFrequency')->willReturn('weekly');\n $mockReport->method('getTeam')->willReturn($mockTeam);\n $mockReport->method('getStatus')->willReturn(true);\n $mockReport->method('getFrom')->willReturn(null);\n $mockReport->method('getTo')->willReturn(null);\n $mockReport->method('getDealValueMin')->willReturn(null);\n $mockReport->method('getDealValueMax')->willReturn(null);\n $mockReport->method('getCallTypes')->willReturn([]);\n $mockReport->method('getMediaTypes')->willReturn([]);\n $mockReport->method('getCallDurationMin')->willReturn(null);\n $mockReport->method('getCallDurationMax')->willReturn(null);\n $mockReport->method('getGroups')->willReturn([]);\n $mockReport->method('getDealAtCallStages')->willReturn([]);\n $mockReport->method('getCurrentDealStages')->willReturn([]);\n $mockReport->method('getRecipients')->willReturn([]);\n $mockReport->method('getCreator')->willReturn(null);\n $mockReport->method('getAdditionalPromptInput')->willReturn(null);\n $mockReport->method('getCustomName')->willReturn('My Report');\n $mockReport->method('getCreatedAt')->willReturn(IlluminateCarbon::parse('2025-01-01'));\n $mockReport->method('getUpdatedAt')->willReturn(IlluminateCarbon::parse('2025-01-01'));\n $mockReport->method('getDeletedAt')->willReturn(null);\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->expects($this->once())\n ->method('getAllStandardReports')\n ->willReturn(new \\Illuminate\\Database\\Eloquent\\Collection([$mockReport]));\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $result = $service->list();\n\n $this->assertArrayHasKey('data', $result);\n $this->assertCount(1, $result['data']);\n }\n\n public function testListAskJiminnyReportsReturnsData(): void\n {\n $mockUser = $this->createMock(User::class);\n $mockTeam = $this->createMock(Team::class);\n\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getType')->willReturn('ask_jiminny');\n $mockReport->method('getUuid')->willReturn('report-uuid');\n $mockReport->method('getFrequency')->willReturn('daily');\n $mockReport->method('getTeam')->willReturn($mockTeam);\n $mockReport->method('getStatus')->willReturn(true);\n $mockReport->method('getGroups')->willReturn([]);\n $mockReport->method('getRecipients')->willReturn([]);\n $mockReport->method('getCustomName')->willReturn('AJ Report');\n $mockReport->method('getExpiresAt')->willReturn(null);\n $mockReport->method('getSavedSearch')->willReturn(null);\n $mockReport->method('getAskAnythingPrompt')->willReturn(null);\n $mockReport->method('getAttribute')->with('created_by')->willReturn(null);\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->expects($this->once())\n ->method('getAskJiminnyReportsByUser')\n ->with($mockUser, 'created_at', 'desc')\n ->willReturn(new \\Illuminate\\Database\\Eloquent\\Collection([$mockReport]));\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $result = $service->listAskJiminnyReports($mockUser);\n\n $this->assertArrayHasKey('data', $result);\n $this->assertCount(1, $result['data']);\n }\n\n public function testGetActivityTypesFieldDataDelegatesToService(): void\n {\n $mockTeam = $this->createMock(Team::class);\n $mockActivityTypeService = $this->createMock(ActivityTypeService::class);\n $mockActivityTypeService->expects($this->once())\n ->method('getActivityTypeFieldData')\n ->with(team: $mockTeam, value: ['a'], groupIds: ['g1'])\n ->willReturn(['id' => 'activity_types', 'options' => []]);\n\n $reflection = new \\ReflectionClass(AutomatedReportsService::class);\n $service = $reflection->newInstanceWithoutConstructor();\n $prop = $reflection->getProperty('activityTypeService');\n $prop->setAccessible(true);\n $prop->setValue($service, $mockActivityTypeService);\n\n $result = $service->getActivityTypesFieldData($mockTeam, ['a'], ['g1']);\n\n $this->assertEquals(['id' => 'activity_types', 'options' => []], $result);\n }\n\n public function testGetDealStageAtCallFieldDataDelegatesToService(): void\n {\n $mockTeam = $this->createMock(Team::class);\n $mockDealStagesService = $this->createMock(DealStagesService::class);\n $mockDealStagesService->expects($this->once())\n ->method('getDealStageAtCallFieldData')\n ->with(team: $mockTeam, value: [])\n ->willReturn(['id' => 'deal_stage_at_call']);\n\n $reflection = new \\ReflectionClass(AutomatedReportsService::class);\n $service = $reflection->newInstanceWithoutConstructor();\n $prop = $reflection->getProperty('dealStagesService');\n $prop->setAccessible(true);\n $prop->setValue($service, $mockDealStagesService);\n\n $result = $service->getDealStageAtCallFieldData($mockTeam);\n\n $this->assertEquals(['id' => 'deal_stage_at_call'], $result);\n }\n\n public function testGetCurrentDealStageFieldDataDelegatesToService(): void\n {\n $mockTeam = $this->createMock(Team::class);\n $mockDealStagesService = $this->createMock(DealStagesService::class);\n $mockDealStagesService->expects($this->once())\n ->method('getCurrentDealStageFieldData')\n ->with(team: $mockTeam, value: [])\n ->willReturn(['id' => 'current_deal_stage']);\n\n $reflection = new \\ReflectionClass(AutomatedReportsService::class);\n $service = $reflection->newInstanceWithoutConstructor();\n $prop = $reflection->getProperty('dealStagesService');\n $prop->setAccessible(true);\n $prop->setValue($service, $mockDealStagesService);\n\n $result = $service->getCurrentDealStageFieldData($mockTeam);\n\n $this->assertEquals(['id' => 'current_deal_stage'], $result);\n }\n\n public function testGetRecipientsFieldDataDelegatesToService(): void\n {\n $mockTeam = $this->createMock(Team::class);\n $mockRecipientsService = $this->createMock(RecipientsService::class);\n $mockRecipientsService->expects($this->once())\n ->method('getRecipientsFieldData')\n ->with(team: $mockTeam, value: [])\n ->willReturn(['id' => 'recipients']);\n\n $reflection = new \\ReflectionClass(AutomatedReportsService::class);\n $service = $reflection->newInstanceWithoutConstructor();\n $prop = $reflection->getProperty('recipientsService');\n $prop->setAccessible(true);\n $prop->setValue($service, $mockRecipientsService);\n\n $result = $service->getRecipientsFieldData($mockTeam);\n\n $this->assertEquals(['id' => 'recipients'], $result);\n }\n\n public function testGetJiminnyRecipientsFieldDataDelegatesToService(): void\n {\n $mockRecipientsService = $this->createMock(RecipientsService::class);\n $mockRecipientsService->expects($this->once())\n ->method('getJiminnyRecipientsFieldData')\n ->with(['user-1'])\n ->willReturn(['id' => 'jiminny_recipients']);\n\n $reflection = new \\ReflectionClass(AutomatedReportsService::class);\n $service = $reflection->newInstanceWithoutConstructor();\n $prop = $reflection->getProperty('recipientsService');\n $prop->setAccessible(true);\n $prop->setValue($service, $mockRecipientsService);\n\n $result = $service->getJiminnyRecipientsFieldData(['user-1']);\n\n $this->assertEquals(['id' => 'jiminny_recipients'], $result);\n }\n\n public function testCreateReportResultDelegatesToRepository(): void\n {\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getId')->willReturn(42);\n\n $mockResult = $this->createMock(AutomatedReportResult::class);\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->expects($this->once())\n ->method('createResult')\n ->willReturn($mockResult);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $result = $service->createReportResult($mockReport);\n\n $this->assertSame($mockResult, $result);\n }\n\n public function testDeleteReportResultDeletesS3AndModel(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getReport')->willReturn($this->createMock(AutomatedReport::class));\n $mockResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PDF);\n $mockResult->expects($this->once())->method('delete');\n\n $reflection = new \\ReflectionClass(AutomatedReportsService::class);\n $service = $reflection->newInstanceWithoutConstructor();\n\n foreach ([\n 'teamRepository' => TeamRepository::class,\n 'groupRepository' => GroupRepository::class,\n 'userRepository' => UserRepository::class,\n 'stageRepository' => StageRepository::class,\n 'dealStagesService' => DealStagesService::class,\n 'recipientsService' => RecipientsService::class,\n 'automatedReportsRepository' => AutomatedReportsRepository::class,\n 'webhookService' => Webhook::class,\n 'dispatcher' => Dispatcher::class,\n 'activityTypeService' => ActivityTypeService::class,\n 'playbookCategoryRepository' => PlaybookCategoryRepository::class,\n 'askAnythingPromptService' => AskAnythingPromptService::class,\n 'activitySearchRepository' => SearchRepository::class,\n 'askAnythingRepository' => AskAnythingRepository::class,\n ] as $propName => $class) {\n $prop = $reflection->getProperty($propName);\n $prop->setAccessible(true);\n $prop->setValue($service, $this->createMock($class));\n }\n\n Storage::shouldReceive('exists')->andReturn(false);\n Log::shouldReceive('info')->zeroOrMoreTimes();\n\n $service->deleteReportResult($mockResult);\n }\n\n public function testDeleteAllReportResultsIteratesAndDeletes(): void\n {\n $mockResult1 = $this->createMock(AutomatedReportResult::class);\n $mockResult1->method('getId')->willReturn(1);\n $mockResult1->method('getReport')->willReturn($this->createMock(AutomatedReport::class));\n $mockResult1->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PDF);\n $mockResult1->expects($this->once())->method('delete');\n\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getId')->willReturn(10);\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->expects($this->once())\n ->method('getResultsByReport')\n ->with($mockReport)\n ->willReturn(new \\Illuminate\\Database\\Eloquent\\Collection([$mockResult1]));\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n Storage::shouldReceive('exists')->andReturn(false);\n Log::shouldReceive('info')->zeroOrMoreTimes();\n\n $service->deleteAllReportResults($mockReport);\n }\n\n public function testDeleteAllDataDeletesReportsAndResults(): void\n {\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getId')->willReturn(1);\n $mockResult->method('getReport')->willReturn($this->createMock(AutomatedReport::class));\n $mockResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PDF);\n $mockResult->expects($this->once())->method('delete');\n\n $mockReport = $this->createMock(AutomatedReport::class);\n $mockReport->method('getId')->willReturn(10);\n $mockReport->expects($this->once())->method('delete');\n\n $mockTeam = $this->createMock(Team::class);\n $mockTeam->method('getId')->willReturn(1);\n\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->expects($this->once())\n ->method('getReportsByTeam')\n ->with($mockTeam)\n ->willReturn(new \\Illuminate\\Database\\Eloquent\\Collection([$mockReport]));\n $mockRepo->expects($this->once())\n ->method('getResultsByReport')\n ->with($mockReport)\n ->willReturn(new \\Illuminate\\Database\\Eloquent\\Collection([$mockResult]));\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n Storage::shouldReceive('exists')->andReturn(false);\n Log::shouldReceive('info')->zeroOrMoreTimes();\n\n $service->deleteAllData($mockTeam);\n }\n\n public function testDeleteReportResultsThrowsWhenReportNotFound(): void\n {\n $mockRepo = $this->createMock(AutomatedReportsRepository::class);\n $mockRepo->method('findByUuid')->willReturn(null);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $this->createMock(UserRepository::class),\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $mockRepo,\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $this->expectException(ModelNotFoundException::class);\n\n $service->deleteReportResults('missing-uuid');\n }\n\n public function testGetValidRecipientUsersAskJiminnyIncludesCreator(): void\n {\n $tz = $this->createMock(\\DateTimeZone::class);\n $tz->method('getName')->willReturn('UTC');\n\n $creator = $this->createMock(User::class);\n $creator->method('getEmailAddress')->willReturn('creator@test.com');\n $creator->method('getName')->willReturn('Creator');\n $creator->method('getTimezone')->willReturn($tz);\n\n $mockUserRepository = $this->createMock(UserRepository::class);\n $mockUserRepository->method('find')->willReturn($creator);\n\n $mockGroupRepository = $this->createMock(GroupRepository::class);\n $mockGroupRepository->method('find')->willReturn(null);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $mockGroupRepository,\n $mockUserRepository,\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('isAskJiminnyReport')->willReturn(true);\n $report->method('getCreator')->willReturn($creator);\n $report->method('getRecipients')->willReturn(['users' => []]);\n $report->method('getGroups')->willReturn([]);\n\n $result = $service->getValidRecipientUsers($report);\n\n $this->assertCount(1, $result);\n $this->assertEquals('creator@test.com', $result[0]['email']);\n }\n\n public function testGetValidRecipientUsersAskJiminnyDeduplicatesCreatorAndExplicitRecipient(): void\n {\n $tz = $this->createMock(\\DateTimeZone::class);\n $tz->method('getName')->willReturn('UTC');\n\n $creator = $this->createMock(User::class);\n $creator->method('getEmailAddress')->willReturn('shared@test.com');\n $creator->method('getName')->willReturn('Creator');\n $creator->method('getTimezone')->willReturn($tz);\n\n $mockUserRepository = $this->createMock(UserRepository::class);\n $mockUserRepository->method('find')->willReturn($creator);\n\n $mockGroupRepository = $this->createMock(GroupRepository::class);\n $mockGroupRepository->method('find')->willReturn(null);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $mockGroupRepository,\n $mockUserRepository,\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('isAskJiminnyReport')->willReturn(true);\n $report->method('getCreator')->willReturn($creator);\n $report->method('getRecipients')->willReturn(['users' => [1]]);\n $report->method('getGroups')->willReturn([]);\n\n $result = $service->getValidRecipientUsers($report);\n\n $this->assertCount(1, $result);\n $this->assertEquals('shared@test.com', $result[0]['email']);\n }\n\n public function testGetValidRecipientUsersAskJiminnyIncludesGroupMembers(): void\n {\n $tz = $this->createMock(\\DateTimeZone::class);\n $tz->method('getName')->willReturn('UTC');\n\n $creator = $this->createMock(User::class);\n $creator->method('getEmailAddress')->willReturn('creator@test.com');\n $creator->method('getName')->willReturn('Creator');\n $creator->method('getTimezone')->willReturn($tz);\n\n $member = $this->createMock(User::class);\n $member->method('getEmailAddress')->willReturn('member@test.com');\n $member->method('getName')->willReturn('Member');\n $member->method('getTimezone')->willReturn($tz);\n\n $mockUserRepository = $this->createMock(UserRepository::class);\n $mockUserRepository->method('find')->willReturn($creator);\n\n $mockGroup = $this->createMock(Group::class);\n $mockGroup->method('getMembers')->willReturn(new \\Illuminate\\Database\\Eloquent\\Collection([$member]));\n\n $mockGroupRepository = $this->createMock(GroupRepository::class);\n $mockGroupRepository->method('find')->willReturn($mockGroup);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $mockGroupRepository,\n $mockUserRepository,\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('isAskJiminnyReport')->willReturn(true);\n $report->method('getCreator')->willReturn($creator);\n $report->method('getRecipients')->willReturn(['users' => []]);\n $report->method('getGroups')->willReturn([10]);\n\n $result = $service->getValidRecipientUsers($report);\n\n $this->assertCount(2, $result);\n $emails = array_column($result, 'email');\n $this->assertContains('creator@test.com', $emails);\n $this->assertContains('member@test.com', $emails);\n }\n\n public function testGetValidRecipientUsersAskJiminnyNullCreatorSkipped(): void\n {\n $tz = $this->createMock(\\DateTimeZone::class);\n $tz->method('getName')->willReturn('UTC');\n\n $shareUser = $this->createMock(User::class);\n $shareUser->method('getEmailAddress')->willReturn('shared@test.com');\n $shareUser->method('getName')->willReturn('Shared');\n $shareUser->method('getTimezone')->willReturn($tz);\n\n $mockUserRepository = $this->createMock(UserRepository::class);\n $mockUserRepository->method('find')->willReturnMap([\n [1, null],\n [2, $shareUser],\n ]);\n\n $mockGroupRepository = $this->createMock(GroupRepository::class);\n $mockGroupRepository->method('find')->willReturn(null);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $mockGroupRepository,\n $mockUserRepository,\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('isAskJiminnyReport')->willReturn(true);\n $report->method('getCreator')->willReturn(null);\n $report->method('getRecipients')->willReturn(['users' => [2]]);\n $report->method('getGroups')->willReturn([]);\n\n $result = $service->getValidRecipientUsers($report);\n\n $this->assertCount(1, $result);\n $this->assertEquals('shared@test.com', $result[0]['email']);\n }\n\n public function testGetValidRecipientUsersStandardReportDoesNotIncludeCreator(): void\n {\n $tz = $this->createMock(\\DateTimeZone::class);\n $tz->method('getName')->willReturn('UTC');\n\n $user = $this->createMock(User::class);\n $user->method('getEmailAddress')->willReturn('user@test.com');\n $user->method('getName')->willReturn('User');\n $user->method('getTimezone')->willReturn($tz);\n\n $mockUserRepository = $this->createMock(UserRepository::class);\n $mockUserRepository->method('find')->willReturn($user);\n\n $service = new AutomatedReportsService(\n $this->createMock(TeamRepository::class),\n $this->createMock(GroupRepository::class),\n $mockUserRepository,\n $this->createMock(StageRepository::class),\n $this->createMock(DealStagesService::class),\n $this->createMock(RecipientsService::class),\n $this->createMock(AutomatedReportsRepository::class),\n $this->createMock(Webhook::class),\n $this->createMock(Dispatcher::class),\n $this->createMock(ActivityTypeService::class),\n $this->createMock(PlaybookCategoryRepository::class),\n $this->createMock(AskAnythingPromptService::class),\n $this->createMock(SearchRepository::class),\n $this->createMock(AskAnythingRepository::class),\n );\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('isAskJiminnyReport')->willReturn(false);\n $report->method('getRecipients')->willReturn(['users' => [5]]);\n $report->method('getJiminnyRecipients')->willReturn(['users' => []]);\n $report->method('getGroups')->willReturn([]);\n\n $result = $service->getValidRecipientUsers($report);\n\n $this->assertCount(1, $result);\n $this->assertEquals('user@test.com', $result[0]['email']);\n }\n\n public function testGetReportPeriodNameAskJiminnyMonthlyFallback(): void\n {\n Carbon::setTestNow(Carbon::parse('2026-03-07 00:00:00'));\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getFrequency')->willReturn('monthly');\n $report->method('isAskJiminnyReport')->willReturn(true);\n\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getReport')->willReturn($report);\n $mockResult->method('getFromDate')->willReturn(null);\n $mockResult->method('getToDate')->willReturn(null);\n\n $result = $this->service->getReportPeriodName($mockResult);\n\n $this->assertMatchesRegularExpression('/^[A-Z][a-z]+ \\d{4}$/', $result);\n $this->assertStringContainsString('2026', $result);\n\n Carbon::setTestNow();\n }\n\n public function testGetReportPeriodNameAskJiminnyWeeklyFallback(): void\n {\n Carbon::setTestNow(Carbon::parse('2026-04-07 00:00:00'));\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getFrequency')->willReturn('weekly');\n $report->method('isAskJiminnyReport')->willReturn(true);\n\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getReport')->willReturn($report);\n $mockResult->method('getFromDate')->willReturn(null);\n $mockResult->method('getToDate')->willReturn(null);\n\n $result = $this->service->getReportPeriodName($mockResult);\n\n $this->assertStringContainsString(' - ', $result);\n $this->assertStringContainsString('2026', $result);\n\n Carbon::setTestNow();\n }\n\n public function testGetReportPeriodNameAskJiminnyDailyFallback(): void\n {\n Carbon::setTestNow(Carbon::parse('2026-04-07 00:00:00'));\n\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getFrequency')->willReturn('daily');\n $report->method('isAskJiminnyReport')->willReturn(true);\n\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getReport')->willReturn($report);\n $mockResult->method('getFromDate')->willReturn(null);\n $mockResult->method('getToDate')->willReturn(null);\n\n $result = $this->service->getReportPeriodName($mockResult);\n\n $this->assertStringNotContainsString(' - ', $result);\n $this->assertStringContainsString('2026', $result);\n\n Carbon::setTestNow();\n }\n\n public function testGetReportPeriodNameAskJiminnyWithExplicitDates(): void\n {\n $report = $this->createMock(AutomatedReport::class);\n $report->method('getFrequency')->willReturn('monthly');\n $report->method('isAskJiminnyReport')->willReturn(true);\n\n $mockResult = $this->createMock(AutomatedReportResult::class);\n $mockResult->method('getReport')->willReturn($report);\n $mockResult->method('getFromDate')->willReturn(IlluminateCarbon::parse('2026-02-07'));\n $mockResult->method('getToDate')->willReturn(IlluminateCarbon::parse('2026-03-07'));\n\n $result = $this->service->getReportPeriodName($mockResult);\n\n $this->assertEquals('Feb 2026', $result);\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-8009497465838817994
|
-3718731456383698967
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsServiceTest
Run 'AutomatedReportsServiceTest'
Debug 'AutomatedReportsServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
10
90
59
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Tests\Unit\Services\Kiosk\AutomatedReports;
use Carbon\Carbon;
use Illuminate\Support\Carbon as IlluminateCarbon;
use Illuminate\Contracts\Bus\Dispatcher;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Jiminny\Component\AskAnything\AskAnythingPromptService;
use Jiminny\Component\AskAnything\Dtos\AskAnythingPromptDto;
use Jiminny\Component\UrlGenerator\Webhook;
use Jiminny\Contracts\Repositories\PlaybookCategoryRepository;
use Jiminny\Contracts\Repositories\TeamRepository;
use Jiminny\Contracts\Repositories\UserRepository;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Exceptions\ModelNotFoundException;
use Illuminate\Support\Collection;
use Jiminny\Models\AskAnything\AskAnythingPrompt;
use Jiminny\Models\AskAnything\AskAnythingPromptTarget;
use Jiminny\Models\Activity\Search;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Group;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AskAnythingRepository;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Repositories\GroupRepository;
use Jiminny\Repositories\SearchRepository;
use Jiminny\Repositories\StageRepository;
use Jiminny\Services\Kiosk\AutomatedReports\ActivityTypeService;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\Kiosk\AutomatedReports\DealStagesService;
use Jiminny\Services\Kiosk\AutomatedReports\RecipientsService;
use Mockery;
use PHPUnit\Framework\Attributes\DataProvider;
use Tests\TestCase;
class AutomatedReportsServiceTest extends TestCase
{
private AutomatedReportsService $service;
protected function setUp(): void
{
parent::setUp();
// Create a real instance of the service without calling the constructor
$reflection = new \ReflectionClass(AutomatedReportsService::class);
$this->service = $reflection->newInstanceWithoutConstructor();
// Manually set the dependencies using reflection
$dependencies = [
'teamRepository' => TeamRepository::class,
'groupRepository' => GroupRepository::class,
'userRepository' => UserRepository::class,
'stageRepository' => StageRepository::class,
'dealStagesService' => DealStagesService::class,
'recipientsService' => RecipientsService::class,
'automatedReportsRepository' => AutomatedReportsRepository::class,
'webhookService' => Webhook::class,
'dispatcher' => Dispatcher::class,
'activityTypeService' => ActivityTypeService::class,
'playbookCategoryRepository' => PlaybookCategoryRepository::class,
'askAnythingPromptService' => AskAnythingPromptService::class,
'activitySearchRepository' => SearchRepository::class,
'askAnythingRepository' => AskAnythingRepository::class,
];
foreach ($dependencies as $propertyName => $class) {
$property = $reflection->getProperty($propertyName);
$property->setAccessible(true);
$property->setValue($this->service, $this->createMock($class));
}
}
protected function tearDown(): void
{
parent::tearDown();
Mockery::close();
}
private function getService(
$mockUserRepository = null,
$mockStageRepository = null,
$mockTeamRepository = null,
): AutomatedReportsService {
return new AutomatedReportsService(
($mockTeamRepository ?? $this->createMock(TeamRepository::class)),
$this->createMock(GroupRepository::class),
($mockUserRepository ?? $this->createMock(UserRepository::class)),
($mockStageRepository ?? $this->createMock(StageRepository::class)),
$this->createMock(DealStagesService::class),
$this->createMock(RecipientsService::class),
$this->createMock(AutomatedReportsRepository::class),
$this->createMock(Webhook::class),
$this->createMock(Dispatcher::class),
$this->createMock(ActivityTypeService::class),
$this->createMock(PlaybookCategoryRepository::class),
$this->createMock(AskAnythingPromptService::class),
$this->createMock(SearchRepository::class),
$this->createMock(AskAnythingRepository::class),
);
}
#[DataProvider('transformMediaTypesDataProvider')]
public function testTransformMediaTypes(array $mediaTypes, array $expected): void
{
$report = new AutomatedReport(['media_types' => $mediaTypes]);
$reflection = new \ReflectionClass(AutomatedReportsService::class);
$method = $reflection->getMethod('transformMediaTypes');
$result = $method->invoke($this->service, $report);
$this->assertEquals($expected, $result);
}
public function testGetMediaTypeFieldDataWithoutReport(): void
{
$result = $this->service->getMediaTypeFieldData(null);
$this->assertIsArray($result);
$this->assertArrayHasKey('value', $result);
$this->assertEmpty($result['value']);
$this->assertEquals('media_types', $result['id']);
}
public function testGetMediaTypeFieldDataWithReport(): void
{
$mediaTypes = ['pdf', 'podcast'];
$report = new AutomatedReport(['media_types' => $mediaTypes]);
$result = $this->service->getMediaTypeFieldData($report);
$expectedValue = [
['id' => 'pdf', 'name' => 'PDF'],
['id' => 'podcast', 'name' => 'Podcast'],
];
$this->assertIsArray($result);
$this->assertArrayHasKey('value', $result);
$this->assertEquals($expectedValue, $result['value']);
}
public static function transformMediaTypesDataProvider(): array
{
return [
'empty array' => [
'mediaTypes' => [],
'expected' => [],
],
'pdf only' => [
'mediaTypes' => ['pdf'],
'expected' => [
['id' => 'pdf', 'name' => 'PDF'],
],
],
'podcast only' => [
'mediaTypes' => ['podcast'],
'expected' => [
['id' => 'podcast', 'name' => 'Podcast'],
],
],
'both pdf and podcast' => [
'mediaTypes' => ['pdf', 'podcast'],
'expected' => [
['id' => 'pdf', 'name' => 'PDF'],
['id' => 'podcast', 'name' => 'Podcast'],
],
],
'with invalid type' => [
'mediaTypes' => ['pdf', 'invalid', 'podcast'],
'expected' => [
['id' => 'pdf', 'name' => 'PDF'],
['id' => 'podcast', 'name' => 'Podcast'],
],
],
];
}
#[DataProvider('hasCallTypeConferenceDataProvider')]
public function testHasCallTypeConference(array $callTypes, bool $expected): void
{
$report = $this->createMock(AutomatedReport::class);
$report->method('getCallTypes')->willReturn($callTypes);
$result = $this->service->hasCallTypeConference($report);
$this->assertEquals($expected, $result);
}
#[DataProvider('hasCallTypeDialerDataProvider')]
public function testHasCallTypeDialer(array $callTypes, bool $expected): void
{
$report = $this->createMock(AutomatedReport::class);
$report->method('getCallTypes')->willReturn($callTypes);
$result = $this->service->hasCallTypeDialer($report);
$this->assertEquals($expected, $result);
}
public static function hasCallTypeConferenceDataProvider(): array
{
return [
'has conference' => [
'callTypes' => ['conference', 'dialer'],
'expected' => true,
],
'does not have conference' => [
'callTypes' => ['dialer', 'other'],
'expected' => false,
],
'empty call types' => [
'callTypes' => [],
'expected' => false,
],
];
}
public static function hasCallTypeDialerDataProvider(): array
{
return [
'has dialer' => [
'callTypes' => ['conference', 'dialer'],
'expected' => true,
],
'does not have dialer' => [
'callTypes' => ['conference', 'other'],
'expected' => false,
],
'empty call types' => [
'callTypes' => [],
'expected' => false,
],
];
}
public function testTransformReportResultsWithEmptyCollection(): void
{
$emptyCollection = new Collection([]);
$result = $this->service->transformReportResults($emptyCollection);
$this->assertIsArray($result);
$this->assertEmpty($result);
}
public function testTransformReportResultsStructure(): void
{
// Create a mock AutomatedReportResult with minimal setup to test structure
$mockReportResult = $this->createMockReportResult();
$collection = new Collection([$mockReportResult]);
$result = $this->service->transformReportResults($collection);
$this->assertIsArray($result);
$this->assertCount(1, $result);
$transformedResult = $result[0];
// Verify all expected keys are present
$expectedKeys = [
'id', 'name', 'frequency', 'recipients',
'report_type', 'media_type', 'downloadUrl', 'viewUrl', 'generated_at',
];
foreach ($expectedKeys as $key) {
$this->assertArrayHasKey($key, $transformedResult);
}
// Verify structure of nested arrays
$this->assertIsArray($transformedResult['frequency']);
$this->assertArrayHasKey('id', $transformedResult['frequency']);
$this->assertArrayHasKey('name', $transformedResult['frequency']);
$this->assertIsArray($transformedResult['report_type']);
$this->assertArrayHasKey('id', $transformedResult['report_type']);
$this->assertArrayHasKey('name', $transformedResult['report_type']);
$this->assertIsArray($transformedResult['recipients']);
// Verify TODO fields are null as expected
$this->assertEquals(AutomatedReportsService::MEDIA_TYPE_PODCAST, $transformedResult['media_type']);
$this->assertEquals(route('ai-reports.audio.download', ['uuid' => 'test-uuid']), $transformedResult['downloadUrl']);
$this->assertEquals(route('ai-reports.audio.view', ['uuid' => 'test-uuid']), $transformedResult['viewUrl']);
}
public function testTransformReportResultsWithMultipleResults(): void
{
$mockReportResult1 = $this->createMockReportResult('result-uuid-1', 'exec_summary');
$mockReportResult2 = $this->createMockReportResult('result-uuid-2', 'coaching_profiles');
$collection = new Collection([$mockReportResult1, $mockReportResult2]);
$result = $this->service->transformReportResults($collection);
$this->assertIsArray($result);
$this->assertCount(2, $result);
// Verify different UUIDs
$this->assertEquals('result-uuid-1', $result[0]['id']);
$this->assertEquals('result-uuid-2', $result[1]['id']);
// Verify both results have the expected structure
foreach ($result as $transformedResult) {
$this->assertArrayHasKey('id', $transformedResult);
$this->assertArrayHasKey('name', $transformedResult);
$this->assertArrayHasKey('frequency', $transformedResult);
$this->assertArrayHasKey('recipients', $transformedResult);
$this->assertArrayHasKey('report_type', $transformedResult);
}
}
#[DataProvider('isUserRecipientOfReportDataProvider')]
public function testIsUserRecipientOfReport(int $userId, array $recipients, bool $expected): void
{
// Create mock User
$mockUser = $this->createMock(\Jiminny\Models\User::class);
$mockUser->method('getId')->willReturn($userId);
// Create mock AutomatedReport
$mockReport = $this->createMock(AutomatedReport::class);
$mockReport->method('getRecipients')->willReturn($recipients);
$result = $this->service->isUserRecipientOfReport($mockUser, $mockReport);
$this->assertEquals($expected, $result);
}
public function testIsUserRecipientOfReportWithEmptyRecipients(): void
{
// Create mock User
$mockUser = $this->createMock(\Jiminny\Models\User::class);
$mockUser->method('getId')->willReturn(123);
// Create mock AutomatedReport with no recipients
$mockReport = $this->createMock(AutomatedReport::class);
$mockReport->method('getRecipients')->willReturn([]);
$result = $this->service->isUserRecipientOfReport($mockUser, $mockReport);
$this->assertFalse($result);
}
public function testIsUserRecipientOfReportWithNoUsersKey(): void
{
// Create mock User
$mockUser = $this->createMock(\Jiminny\Models\User::class);
$mockUser->method('getId')->willReturn(123);
// Create mock AutomatedReport with recipients but no 'users' key
$mockReport = $this->createMock(AutomatedReport::class);
$mockReport->method('getRecipients')->willReturn(['other_key' => [456, 789]]);
$result = $this->service->isUserRecipientOfReport($mockUser, $mockReport);
$this->assertFalse($result);
}
public static function isUserRecipientOfReportDataProvider(): array
{
return [
'user is recipient - single user' => [
'userId' => 123,
'recipients' => ['users' => [123]],
'expected' => true,
],
'user is recipient - multiple users' => [
'userId' => 456,
'recipients' => ['users' => [123, 456, 789]],
'expected' => true,
],
'user is not recipient - single user' => [
'userId' => 999,
'recipients' => ['users' => [123]],
'expected' => false,
],
'user is not recipient - multiple users' => [
'userId' => 999,
'recipients' => ['users' => [123, 456, 789]],
'expected' => false,
],
'user is recipient - string IDs converted to int' => [
'userId' => 123,
'recipients' => ['users' => ['123', '456']],
'expected' => true,
],
'user is not recipient - string IDs converted to int' => [
'userId' => 999,
'recipients' => ['users' => ['123', '456']],
'expected' => false,
],
'empty users array' => [
'userId' => 123,
'recipients' => ['users' => []],
'expected' => false,
],
];
}
private function createMockReportResult(string $uuid = 'test-uuid', string $reportType = 'exec_summary'): AutomatedReportResult
{
// Create mock AutomatedReport
$mockReport = $this->createMock(AutomatedReport::class);
$mockReport->method('getFrequency')->willReturn('weekly');
$mockReport->method('getRecipients')->willReturn(['users' => [1, 2]]);
$mockReport->method('getGroups')->willReturn([10, 20]);
$mockReport->method('getType')->willReturn($reportType);
// Create mock Team
$mockTeam = $this->createMock(\Jiminny\Models\Team::class);
// Create mock Group
$mockGroup = $this->createMock(\Jiminny\Models\Group::class);
$mockGroup->method('getUuid')->willReturn('group-uuid-10');
$mockGroup->method('getName')->willReturn('Test Team');
$mockQueryBuilder = Mockery::mock();
$mockQueryBuilder->shouldReceive('where')->andReturnSelf();
$mockQueryBuilder->shouldReceive('first')->andReturn($mockGroup);
$dataRelation = Mockery::mock(HasMany::class);
$dataRelation->shouldReceive('where')->andReturn($mockQueryBuilder);
$dataRelation->shouldReceive('get')->andReturn(
new \Illuminate\Database\Eloquent\Collection([$mockGroup])
);
$mockTeam->method('groups')->willReturn($dataRelation);
$mockReport->method('getTeam')->willReturn($mockTeam);
// Create mock AutomatedReportResult
$mockReportResult = $this->createMock(AutomatedReportResult::class);
$mockReportResult->method('getUuid')->willReturn($uuid);
$mockReportResult->method('getGeneratedAt')->willReturn(
\Illuminate\Support\Carbon::parse('2024-01-15T10:30:00Z')
);
$mockReportResult->method('getReport')->willReturn($mockReport);
// Mock methods used in getReportFileName
$mockReportResult->method('getReportType')->willReturn($reportType);
$mockReportResult->method('getFromDate')->willReturn(
\Illuminate\Support\Carbon::parse('2024-01-08')
);
$mockReportResult->method('getToDate')->willReturn(
\Illuminate\Support\Carbon::parse('2024-01-15')
);
$mockReportResult->method('getGroups')->willReturn([10]);
$mockReportResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PODCAST);
return $mockReportResult;
}
#[DataProvider('getUsersUuidsDataProvider')]
public function testGetUsersUuids(array $recipients, array $mockUsers, array $expectedUuids): void
{
// Create mock UserRepository
$mockUserRepository = $this->createMock(UserRepository::class);
// Configure the mock to return specific users for specific IDs using a callback
$mockUserRepository->method('find')
->willReturnCallback(function ($userId) use ($mockUsers) {
if (! isset($mockUsers[$userId])) {
return null;
}
$userUuid = $mockUsers[$userId]['uuid'] ?? null;
if ($userUuid === null) {
return null;
}
$mockUser = $this->createMock(\Jiminny\Models\User::class);
$mockUser->method('getUuid')->willReturn((string) $userUuid);
return $mockUser;
});
// Create service with mocked UserRepository
$automatedReportsService = $this->getService(mockUserRepository: $mockUserRepository);
// Create mock AutomatedReport
$mockReport = $this->createMock(AutomatedReport::class);
$mockReport->method('getRecipients')->willReturn($recipients);
$result = $automatedReportsService->getUsersUuids($mockReport);
$this->assertEquals($expectedUuids, $result);
}
public function testGetUsersUuidsWithEmptyRecipients(): void
{
// Create mock AutomatedReport with empty recipients
$mockReport = $this->createMock(AutomatedReport::class);
$mockReport->method('getRecipients')->willReturn([]);
$result = $this->service->getUsersUuids($mockReport);
$this->assertEquals([], $result);
}
public function testGetUsersUuidsWithNoUsersKey(): void
{
// Create mock AutomatedReport with recipients but no 'users' key
$mockReport = $this->createMock(AutomatedReport::class);
$mockReport->method('getRecipients')->willReturn(['other_key' => [1, 2, 3]]);
$result = $this->service->getUsersUuids($mockReport);
$this->assertEquals([], $result);
}
public function testGetUsersUuidsWithNonExistentUsers(): void
{
// Create mock UserRepository that returns null for all users
$mockUserRepository = $this->createMock(UserRepository::class);
$mockUserRepository->method('find')->willReturn(null);
// Create service with mocked UserRepository
$automatedReportsService = $this->getService(mockUserRepository: $mockUserRepository);
// Create mock AutomatedReport
$mockReport = $this->createMock(AutomatedReport::class);
$mockReport->method('getRecipients')->willReturn(['users' => [1, 2, 3]]);
$result = $automatedReportsService->getUsersUuids($mockReport);
// Should return array with null values for non-existent users
$this->assertEquals([], $result);
}
public static function getUsersUuidsDataProvider(): array
{
return [
'single user found' => [
'recipients' => ['users' => [123]],
'mockUsers' => [
123 => ['id' => 123, 'uuid' => 'user-uuid-123'],
],
'expectedUuids' => ['user-uuid-123'],
],
'multiple users found' => [
'recipients' => ['users' => [123, 456, 789]],
'mockUsers' => [
123 => ['id' => 123, 'uuid' => 'user-uuid-123'],
456 => ['id' => 456, 'uuid' => 'user-uuid-456'],
789 => ['id' => 789, 'uuid' => 'user-uuid-789'],
],
'expectedUuids' => ['user-uuid-123', 'user-uuid-456', 'user-uuid-789'],
],
'mixed found and not found users' => [
'recipients' => ['users' => [123, 456, 789]],
'mockUsers' => [
123 => ['id' => 123, 'uuid' => 'user-uuid-123'],
// 456 not found in DB
789 => ['id' => 789, 'uuid' => 'user-uuid-789'],
],
'expectedUuids' => ['user-uuid-123', 'user-uuid-789'], // Updated to reflect that nulls are filtered out
],
'empty users array' => [
'recipients' => ['users' => []],
'mockUsers' => [],
'expectedUuids' => [],
],
'all users not found' => [
'recipients' => ['users' => [123, 456]],
'mockUsers' => [], // No users found
'expectedUuids' => [], // Updated to reflect that nulls are filtered out
],
];
}
#[DataProvider('getCurrentDealStagesUuidsDataProvider')]
public function testGetCurrentDealStagesUuids(array $currentDealStages, array $mockStages, array $expectedUuids): void
{
// Create mock StageRepository
$mockStageRepository = $this->createMock(StageRepository::class);
// Configure the mock to return specific stages for specific IDs using a callback
$mockStageRepository->method('find')
->willReturnCallback(function ($stageId) use ($mockStages) {
if (! isset($mockStages[$stageId])) {
return null;
}
$stageUuid = $mockStages[$stageId]['uuid'] ?? null;
if ($stageUuid === null) {
return null;
}
$mockStage = $this->createMock(\Jiminny\Models\Stage::class);
$mockStage->method('getUuid')->willReturn((string) $stageUuid);
return $mockStage;
});
// Create service with mocked StageRepository
$automatedReportsService = $this->getService(mockStageRepository: $mockStageRepository);
// Create mock AutomatedReport
$mockReport = $this->createMock(AutomatedReport::class);
$mockReport->method('getCurrentDealStages')->willReturn($currentDealStages);
$result = $automatedReportsService->getCurrentDealStagesUuids($mockReport);
$this->assertEquals($expectedUuids, $result);
}
public function testGetCurrentDealStagesUuidsWithEmptyStages(): void
{
// Create mock AutomatedReport with empty current deal stages
$mockReport = $this->createMock(AutomatedReport::class);
$mockReport->method('getCurrentDealStages')->willReturn([]);
$result = $this->service->getCurrentDealStagesUuids($mockReport);
$this->assertEquals([], $result);
}
public function testGetCurrentDealStagesUuidsWithNonExistentStages(): void
{
// Create mock StageRepository that returns null for all stages
$mockStageRepository = $this->createMock(StageRepository::class);
$mockStageRepository->method('find')->willReturn(null);
// Create service with mocked StageRepository
$automatedReportsService = $this->getService(mockStageRepository: $mockStageRepository);
// Create mock AutomatedReport
$mockReport = $this->createMock(AutomatedReport::class);
$mockReport->method('getCurrentDealStages')->willReturn([1, 2, 3]);
$result = $automatedReportsService->getCurrentDealStagesUuids($mockReport);
// Should return array with null values for non-existent stages
$this->assertEquals([], $result);
}
public static function getCurrentDealStagesUuidsDataProvider(): array
{
return [
'single stage found' => [
'currentDealStages' => [10],
'mockStages' => [
10 => ['id' => 10, 'uuid' => 'stage-uuid-10'],
],
'expectedUuids' => ['stage-uuid-10'],
],
'multiple stages found' => [
'currentDealStages' => [10, 20, 30],
'mockStages' => [
10 => ['id' => 10, 'uuid' => 'stage-uuid-10'],
20 => ['id' => 20, 'uuid' => 'stage-uuid-20'],
30 => ['id' => 30, 'uuid' => 'stage-uuid-30'],
],
'expectedUuids' => ['stage-uuid-10', 'stage-uuid-20', 'stage-uuid-30'],
],
'mixed found and not found stages' => [
'currentDealStages' => [10, 20, 30],
'mockStages' => [
10 => ['id' => 10, 'uuid' => 'stage-uuid-10'],
// 20 not found in DB
30 => ['id' => 30, 'uuid' => 'stage-uuid-30'],
],
'expectedUuids' => ['stage-uuid-10', 'stage-uuid-30'], // Updated to reflect that nulls are filtered out
],
'empty stages array' => [
'currentDealStages' => [],
'mockStages' => [],
'expectedUuids' => [],
],
'all stages not found' => [
'currentDealStages' => [10, 20],
'mockStages' => [], // No stages found
'expectedUuids' => [], // Updated to reflect that nulls are filtered out
],
];
}
#[DataProvider('getTeamGroupsDataProvider')]
public function testGetTeamGroups(string $teamUuid, ?array $mockTeamData, array $mockGroups, array $expectedResult): void
{
// Create mock TeamRepository
$mockTeamRepository = $this->createMock(TeamRepository::class);
if ($mockTeamData === null) {
// Team not found
$mockTeamRepository->method('idOrUuid')
->with($teamUuid)
->willReturn(null);
} else {
// Team found - create mock team with groups
$mockTeam = $this->createMock(\Jiminny\Models\Team::class);
// Create mock groups collection
$mockGroupsCollection = $this->createMock(\Illuminate\Database\Eloquent\Collection::class);
// Create mock Group objects
$groupObjects = [];
foreach ($mockGroups as $groupData) {
$mockGroup = $this->createMock(\Jiminny\Models\Group::class);
$mockGroup->method('getUuid')->willReturn($groupData['id']);
$mockGroup->method('getName')->willReturn($groupData['name']);
$groupObjects[] = $mockGroup;
}
// Mock the groups collection to return our mock groups
$mockGroupsCollection->method('getIterator')->willReturn(new \ArrayIterator($groupObjects));
// Mock the groups() relation
$mockGroupsRelation = $this->createMock(\Illuminate\Database\Eloquent\Relations\HasMany::class);
$mockGroupsRelation->method('get')->willReturn($mockGroupsCollection);
$mockTeam->method('groups')->willReturn($mockGroupsRelation);
$mockTeamRepository->method('idOrUuid')
->with($teamUuid)
->willReturn($mockTeam);
}
// Create service with mocked TeamRepository
$automatedReportsService = $this->getService(mockTeamRepository: $mockTeamRepository);
$result = $automatedReportsService->getTeamGroups($teamUuid);
$this->assertEquals($expectedResult, $result);
}
public function testGetTeamGroupsWithNonExistentTeam(): void
{
// Create mock TeamRepository that returns null (team not found)
$mockTeamRepository = $this->createMock(TeamRepository::class);
$mockTeamRepository->method('idOrUuid')->willReturn(null);
// Create service with mocked TeamRepository
$automatedReportsService = $this->getService(mockTeamRepository: $mockTeamRepository);
$result = $automatedReportsService->getTeamGroups('non-existent-team-uuid');
$this->assertEquals([], $result);
}
public function testGetTeamGroupsWithEmptyGroups(): void
{
// Create mock team with no groups
$mockTeam = $this->createMock(\Jiminny\Models\Team::class);
// Create empty groups collection
$mockGroupsCollection = $this->createMock(\Illuminate\Database\Eloquent\Collection::class);
$mockGroupsCollection->method('getIterator')->willReturn(new \ArrayIterator([]));
$mockGroupsRelation = $this->createMock(\Illuminate\Database\Eloquent\Relations\HasMany::class);
$mockGroupsRelation->method('get')->willReturn($mockGroupsCollection);
$mockTeam->method('groups')->willReturn($mockGroupsRelation);
// Create mock TeamRepository
$mockTeamRepository = $this->createMock(TeamRepository::class);
$mockTeamRepository->method('idOrUuid')->willReturn($mockTeam);
// Create service with mocked TeamRepository
$automatedReportsService = $this->getService(mockTeamRepository: $mockTeamRepository);
$result = $automatedReportsService->getTeamGroups('team-with-no-groups');
$this->assertEquals([], $result);
}
public static function getTeamGroupsDataProvider(): array
{
return [
'team with single group' => [
'teamUuid' => 'team-uuid-123',
'mockTeamData' => ['id' => 'team-uuid-123', 'name' => 'Test Team'],
'mockGroups' => [
['id' => 'group-uuid-1', 'name' => 'Sales Team'],
],
'expectedResult' => [
['id' => 'group-uuid-1', 'name' => 'Sales Team'],
],
],
'team with multiple groups' => [
'teamUuid' => 'team-uuid-456',
'mockTeamData' => ['id' => 'team-uuid-456', 'name' => 'Another Team'],
'mockGroups' => [
['id' => 'group-uuid-1', 'name' => 'Sales Team'],
['id' => 'group-uuid-2', 'name' => 'Marketing Team'],
['id' => 'group-uuid-3', 'name' => 'Support Team'],
],
'expectedResult' => [
['id' => 'group-uuid-1', 'name' => 'Sales Team'],
['id' => 'group-uuid-2', 'name' => 'Marketing Team'],
['id' => 'group-uuid-3', 'name' => 'Support Team'],
],
],
'team not found' => [
'teamUuid' => 'non-existent-uuid',
'mockTeamData' => null,
'mockGroups' => [],
'expectedResult' => [],
],
'team with no groups' => [
'teamUuid' => 'team-uuid-empty',
'mockTeamData' => ['id' => 'team-uuid-empty', 'name' => 'Empty Team'],
'mockGroups' => [],
'expectedResult' => [],
],
];
}
#[DataProvider('getTeamsDataProvider')]
public function testGetTeams(array $mockTeams, array $expectedResult): void
{
// Create mock TeamRepository
$mockTeamRepository = $this->createMock(TeamRepository::class);
// Create mock Team objects
$teamObjects = [];
foreach ($mockTeams as $teamData) {
$mockTeam = $this->createMock(\Jiminny\Models\Team::class);
$mockTeam->method('getUuid')->willReturn($teamData['id']);
$mockTeam->method('getName')->willReturn($teamData['name']);
$mockTeam->method('hasFeature')
->with(\Jiminny\Models\Feature\FeatureEnum::AUTOMATED_REPORTS)
->willReturn($teamData['hasAutomatedReports']);
$teamObjects[] = $mockTeam;
}
// Mock the repository to return a Collection (not array)
$mockTeamRepository->method('getTeamsForKiosk')
->with('active')
->willReturn(new Collection($teamObjects));
// Create service with mocked TeamRepository
$automatedReportsService = $this->getService(mockTeamRepository: $mockTeamRepository);
$result = $automatedReportsService->getTeams();
$this->assertEquals($expectedResult, $result);
}
public function testGetTeamsWithNoTeams(): void
{
// Create mock TeamRepository that returns empty Collection
$mockTeamRepository = $this->createMock(TeamRepository::class);
$mockTeamRepository->method('getTeamsForKiosk')->willReturn(new Collection([]));
// Create service with mocked TeamRepository
$automatedReportsService = $this->getService(mockTeamRepository: $mockTeamRepository);
$result = $automatedReportsService->getTeams();
$this->assertEquals([], $result);
}
public function testGetTeamsWithAllTeamsWithoutFeature(): void
{
// Create mock teams without AUTOMATED_REPORTS feature
$mockTeam1 = $this->createMock(\Jiminny\Models\Team::class);
$mockTeam1->method('hasFeature')
->with(\Jiminny\Models\Feature\FeatureEnum::AUTOMATED_REPORTS)
->willReturn(false);
$mockTeam2 = $this->createMock(\Jiminny\Models\Team::class);
$mockTeam2->method('hasFeature')
->with(\Jiminny\Models\Feature\FeatureEnum::AUTOMATED_REPORTS)
->willReturn(false);
// Create mock TeamRepository that returns Collection
$mockTeamRepository = $this->createMock(TeamRepository::class);
$mockTeamRepository->method('getTeamsForKiosk')->willReturn(new Collection([$mockTeam1, $mockTeam2]));
// Create service with mocked TeamRepository
$automatedReportsService = $this->getService(mockTeamRepository: $mockTeamRepository);
$result = $automatedReportsService->getTeams();
$this->assertEquals([], $result);
}
public static function getTeamsDataProvider(): array
{
return [
'single team with feature' => [
'mockTeams' => [
[
'id' => 'team-uuid-1',
'name' => 'Sales Team',
'hasAutomatedReports' => true,
],
],
'expectedResult' => [
['id' => 'team-uuid-1', 'name' => 'Sales Team'],
],
],
'multiple teams with feature' => [
'mockTeams' => [
[
'id' => 'team-uuid-1',
'name' => 'Sales Team',
'hasAutomatedReports' => true,
],
[
'id' => 'team-uuid-2',
'name' => 'Marketing Team',
'hasAutomatedReports' => true,
],
[
'id' => 'team-uuid-3',
'name' => 'Support Team',
'hasAutomatedReports' => true,
],
],
'expectedResult' => [
['id' => 'team-uuid-1', 'name' => 'Sales Team'],
['id' => 'team-uuid-2', 'name' => 'Marketing Team'],
['id' => 'team-uuid-3', 'name' => 'Support Team'],
],
],
'mixed teams - some with feature, some without' => [
'mockTeams' => [
[
'id' => 'team-uuid-1',
'name' => 'Sales Team',
'hasAutomatedReports' => true,
],
[
'id' => 'team-uuid-2',
'name' => 'Marketing Team',
'hasAutomatedReports' => false,
],
[
'id' => 'team-uuid-3',
'name' => 'Support Team',
'hasAutomatedReports' => true,
],
],
'expectedResult' => [
['id' => 'team-uuid-1', 'name' => 'Sales Team'],
['id' => 'team-uuid-3', 'name' => 'Support Team'],
],
],
'all teams without feature' => [
'mockTeams' => [
[
'id' => 'team-uuid-1',
'name' => 'Sales Team',
'hasAutomatedReports' => false,
],
[
'id' => 'team-uuid-2',
'name' => 'Marketing Team',
'hasAutomatedReports' => false,
],
],
'expectedResult' => [],
],
'empty teams array' => [
'mockTeams' => [],
'expectedResult' => [],
],
];
}
#[DataProvider('deleteS3FilesDataProvider')]
public function testDeleteS3Files(
string $mediaType,
array $expectedFileExtensions,
array $existingFiles,
string $pathSuffix,
int $expectedDeletes
): void {
// Arrange
$teamUuid = 'team-uuid-123';
$reportUuid = 'report-uuid-456';
$basePath = sprintf('%s/reports/%s', $teamUuid, $reportUuid);
$team = Mockery::mock(Team::class);
$team->allows('getUuid')->andReturn($teamUuid);
$report = Mockery::mock(AutomatedReport::class);
$report->allows('getTeam')->andReturn($team);
$result = Mockery::mock(AutomatedReportResult::class);
$result->allows('getReport')->andReturn($report);
$result->allows('getUuid')->andReturn($reportUuid);
$result->allows('getMediaType')->andReturn($mediaType);
Storage::fake();
Log::shouldReceive('info')->times($expectedDeletes);
foreach ($existingFiles as $extension) {
$filePath = $basePath . $pathSuffix . '.' . $extension;
Storage::put($filePath, 'dummy content');
}
// Act
$this->service->deleteS3Files($result);
// Assert
foreach ($expectedFileExtensions as $extension) {
$filePath = $basePath . $pathSuffix . '.' . $extension;
if (in_array($extension, $existingFiles, true)) {
Storage::assertMissing($filePath);
} else {
// To be sure no unexpected files were created and deleted
Storage::assertMissing($filePath);
}
}
}
public static function deleteS3FilesDataProvider(): array
{
return [
'PDF report, all files exist' => [
'mediaType' => AutomatedReportsService::MEDIA_TYPE_PDF,
'expectedFileExtensions' => ['html', 'MD', 'pdf'],
'existingFiles' => ['html', 'MD', 'pdf'],
'pathSuffix' => '',
'expectedDeletes' => 3,
],
'PDF report, some files exist' => [
'mediaType' => AutomatedReportsService::MEDIA_TYPE_PDF,
'expectedFileExtensions' => ['html', 'MD', 'pdf'],
'existingFiles' => ['html', 'pdf'],
'pathSuffix' => '',
'expectedDeletes' => 2,
],
'PDF report, no files exist' => [
'mediaType' => AutomatedReportsService::MEDIA_TYPE_PDF,
'expectedFileExtensions' => ['html', 'MD', 'pdf'],
'existingFiles' => [],
'pathSuffix' => '',
'expectedDeletes' => 0,
],
'Podcast report, all files exist' => [
'mediaType' => AutomatedReportsService::MEDIA_TYPE_PODCAST,
'expectedFileExtensions' => ['json', 'mp3', 'ssml'],
'existingFiles' => ['json', 'mp3', 'ssml'],
'pathSuffix' => '_podcast',
'expectedDeletes' => 3,
],
'Podcast report, some files exist' => [
'mediaType' => AutomatedReportsService::MEDIA_TYPE_PODCAST,
'expectedFileExtensions' => ['json', 'mp3', 'ssml'],
'existingFiles' => ['mp3'],
'pathSuffix' => '_podcast',
'expectedDeletes' => 1,
],
'Podcast report, no files exist' => [
'mediaType' => AutomatedReportsService::MEDIA_TYPE_PODCAST,
'expectedFileExtensions' => ['json', 'mp3', 'ssml'],
'existingFiles' => [],
'pathSuffix' => '_podcast',
'expectedDeletes' => 0,
],
'Other media type, should do nothing' => [
'mediaType' => 'some_other_type',
'expectedFileExtensions' => [],
'existingFiles' => [],
'pathSuffix' => '',
'expectedDeletes' => 0,
],
];
}
public function testDeleteReportsResultsInRetentionPeriodWithLogging(): void
{
// Create mocks for the test
$automatedReportsService = Mockery::mock(AutomatedReportsService::class);
$team = Mockery::mock(Team::class);
$team->shouldReceive('getId')->andReturn(123);
$from = now()->subDays(30);
$to = now();
$source = 'test-source';
// Expect the method to be called with specific parameters
$automatedReportsService->shouldReceive('deleteReportsResultsInRetentionPeriodWithLogging')
->once()
->with(
$team,
Mockery::on(function ($arg) use ($from) {
return $arg->timestamp === $from->timestamp;
}),
Mockery::on(function ($arg) use ($to) {
return $arg->timestamp === $to->timestamp;
}),
$source
)
->andReturn(5);
// Call the method and verify the result
$result = $automatedReportsService->deleteReportsResultsInRetentionPeriodWithLogging(
$team,
$from,
$to,
$source
);
$this->assertEquals(5, $result);
}
#[DataProvider('sanitizeFileNameDataProvider')]
public function testSanitizeFileName(string $input, string $expected): void
{
$result = $this->service->sanitizeFileName($input);
$this->assertEquals($expected, $result);
}
public static function sanitizeFileNameDataProvider(): array
{
return [
'no special characters' => [
'input' => 'Exec Summary - Sep 2025 - Business Development Team',
'expected' => 'Exec Summary - Sep 2025 - Business Development Team',
],
'forward slash in team name' => [
'input' => 'Exec Summary - Sep 2025 - ND/IRV',
'expected' => 'Exec Summary - Sep 2025 - ND-IRV',
],
'backslash in team name' => [
'input' => 'Exec Summary - Sep 2025 - ND\IRV',
'expected' => 'Exec Summary - Sep 2025 - ND-IRV',
],
'multiple forward slashes' => [
'input' => 'Report - Team A/B/C',
'expected' => 'Report - Team A-B-C',
],
'multiple backslashes' => [
'input' => 'Report - Team A\B\C',
'expected' => 'Report - Team A-B-C',
],
'mixed slashes and backslashes' => [
'input' => 'Report - Team A/B\C',
'expected' => 'Report - Team A-B-C',
],
'complex team name with slashes' => [
'input' => 'Exec Summary - Sep 2025 - Business Development Team - ND/IRV, Net Driven - Acquisition (Sales)',
'expected' => 'Exec Summary - Sep 2025 - Business Development Team - ND-IRV, Net Driven - Acquisition (Sales)',
],
'only slashes' => [
'input' => '//\\\\',
'expected' => '----',
],
'empty string' => [
'input' => '',
'expected' => '',
],
'slash at start' => [
'input' => '/Report Name',
'expected' => '-Report Name',
],
'slash at end' => [
'input' => 'Report Name/',
'expected' => 'Report Name-',
],
];
}
public function testGetReportFileNameSanitizesOutput(): void
{
// Create mock GroupRepository
$mockGroupRepository = $this->createMock(GroupRepository::class);
// Create mock Group with slash in name
$mockGroup = $this->createMock(\Jiminny\Models\Group::class);
$mockGroup->method('getName')->willReturn('ND/IRV, Net Driven - Acquisition (Sales)');
$mockGroupRepository->method('find')->willReturn($mockGroup);
// Create service with mocked GroupRepository
$service = new AutomatedReportsService(
$this->createMock(TeamRepository::class),
$mockGroupRepository,
$this->createMock(UserRepository::class),
$this->createMock(StageRepository::class),
$this->createMock(DealStagesService::class),
$this->createMock(RecipientsService::class),
$this->createMock(AutomatedReportsRepository::class),
$this->createMock(Webhook::class),
$this->createMock(Dispatcher::class),
$this->createMock(ActivityTypeService::class),
$this->createMock(PlaybookCategoryRepository::class),
$this->createMock(AskAnythingPromptService::class),
$this->createMock(SearchRepository::class),
$this->createMock(AskAnythingRepository::class),
);
// Create mock AutomatedReportResult
$mockReportResult = $this->createMock(AutomatedReportResult::class);
// Create mock AutomatedReport
$mockReport = $this->createMock(AutomatedReport::class);
$mockReport->method('getType')->willReturn('exec_summary');
$mockReport->method('getFrequency')->willReturn('monthly');
$mockReportResult->method('getReport')->willReturn($mockReport);
$mockReportResult->method('getFromDate')->willReturn(
\Illuminate\Support\Carbon::parse('2025-09-01')
);
$mockReportResult->method('getToDate')->willReturn(
\Illuminate\Support\Carbon::parse('2025-09-30')
);
$mockReportResult->method('getGroups')->willReturn([123]);
$mockReportResult->method('getMediaType')->willReturn(AutomatedReportsService::MEDIA_TYPE_PDF);
// Call getReportFileName
$result = $service->getReportFileName($mockReportResult);
// Verify the result does not contain slashes or backslashes
$this->assertStringNotContainsString('/', $result);
$this->assertStringNotContainsString('\\', $result);
// Verify the slash was replaced with dash
$this->assertStringContainsString('ND-IRV', $result);
}
public function testGetReportFileNameWithExtensionSanitizesOutput(): void
{
// Create mock GroupRepository
$mockGroupRepository = $this->createMock(GroupRepository::class);
// Create mock Group with backslash in name
$mockGroup = $this->createMock(\Jiminny\Models\Group::class);
$mockGroup->method('getName')->willReturn('Team\Name');
$mockGroupRepository->method('find')->willReturn($mockGroup);
// Create service with mocked GroupRepository
$service = new AutomatedReportsService(
$this->createMock(TeamRepository::class),
$mockGroupRepository,
$this->createMock(UserRepository::class),
$this->createMock(StageRepository::class),
$this->...
|
NULL
|
|
66845
|
1506
|
0
|
2026-04-21T15:09:56.196400+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776784196196_m2.jpg...
|
PhpStorm
|
faVsco.js – AutomatedReportsServiceTest.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
PhostormVIewINavigarecodeLaravelKeractorFV faVsco. PhostormVIewINavigarecodeLaravelKeractorFV faVsco.js( #11894 on JY-18909-automated-reports-askProledeyAutomatedkeporskepository.ongC) Service.php© Field.php> • OpportunitySyncStrategAskJIminnykeportAcuvilyservice.orpOkeporcontroller.onp© AutomatedReportsSendCommand.phpD ProspectsearchstrategyAutomatedReportsServiceTest.php> • ServiceTraits© ClientTest.php© AutomatedReportsCallbackService.phpC) DecorateActivity lest.onC DeleteObjectsTraitTest.© FieldDefinitionsTest.php© GetActivityFieldNameTePayloadBuilderTest.php@ QueryBuilderTest.phpC) QueryHandlerTest.php© QuerylteratorTest.php© QuervResultsTests.phpC ServiceTest.phpC) SvncBatchRedisServicel(C) AutomatedReportResult.phoC) AutomatedReport.phpcohodeclare (strict tvoessi):namespace Tests Unit Services Klosk AutomatedRenortsJse ..©) BaseServiceTest.oholass AutomatedRenontsServiceTest extends Testtasec) CachedCrmServiceDecoratc) CrmActivitvServiceTlest.oni@ CrmConfiaurationSettinasS18 usagesprivate AutomatedReportsService $service;c) crmobiectsResolveriiest.oc) DefaultProsnectSearchStra40 (6t sprotected function setUp(): void{...}c EmailHelperTest.ohoc) FieldValueConverterTest.olprotected function tearDown: void{...}c) LavoutManaderTest.oho@ MiarateProviderServiceTesc OnnortunitvActivitvMatchez2 usagesprivate function getService© OpportunitySyncStrategyRSmockuserkepos1tory = null.Local ChangesShelfiConsoleLo0 XI• Changes 10 filesE.env.local app( ActivityController.php app/Http/Controllers/APl→® Side-by-side viewer -Highlight words x 15 g ?n10d148c6a00/Services/Kiosk|Autdarray_ values(Sthis->transformRecipients(Sreport->qetRecipients0))(c) AutomatedReportsservice.pho a© JiminnyDebugCommand.php app/Console/Commands'report type' => $this->transformReportType(Sreport->qetTypeO)php loaaina.php confic@ PlavbackService.pho app/Services© RequestGenerateAsk.JiminnvReport.Job.phn app/.Jobs/AutomatedReports@ RequestGenerateAsk.JiminnvReport.JobTest.phn tests/Unit/.Jobs/AutomatedRer@ SvncTolntercom.ohp app/.JJobs/Team'media type' =› sautomatedReportresult->qetmed1alypeol'downloadUrl' => Sthis->generateReportResultDownloadUr1($automatedReportResult)vlewirl' =>sthis->deneraterenortresu.tvlewr.csautomatedRenortresuutreturn Sdata:Unversioned Files 11 filesnublie function hasCallTvneConference(AutomatedRenont Srenont): boolneturn in arnav(self:•CAll TYPE CONEERENCE(Iid'L Srenont->ae+callTvneço true):A10 A90 X59 ^ Y 161#263— 165=166E167=169—170E172174—176=custom.log4 SF [jiminny@localhost] XCascade# concole [pponlA ho_local Uiminny@localnostA console (EU]Review Planhat Intearreport-not-generated.blade.phgA console [STAGING]e jiminnyseleel * rkun aculvity searches whereSELECT * FROM activity_ search_filters WHERE018 414 X2 X4 ^ VSELECT * FROM automated_ reports where id = 68UPUAIEautomated_reports set playbook categories = NULL where idSELECT * FROM automated_ report_ results where id = 275:o docte ai docset le /A bia eteroftevoposto yie eoye oge tea /Po1/°PHPUnit 11.5.55 by Sebastian Bergmann and contributors.PhP 0.3:30Configuration: /home/jaminny/phpunit.xmlSELECT * FROM automated_reports order by id desc;sELEcT * FROM automated reportresults order by 1d desc:select * from activity_searches where user_id = 143;selectA| 453 tests pass (6 ore-existina skiooed. 5 unrelated PHPUnit deorecation notices). No fixes needed.SELEC * FROM GrOUoS WHERE 10 = 14591SELECT * FROM usens WHERE aroun id = 1439:select * From permissions: # 158select * from roles:select * from permission_roleselect * from teams where id = 1;select * from groups g JOIN playbooks p 1..n<->1: on g.playbook_idClaude Onuc 47 MediumCurrent versionif (! Sreport->isAskJiminnyReportO) {returnf...array_values ($this->transformGroups(team: Sreport->getTeam), groupsids: Sreport->getGroups)),nublie function hasCallTvneConference(AutomatedRenont Srenont): boo1lreturn in_array(self::CALL_TYPE_CONFERENCE['id'], Sreport->getCallTypes, true);100% S2Tue 21 Apr 18:09:56AutomatedReportsServiceTest ~Automated Reports RCalendar Multi-Domal+0..run tests and fix if not passingnAccessAiReportsTest.php 2>&1 |Teal ae2 differencesTacts naccod. 214/2 minutes adolWN Windsurf Toams 87-1UTF.8Po 4 spaces...
|
NULL
|
-4395906738401451141
|
NULL
|
click
|
ocr
|
NULL
|
PhostormVIewINavigarecodeLaravelKeractorFV faVsco. PhostormVIewINavigarecodeLaravelKeractorFV faVsco.js( #11894 on JY-18909-automated-reports-askProledeyAutomatedkeporskepository.ongC) Service.php© Field.php> • OpportunitySyncStrategAskJIminnykeportAcuvilyservice.orpOkeporcontroller.onp© AutomatedReportsSendCommand.phpD ProspectsearchstrategyAutomatedReportsServiceTest.php> • ServiceTraits© ClientTest.php© AutomatedReportsCallbackService.phpC) DecorateActivity lest.onC DeleteObjectsTraitTest.© FieldDefinitionsTest.php© GetActivityFieldNameTePayloadBuilderTest.php@ QueryBuilderTest.phpC) QueryHandlerTest.php© QuerylteratorTest.php© QuervResultsTests.phpC ServiceTest.phpC) SvncBatchRedisServicel(C) AutomatedReportResult.phoC) AutomatedReport.phpcohodeclare (strict tvoessi):namespace Tests Unit Services Klosk AutomatedRenortsJse ..©) BaseServiceTest.oholass AutomatedRenontsServiceTest extends Testtasec) CachedCrmServiceDecoratc) CrmActivitvServiceTlest.oni@ CrmConfiaurationSettinasS18 usagesprivate AutomatedReportsService $service;c) crmobiectsResolveriiest.oc) DefaultProsnectSearchStra40 (6t sprotected function setUp(): void{...}c EmailHelperTest.ohoc) FieldValueConverterTest.olprotected function tearDown: void{...}c) LavoutManaderTest.oho@ MiarateProviderServiceTesc OnnortunitvActivitvMatchez2 usagesprivate function getService© OpportunitySyncStrategyRSmockuserkepos1tory = null.Local ChangesShelfiConsoleLo0 XI• Changes 10 filesE.env.local app( ActivityController.php app/Http/Controllers/APl→® Side-by-side viewer -Highlight words x 15 g ?n10d148c6a00/Services/Kiosk|Autdarray_ values(Sthis->transformRecipients(Sreport->qetRecipients0))(c) AutomatedReportsservice.pho a© JiminnyDebugCommand.php app/Console/Commands'report type' => $this->transformReportType(Sreport->qetTypeO)php loaaina.php confic@ PlavbackService.pho app/Services© RequestGenerateAsk.JiminnvReport.Job.phn app/.Jobs/AutomatedReports@ RequestGenerateAsk.JiminnvReport.JobTest.phn tests/Unit/.Jobs/AutomatedRer@ SvncTolntercom.ohp app/.JJobs/Team'media type' =› sautomatedReportresult->qetmed1alypeol'downloadUrl' => Sthis->generateReportResultDownloadUr1($automatedReportResult)vlewirl' =>sthis->deneraterenortresu.tvlewr.csautomatedRenortresuutreturn Sdata:Unversioned Files 11 filesnublie function hasCallTvneConference(AutomatedRenont Srenont): boolneturn in arnav(self:•CAll TYPE CONEERENCE(Iid'L Srenont->ae+callTvneço true):A10 A90 X59 ^ Y 161#263— 165=166E167=169—170E172174—176=custom.log4 SF [jiminny@localhost] XCascade# concole [pponlA ho_local Uiminny@localnostA console (EU]Review Planhat Intearreport-not-generated.blade.phgA console [STAGING]e jiminnyseleel * rkun aculvity searches whereSELECT * FROM activity_ search_filters WHERE018 414 X2 X4 ^ VSELECT * FROM automated_ reports where id = 68UPUAIEautomated_reports set playbook categories = NULL where idSELECT * FROM automated_ report_ results where id = 275:o docte ai docset le /A bia eteroftevoposto yie eoye oge tea /Po1/°PHPUnit 11.5.55 by Sebastian Bergmann and contributors.PhP 0.3:30Configuration: /home/jaminny/phpunit.xmlSELECT * FROM automated_reports order by id desc;sELEcT * FROM automated reportresults order by 1d desc:select * from activity_searches where user_id = 143;selectA| 453 tests pass (6 ore-existina skiooed. 5 unrelated PHPUnit deorecation notices). No fixes needed.SELEC * FROM GrOUoS WHERE 10 = 14591SELECT * FROM usens WHERE aroun id = 1439:select * From permissions: # 158select * from roles:select * from permission_roleselect * from teams where id = 1;select * from groups g JOIN playbooks p 1..n<->1: on g.playbook_idClaude Onuc 47 MediumCurrent versionif (! Sreport->isAskJiminnyReportO) {returnf...array_values ($this->transformGroups(team: Sreport->getTeam), groupsids: Sreport->getGroups)),nublie function hasCallTvneConference(AutomatedRenont Srenont): boo1lreturn in_array(self::CALL_TYPE_CONFERENCE['id'], Sreport->getCallTypes, true);100% S2Tue 21 Apr 18:09:56AutomatedReportsServiceTest ~Automated Reports RCalendar Multi-Domal+0..run tests and fix if not passingnAccessAiReportsTest.php 2>&1 |Teal ae2 differencesTacts naccod. 214/2 minutes adolWN Windsurf Toams 87-1UTF.8Po 4 spaces...
|
NULL
|
|
66909
|
NULL
|
0
|
2026-04-21T15:14:59.742243+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776784499742_m1.jpg...
|
Firefox
|
Ask Jiminny Reports by nikolay-yankov · Pull Reque Ask Jiminny Reports by nikolay-yankov · Pull Request #11894 · jiminny/app — Work...
|
1
|
github.com/jiminny/app/pull/11894
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Platform Sprint 2 Q2 - Platform Team - Scrum Board Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira
Project Phoenix – Figma
Project Phoenix – Figma
[JY-20372] AI Reports > Empty page design and promotion - Jira
[JY-20372] AI Reports > Empty page design and promotion - Jira
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Jiminny MCP Connector - Product - Confluence
Jiminny MCP Connector - Product - Confluence
Jiminny Mail
Jiminny Mail
[JY-20500] Batch initial sync for Salesforce - Jira
[JY-20500] Batch initial sync for Salesforce - Jira
Feed — jiminny — Sentry
Feed — jiminny — Sentry
Jiminny
Jiminny
Pipelines - jiminny/app
Pipelines - jiminny/app
Formalize
Formalize
[SRD-6793] Les Mills activity types not pulling in - Jira
[SRD-6793] Les Mills activity types not pulling in - Jira
Search results: calendar | Jiminny Help Center
Search results: calendar | Jiminny Help Center
Jiminny
Jiminny
Jiminny
Jiminny
Edit - Calendar - Engineering - Confluence
Edit - Calendar - Engineering - Confluence
Ask Jiminny Reports by nikolay-yankov · Pull Request #11894 · jiminny/app
Ask Jiminny Reports by nikolay-yankov · Pull Request #11894 · jiminny/app
Close tab
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Skip to content
Skip to content
Open menu
Homepage (g then d)
jiminny
jiminny
app
app
Search or jump to…
Type
/
to search
Chat with Copilot
Open Copilot…
Create new...
Issues(g then i)
Pull requests
Repositories
You have unread notifications(g then n)...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20372] AI Reports > Empty page design and promotion - Jira","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20372] AI Reports > Empty page design and promotion - Jira","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny MCP Connector - Product - Confluence","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny MCP Connector - Product - Confluence","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny Mail","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny Mail","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20500] Batch initial sync for Salesforce - Jira","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20500] Batch initial sync for Salesforce - Jira","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Feed — jiminny — Sentry","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Feed — jiminny — Sentry","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Pipelines - jiminny/app","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pipelines - jiminny/app","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Formalize","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Formalize","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[SRD-6793] Les Mills activity types not pulling in - Jira","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[SRD-6793] Les Mills activity types not pulling in - Jira","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Search results: calendar | Jiminny Help Center","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Search results: calendar | Jiminny Help Center","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Edit - Calendar - Engineering - Confluence","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Edit - Calendar - Engineering - Confluence","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Ask Jiminny Reports by nikolay-yankov · Pull Request #11894 · jiminny/app","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Ask Jiminny Reports by nikolay-yankov · Pull Request #11894 · jiminny/app","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"New Tab","depth":4,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Tabs from other devices","depth":6,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Skip to content","depth":6,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Skip to content","depth":7,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Open menu","depth":10,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Homepage (g then d)","depth":9,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"jiminny","depth":12,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"jiminny","depth":14,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"app","depth":12,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"app","depth":14,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Search or jump to…","depth":9,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Type","depth":12,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/","depth":12,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"to search","depth":12,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Chat with Copilot","depth":10,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXMenuButton","text":"Open Copilot…","depth":9,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXMenuButton","text":"Create new...","depth":9,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Issues(g then i)","depth":9,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Pull requests","depth":9,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"Repositories","depth":9,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXLink","text":"You have unread notifications(g then n)","depth":9,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false}]...
|
-4719638350607706119
|
-5317348319378641919
|
click
|
accessibility
|
NULL
|
Platform Sprint 2 Q2 - Platform Team - Scrum Board Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira
Project Phoenix – Figma
Project Phoenix – Figma
[JY-20372] AI Reports > Empty page design and promotion - Jira
[JY-20372] AI Reports > Empty page design and promotion - Jira
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Jiminny MCP Connector - Product - Confluence
Jiminny MCP Connector - Product - Confluence
Jiminny Mail
Jiminny Mail
[JY-20500] Batch initial sync for Salesforce - Jira
[JY-20500] Batch initial sync for Salesforce - Jira
Feed — jiminny — Sentry
Feed — jiminny — Sentry
Jiminny
Jiminny
Pipelines - jiminny/app
Pipelines - jiminny/app
Formalize
Formalize
[SRD-6793] Les Mills activity types not pulling in - Jira
[SRD-6793] Les Mills activity types not pulling in - Jira
Search results: calendar | Jiminny Help Center
Search results: calendar | Jiminny Help Center
Jiminny
Jiminny
Jiminny
Jiminny
Edit - Calendar - Engineering - Confluence
Edit - Calendar - Engineering - Confluence
Ask Jiminny Reports by nikolay-yankov · Pull Request #11894 · jiminny/app
Ask Jiminny Reports by nikolay-yankov · Pull Request #11894 · jiminny/app
Close tab
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Skip to content
Skip to content
Open menu
Homepage (g then d)
jiminny
jiminny
app
app
Search or jump to…
Type
/
to search
Chat with Copilot
Open Copilot…
Create new...
Issues(g then i)
Pull requests
Repositories
You have unread notifications(g then n)...
|
NULL
|
|
66910
|
NULL
|
0
|
2026-04-21T15:15:04.592838+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776784504592_m2.jpg...
|
Firefox
|
Edit - Calendar - Engineering - Confluence — Work
|
1
|
jiminny.atlassian.net/wiki/spaces/EN/pages/edit-v2 jiminny.atlassian.net/wiki/spaces/EN/pages/edit-v2/2743173121...
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Platform Sprint 2 Q2 - Platform Team - Scrum Board Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira
Project Phoenix – Figma
Project Phoenix – Figma
[JY-20372] AI Reports > Empty page design and promotion - Jira
[JY-20372] AI Reports > Empty page design and promotion - Jira
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Jiminny MCP Connector - Product - Confluence
Jiminny MCP Connector - Product - Confluence
Jiminny Mail
Jiminny Mail
[JY-20500] Batch initial sync for Salesforce - Jira
[JY-20500] Batch initial sync for Salesforce - Jira
Feed — jiminny — Sentry
Feed — jiminny — Sentry
Jiminny
Jiminny
Pipelines - jiminny/app
Pipelines - jiminny/app
Formalize
Formalize
[SRD-6793] Les Mills activity types not pulling in - Jira
[SRD-6793] Les Mills activity types not pulling in - Jira
Search results: calendar | Jiminny Help Center
Search results: calendar | Jiminny Help Center
Jiminny
Jiminny
Jiminny
Jiminny
Edit - Calendar - Engineering - Confluence
Edit - Calendar - Engineering - Confluence
Close tab
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Skip to:
Top Bar
Top Bar
Sidebar
Sidebar
Main Content
Main Content
Collapse sidebar Ctrl [
Collapse sidebar
Ctrl
[
Switch sites or apps
Switch sites or apps
Confluence
Search, press enter to navigate to advanced search with your text query
Create
Create
Rovo Ask Rovo
Ask Rovo
3 Notifications
3 Notifications
Help
Help
[EMAIL]
[EMAIL]
For you
For you...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira","depth":4,"bounds":{"left":0.0018284575,"top":0.0518755,"width":0.07596409,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"bounds":{"left":0.0,"top":0.09497207,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"bounds":{"left":0.013297873,"top":0.10614525,"width":0.041888297,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20372] AI Reports > Empty page design and promotion - Jira","depth":4,"bounds":{"left":0.0,"top":0.12769353,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20372] AI Reports > Empty page design and promotion - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.13886672,"width":0.11319814,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"bounds":{"left":0.0,"top":0.16041501,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"bounds":{"left":0.013297873,"top":0.17158818,"width":0.041888297,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"bounds":{"left":0.0,"top":0.19313647,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"bounds":{"left":0.013297873,"top":0.20430966,"width":0.041888297,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"bounds":{"left":0.0,"top":0.22585794,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"bounds":{"left":0.013297873,"top":0.23703113,"width":0.041888297,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny MCP Connector - Product - Confluence","depth":4,"bounds":{"left":0.0,"top":0.2585794,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny MCP Connector - Product - Confluence","depth":5,"bounds":{"left":0.013297873,"top":0.2697526,"width":0.08294548,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny Mail","depth":4,"bounds":{"left":0.0,"top":0.29130086,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny Mail","depth":5,"bounds":{"left":0.013297873,"top":0.30247405,"width":0.02144282,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20500] Batch initial sync for Salesforce - Jira","depth":4,"bounds":{"left":0.0,"top":0.32402235,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20500] Batch initial sync for Salesforce - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.33519554,"width":0.08610372,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Feed — jiminny — Sentry","depth":4,"bounds":{"left":0.0,"top":0.3567438,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Feed — jiminny — Sentry","depth":5,"bounds":{"left":0.013297873,"top":0.367917,"width":0.042719416,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"bounds":{"left":0.0,"top":0.38946527,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"bounds":{"left":0.013297873,"top":0.40063846,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Pipelines - jiminny/app","depth":4,"bounds":{"left":0.0,"top":0.42218676,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pipelines - jiminny/app","depth":5,"bounds":{"left":0.013297873,"top":0.43335995,"width":0.039228722,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Formalize","depth":4,"bounds":{"left":0.0,"top":0.45490822,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Formalize","depth":5,"bounds":{"left":0.013297873,"top":0.4660814,"width":0.016788565,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[SRD-6793] Les Mills activity types not pulling in - Jira","depth":4,"bounds":{"left":0.0,"top":0.48762968,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[SRD-6793] Les Mills activity types not pulling in - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.49880287,"width":0.09524601,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Search results: calendar | Jiminny Help Center","depth":4,"bounds":{"left":0.0,"top":0.5203512,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Search results: calendar | Jiminny Help Center","depth":5,"bounds":{"left":0.013297873,"top":0.53152436,"width":0.080119684,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"bounds":{"left":0.0,"top":0.55307263,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"bounds":{"left":0.013297873,"top":0.5642458,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"bounds":{"left":0.0,"top":0.5857941,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"bounds":{"left":0.013297873,"top":0.5969673,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Edit - Calendar - Engineering - Confluence","depth":4,"bounds":{"left":0.0,"top":0.61851555,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Edit - Calendar - Engineering - Confluence","depth":5,"bounds":{"left":0.013297873,"top":0.62968874,"width":0.07413564,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.06732048,"top":0.6256983,"width":0.007978723,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.0028257978,"top":0.6528332,"width":0.07413564,"height":0.025538707},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.0028257978,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.013796543,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Tabs from other devices","depth":6,"bounds":{"left":0.024933511,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.036070477,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.04720745,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Skip to:","depth":10,"bounds":{"left":0.090259306,"top":0.07861133,"width":0.016954787,"height":0.01396648},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Top Bar","depth":11,"bounds":{"left":0.090259306,"top":0.097765364,"width":0.016954787,"height":0.01396648},"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Top Bar","depth":12,"bounds":{"left":0.090259306,"top":0.097765364,"width":0.016954787,"height":0.01396648},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Sidebar","depth":11,"bounds":{"left":0.090259306,"top":0.11691939,"width":0.016954787,"height":0.01396648},"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sidebar","depth":12,"bounds":{"left":0.090259306,"top":0.11691939,"width":0.016954787,"height":0.01396648},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Main Content","depth":11,"bounds":{"left":0.090259306,"top":0.13607343,"width":0.029421542,"height":0.01396648},"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Main Content","depth":12,"bounds":{"left":0.090259306,"top":0.13607343,"width":0.029421542,"height":0.01396648},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse sidebar Ctrl [","depth":10,"bounds":{"left":0.08361037,"top":0.057861134,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse sidebar","depth":12,"bounds":{"left":0.0887633,"top":0.066640064,"width":0.03673537,"height":0.01396648},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ctrl","depth":13,"bounds":{"left":0.12948804,"top":0.066640064,"width":0.007978723,"height":0.01396648},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"[","depth":13,"bounds":{"left":0.14411569,"top":0.066640064,"width":0.0016622341,"height":0.01396648},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Switch sites or apps","depth":12,"bounds":{"left":0.095578454,"top":0.057861134,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Switch sites or apps","depth":14,"bounds":{"left":0.10073138,"top":0.06344773,"width":0.044215426,"height":0.01396648},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Confluence","depth":10,"bounds":{"left":0.10887633,"top":0.057861134,"width":0.029421542,"height":0.025538707},"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXComboBox","text":"Search, press enter to navigate to advanced search with your text query","depth":11,"bounds":{"left":0.2855718,"top":0.06264964,"width":0.24268617,"height":0.015961692},"help_text":"","placeholder":"Search Confluence, Jira, Google Drive and other apps","role_description":"combo box","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Create","depth":10,"bounds":{"left":0.5365692,"top":0.057861134,"width":0.030086435,"height":0.025538707},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Create","depth":12,"bounds":{"left":0.54787236,"top":0.06384677,"width":0.014793883,"height":0.01396648},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Rovo Ask Rovo","depth":13,"bounds":{"left":0.68583775,"top":0.057861134,"width":0.035904255,"height":0.025538707},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ask Rovo","depth":15,"bounds":{"left":0.69714093,"top":0.06384677,"width":0.020611702,"height":0.01396648},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"3 Notifications","depth":13,"bounds":{"left":0.7230718,"top":0.057861134,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"3 Notifications","depth":15,"bounds":{"left":0.72822475,"top":0.06344773,"width":0.031914894,"height":0.01396648},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Help","depth":13,"bounds":{"left":0.7350399,"top":0.057861134,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Help","depth":15,"bounds":{"left":0.74019283,"top":0.06344773,"width":0.010139627,"height":0.01396648},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"lukas.kovalik@jiminny.com","depth":13,"bounds":{"left":0.74700797,"top":0.057861134,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"lukas.kovalik@jiminny.com","depth":15,"bounds":{"left":0.7521609,"top":0.06344773,"width":0.05867686,"height":0.01396648},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"For you","depth":13,"bounds":{"left":0.08361037,"top":0.09976058,"width":0.15392287,"height":0.025538707},"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"For you","depth":16,"bounds":{"left":0.09424867,"top":0.10574621,"width":0.01662234,"height":0.01396648},"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
1466425027676904476
|
-5290628538604821503
|
click
|
accessibility
|
NULL
|
Platform Sprint 2 Q2 - Platform Team - Scrum Board Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira
Project Phoenix – Figma
Project Phoenix – Figma
[JY-20372] AI Reports > Empty page design and promotion - Jira
[JY-20372] AI Reports > Empty page design and promotion - Jira
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Jiminny MCP Connector - Product - Confluence
Jiminny MCP Connector - Product - Confluence
Jiminny Mail
Jiminny Mail
[JY-20500] Batch initial sync for Salesforce - Jira
[JY-20500] Batch initial sync for Salesforce - Jira
Feed — jiminny — Sentry
Feed — jiminny — Sentry
Jiminny
Jiminny
Pipelines - jiminny/app
Pipelines - jiminny/app
Formalize
Formalize
[SRD-6793] Les Mills activity types not pulling in - Jira
[SRD-6793] Les Mills activity types not pulling in - Jira
Search results: calendar | Jiminny Help Center
Search results: calendar | Jiminny Help Center
Jiminny
Jiminny
Jiminny
Jiminny
Edit - Calendar - Engineering - Confluence
Edit - Calendar - Engineering - Confluence
Close tab
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Skip to:
Top Bar
Top Bar
Sidebar
Sidebar
Main Content
Main Content
Collapse sidebar Ctrl [
Collapse sidebar
Ctrl
[
Switch sites or apps
Switch sites or apps
Confluence
Search, press enter to navigate to advanced search with your text query
Create
Create
Rovo Ask Rovo
Ask Rovo
3 Notifications
3 Notifications
Help
Help
[EMAIL]
[EMAIL]
For you
For you...
|
NULL
|
|
66911
|
1507
|
0
|
2026-04-21T15:15:05.443452+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776784505443_m1.jpg...
|
Firefox
|
Edit - Calendar - Engineering - Confluence — Work
|
1
|
jiminny.atlassian.net/wiki/spaces/EN/pages/edit-v2 jiminny.atlassian.net/wiki/spaces/EN/pages/edit-v2/2743173121...
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Edit - Calendar - Engineering - Confluence
jiminny Edit - Calendar - Engineering - Confluence
jiminny.atlassian.net
Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira
Project Phoenix – Figma
Project Phoenix – Figma
[JY-20372] AI Reports > Empty page design and promotion - Jira
[JY-20372] AI Reports > Empty page design and promotion - Jira
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Jiminny MCP Connector - Product - Confluence
Jiminny MCP Connector - Product - Confluence
Jiminny Mail
Jiminny Mail
[JY-20500] Batch initial sync for Salesforce - Jira
[JY-20500] Batch initial sync for Salesforce - Jira
Feed — jiminny — Sentry
Feed — jiminny — Sentry
Jiminny
Jiminny
Pipelines - jiminny/app
Pipelines - jiminny/app
Formalize
Formalize
[SRD-6793] Les Mills activity types not pulling in - Jira
[SRD-6793] Les Mills activity types not pulling in - Jira
Search results: calendar | Jiminny Help Center
Search results: calendar | Jiminny Help Center
Jiminny
Jiminny
Jiminny
Jiminny
Edit - Calendar - Engineering - Confluence
Edit - Calendar - Engineering - Confluence
Close tab
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Skip to:
Top Bar
Top Bar
Sidebar
Sidebar
Main Content
Main Content
Collapse sidebar Ctrl [
Collapse sidebar
Ctrl
[
Switch sites or apps
Switch sites or apps
Confluence
Search, press enter to navigate to advanced search with your text query
Create
Create
Rovo Ask Rovo
Ask Rovo
3 Notifications
3 Notifications
Help
Help
[EMAIL]
[EMAIL]
For you
For you
Recent
Recent
Starred
Starred
Spaces
Spaces
Apps
Apps
Engineering
Engineering
Edit space details
More actions
More actions...
|
[{"role":"AXStaticText","text& [{"role":"AXStaticText","text":"Edit - Calendar - Engineering - Confluence","depth":4,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"jiminny.atlassian.net","depth":4,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20372] AI Reports > Empty page design and promotion - Jira","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20372] AI Reports > Empty page design and promotion - Jira","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny MCP Connector - Product - Confluence","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny MCP Connector - Product - Confluence","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny Mail","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny Mail","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20500] Batch initial sync for Salesforce - Jira","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20500] Batch initial sync for Salesforce - Jira","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Feed — jiminny — Sentry","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Feed — jiminny — Sentry","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Pipelines - jiminny/app","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pipelines - jiminny/app","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Formalize","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Formalize","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[SRD-6793] Les Mills activity types not pulling in - Jira","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[SRD-6793] Les Mills activity types not pulling in - Jira","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Search results: calendar | Jiminny Help Center","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Search results: calendar | Jiminny Help Center","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Edit - Calendar - Engineering - Confluence","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Edit - Calendar - Engineering - Confluence","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"New Tab","depth":4,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Tabs from other devices","depth":6,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Skip to:","depth":10,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Top Bar","depth":11,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Top Bar","depth":12,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Sidebar","depth":11,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Sidebar","depth":12,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Main Content","depth":11,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Main Content","depth":12,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Collapse sidebar Ctrl [","depth":10,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Collapse sidebar","depth":12,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ctrl","depth":13,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"[","depth":13,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Switch sites or apps","depth":12,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Switch sites or apps","depth":14,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Confluence","depth":10,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXComboBox","text":"Search, press enter to navigate to advanced search with your text query","depth":11,"help_text":"","placeholder":"Search Confluence, Jira, Google Drive and other apps","role_description":"combo box","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Create","depth":10,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Create","depth":12,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Rovo Ask Rovo","depth":13,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ask Rovo","depth":15,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"3 Notifications","depth":13,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"3 Notifications","depth":15,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Help","depth":13,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Help","depth":15,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"lukas.kovalik@jiminny.com","depth":13,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"lukas.kovalik@jiminny.com","depth":15,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"For you","depth":13,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"For you","depth":16,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"Recent","depth":13,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Recent","depth":16,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"Starred","depth":13,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Starred","depth":16,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXMenuButton","text":"Spaces","depth":13,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Spaces","depth":16,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Apps","depth":13,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Apps","depth":16,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Engineering","depth":13,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Engineering","depth":16,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Edit space details","depth":14,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXMenuButton","text":"More actions","depth":14,"help_text":"","role_description":"menu button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More actions","depth":16,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-3887163026525175018
|
-5290629224725781371
|
click
|
accessibility
|
NULL
|
Edit - Calendar - Engineering - Confluence
jiminny Edit - Calendar - Engineering - Confluence
jiminny.atlassian.net
Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira
Project Phoenix – Figma
Project Phoenix – Figma
[JY-20372] AI Reports > Empty page design and promotion - Jira
[JY-20372] AI Reports > Empty page design and promotion - Jira
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Jiminny MCP Connector - Product - Confluence
Jiminny MCP Connector - Product - Confluence
Jiminny Mail
Jiminny Mail
[JY-20500] Batch initial sync for Salesforce - Jira
[JY-20500] Batch initial sync for Salesforce - Jira
Feed — jiminny — Sentry
Feed — jiminny — Sentry
Jiminny
Jiminny
Pipelines - jiminny/app
Pipelines - jiminny/app
Formalize
Formalize
[SRD-6793] Les Mills activity types not pulling in - Jira
[SRD-6793] Les Mills activity types not pulling in - Jira
Search results: calendar | Jiminny Help Center
Search results: calendar | Jiminny Help Center
Jiminny
Jiminny
Jiminny
Jiminny
Edit - Calendar - Engineering - Confluence
Edit - Calendar - Engineering - Confluence
Close tab
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Skip to:
Top Bar
Top Bar
Sidebar
Sidebar
Main Content
Main Content
Collapse sidebar Ctrl [
Collapse sidebar
Ctrl
[
Switch sites or apps
Switch sites or apps
Confluence
Search, press enter to navigate to advanced search with your text query
Create
Create
Rovo Ask Rovo
Ask Rovo
3 Notifications
3 Notifications
Help
Help
[EMAIL]
[EMAIL]
For you
For you
Recent
Recent
Starred
Starred
Spaces
Spaces
Apps
Apps
Engineering
Engineering
Edit space details
More actions
More actions...
|
66909
|
|
66912
|
1508
|
0
|
2026-04-21T15:15:08.441539+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776784508441_m2.jpg...
|
Firefox
|
Jiminny — Work
|
1
|
app.staging.jiminny.com/ai-reports
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Platform Sprint 2 Q2 - Platform Team - Scrum Board Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira
Project Phoenix – Figma
Project Phoenix – Figma
[JY-20372] AI Reports > Empty page design and promotion - Jira
[JY-20372] AI Reports > Empty page design and promotion - Jira
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Jiminny MCP Connector - Product - Confluence
Jiminny MCP Connector - Product - Confluence
Jiminny Mail
Jiminny Mail
[JY-20500] Batch initial sync for Salesforce - Jira
[JY-20500] Batch initial sync for Salesforce - Jira
Feed — jiminny — Sentry
Feed — jiminny — Sentry
Jiminny
Jiminny
Pipelines - jiminny/app
Pipelines - jiminny/app
Formalize
Formalize
[SRD-6793] Les Mills activity types not pulling in - Jira
[SRD-6793] Les Mills activity types not pulling in - Jira
Search results: calendar | Jiminny Help Center
Search results: calendar | Jiminny Help Center
Jiminny
Jiminny
Jiminny
Jiminny
Close tab
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
JY-18909-automated-reports-ask-jiminny ■ 874522
27
27
AI Reports
AI Reports
Ask Jiminny reports
Ask Jiminny reports
Report name
Period
Report Type Report Type
Report Type
Report Type
Clear all
NAME
FREQUENCY
SHARED
DATE
ACTIONS
Share With Team Test - Mar 2026
Monthly
21/04/2026
Share With Team Test - Mar 2026
Monthly
21/04/2026
Only Recorded Monthly - Ves Calls - Mar 2026
Monthly
21/04/2026
Only Recorded Monthly - Ves Calls - Mar 2026
Monthly
21/04/2026
Only Recorded Monthly - Ves Calls - Mar 2026
Monthly
21/04/2026
Only Recorded Monthly - Ves Calls - Mar 2026
Monthly
21/04/2026
Expires On - 20 April - New - 13 - 19 Apr 2026
Monthly
20/04/2026
Expires On - 20 April - New - 13 - 19 Apr 2026
Monthly
20/04/2026
Expires On - 20 April - New - 13 - 19 Apr 2026
Monthly
20/04/2026
Expires On - 20 April - New - 13 - 19 Apr 2026
Monthly
20/04/2026
Health - 9 - 15 Apr 2026
Weekly
16/04/2026
Test 6 - 15 Apr 2026
Daily
16/04/2026
Test 7 - 15 Apr 2026
Daily
16/04/2026
Ask Jiminny Test Report - 15 Apr 2026
Daily
16/04/2026
Test 6 - 13 Apr 2026
Daily
14/04/2026
Ask Jiminny Test Report - 13 Apr 2026
Daily
14/04/2026
Ask Jiminny Test Report - 13 Apr 2026
Daily
14/04/2026...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira","depth":4,"bounds":{"left":0.0018284575,"top":0.0518755,"width":0.07596409,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"bounds":{"left":0.0,"top":0.09497207,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"bounds":{"left":0.013297873,"top":0.10614525,"width":0.041888297,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20372] AI Reports > Empty page design and promotion - Jira","depth":4,"bounds":{"left":0.0,"top":0.12769353,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20372] AI Reports > Empty page design and promotion - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.13886672,"width":0.11319814,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"bounds":{"left":0.0,"top":0.16041501,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"bounds":{"left":0.013297873,"top":0.17158818,"width":0.041888297,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"bounds":{"left":0.0,"top":0.19313647,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"bounds":{"left":0.013297873,"top":0.20430966,"width":0.041888297,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"bounds":{"left":0.0,"top":0.22585794,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"bounds":{"left":0.013297873,"top":0.23703113,"width":0.041888297,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny MCP Connector - Product - Confluence","depth":4,"bounds":{"left":0.0,"top":0.2585794,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny MCP Connector - Product - Confluence","depth":5,"bounds":{"left":0.013297873,"top":0.2697526,"width":0.08294548,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny Mail","depth":4,"bounds":{"left":0.0,"top":0.29130086,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny Mail","depth":5,"bounds":{"left":0.013297873,"top":0.30247405,"width":0.02144282,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20500] Batch initial sync for Salesforce - Jira","depth":4,"bounds":{"left":0.0,"top":0.32402235,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20500] Batch initial sync for Salesforce - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.33519554,"width":0.08610372,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Feed — jiminny — Sentry","depth":4,"bounds":{"left":0.0,"top":0.3567438,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Feed — jiminny — Sentry","depth":5,"bounds":{"left":0.013297873,"top":0.367917,"width":0.042719416,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"bounds":{"left":0.0,"top":0.38946527,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"bounds":{"left":0.013297873,"top":0.40063846,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Pipelines - jiminny/app","depth":4,"bounds":{"left":0.0,"top":0.42218676,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pipelines - jiminny/app","depth":5,"bounds":{"left":0.013297873,"top":0.43335995,"width":0.039228722,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Formalize","depth":4,"bounds":{"left":0.0,"top":0.45490822,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Formalize","depth":5,"bounds":{"left":0.013297873,"top":0.4660814,"width":0.016788565,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[SRD-6793] Les Mills activity types not pulling in - Jira","depth":4,"bounds":{"left":0.0,"top":0.48762968,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[SRD-6793] Les Mills activity types not pulling in - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.49880287,"width":0.09524601,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Search results: calendar | Jiminny Help Center","depth":4,"bounds":{"left":0.0,"top":0.5203512,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Search results: calendar | Jiminny Help Center","depth":5,"bounds":{"left":0.013297873,"top":0.53152436,"width":0.080119684,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"bounds":{"left":0.0,"top":0.55307263,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"bounds":{"left":0.013297873,"top":0.5642458,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"bounds":{"left":0.0,"top":0.5857941,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Jiminny","depth":5,"bounds":{"left":0.013297873,"top":0.5969673,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.06732048,"top":0.59297687,"width":0.007978723,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.0028257978,"top":0.6201117,"width":0.07413564,"height":0.025538707},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.0028257978,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.013796543,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Tabs from other devices","depth":6,"bounds":{"left":0.024933511,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.036070477,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.04720745,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-18909-automated-reports-ask-jiminny ■ 874522","depth":9,"bounds":{"left":0.08028591,"top":0.9860335,"width":0.10056516,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"27","depth":12,"bounds":{"left":0.08228058,"top":0.91380686,"width":0.015957447,"height":0.035115723},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"27","depth":14,"bounds":{"left":0.09059176,"top":0.9173983,"width":0.004654255,"height":0.011971269},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"AI Reports","depth":13,"bounds":{"left":0.10887633,"top":0.06943336,"width":0.031416222,"height":0.019553073},"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"AI Reports","depth":14,"bounds":{"left":0.10887633,"top":0.06943336,"width":0.031416222,"height":0.019553073},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Ask Jiminny reports","depth":13,"bounds":{"left":0.62682843,"top":0.06464485,"width":0.059341755,"height":0.028731046},"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ask Jiminny reports","depth":14,"bounds":{"left":0.64045876,"top":0.07222666,"width":0.04105718,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXTextField","text":"Report name","depth":17,"bounds":{"left":0.12167553,"top":0.10933759,"width":0.058011968,"height":0.019952115},"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Period","depth":20,"bounds":{"left":0.19963431,"top":0.114924185,"width":0.012799202,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXComboBox","text":"Report Type Report Type","depth":16,"bounds":{"left":0.26944813,"top":0.10933759,"width":0.06615692,"height":0.019952115},"value":"Report Type Report Type","help_text":"","role_description":"combo box","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Report Type","depth":18,"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Report Type","depth":19,"bounds":{"left":0.26944813,"top":0.11292897,"width":0.023603724,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Clear all","depth":13,"bounds":{"left":0.34192154,"top":0.112529926,"width":0.028424202,"height":0.015961692},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"NAME","depth":16,"bounds":{"left":0.10854388,"top":0.1660016,"width":0.012965426,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"FREQUENCY","depth":16,"bounds":{"left":0.35854387,"top":0.1660016,"width":0.026263298,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"SHARED","depth":16,"bounds":{"left":0.4418218,"top":0.1660016,"width":0.017453458,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"DATE","depth":16,"bounds":{"left":0.52509975,"top":0.1660016,"width":0.011136968,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"ACTIONS","depth":16,"bounds":{"left":0.6085439,"top":0.1660016,"width":0.019115692,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Share With Team Test - Mar 2026","depth":17,"bounds":{"left":0.12184176,"top":0.21268955,"width":0.07014628,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Monthly","depth":17,"bounds":{"left":0.35854387,"top":0.21268955,"width":0.01662234,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"21/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.21268955,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Share With Team Test - Mar 2026","depth":17,"bounds":{"left":0.12184176,"top":0.25977653,"width":0.07014628,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Monthly","depth":17,"bounds":{"left":0.35854387,"top":0.25977653,"width":0.01662234,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"21/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.25977653,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Only Recorded Monthly - Ves Calls - Mar 2026","depth":17,"bounds":{"left":0.12184176,"top":0.30686352,"width":0.09757314,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Monthly","depth":17,"bounds":{"left":0.35854387,"top":0.30686352,"width":0.01662234,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"21/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.30686352,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Only Recorded Monthly - Ves Calls - Mar 2026","depth":17,"bounds":{"left":0.12184176,"top":0.35395053,"width":0.09757314,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Monthly","depth":17,"bounds":{"left":0.35854387,"top":0.35395053,"width":0.01662234,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"21/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.35395053,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Only Recorded Monthly - Ves Calls - Mar 2026","depth":17,"bounds":{"left":0.12184176,"top":0.4010375,"width":0.09757314,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Monthly","depth":17,"bounds":{"left":0.35854387,"top":0.4010375,"width":0.01662234,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"21/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.4010375,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Only Recorded Monthly - Ves Calls - Mar 2026","depth":17,"bounds":{"left":0.12184176,"top":0.4481245,"width":0.09757314,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Monthly","depth":17,"bounds":{"left":0.35854387,"top":0.4481245,"width":0.01662234,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"21/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.4481245,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Expires On - 20 April - New - 13 - 19 Apr 2026","depth":17,"bounds":{"left":0.12184176,"top":0.49521148,"width":0.09624335,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Monthly","depth":17,"bounds":{"left":0.35854387,"top":0.49521148,"width":0.01662234,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"20/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.49521148,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Expires On - 20 April - New - 13 - 19 Apr 2026","depth":17,"bounds":{"left":0.12184176,"top":0.5422985,"width":0.09624335,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Monthly","depth":17,"bounds":{"left":0.35854387,"top":0.5422985,"width":0.01662234,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"20/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.5422985,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Expires On - 20 April - New - 13 - 19 Apr 2026","depth":17,"bounds":{"left":0.12184176,"top":0.58938545,"width":0.09624335,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Monthly","depth":17,"bounds":{"left":0.35854387,"top":0.58938545,"width":0.01662234,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"20/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.58938545,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Expires On - 20 April - New - 13 - 19 Apr 2026","depth":17,"bounds":{"left":0.12184176,"top":0.63647246,"width":0.09624335,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Monthly","depth":17,"bounds":{"left":0.35854387,"top":0.63647246,"width":0.01662234,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"20/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.63647246,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Health - 9 - 15 Apr 2026","depth":17,"bounds":{"left":0.12184176,"top":0.6835595,"width":0.05069814,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Weekly","depth":17,"bounds":{"left":0.35854387,"top":0.6835595,"width":0.014960106,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"16/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.6835595,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Test 6 - 15 Apr 2026","depth":17,"bounds":{"left":0.12184176,"top":0.73064643,"width":0.042386968,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Daily","depth":17,"bounds":{"left":0.35854387,"top":0.73064643,"width":0.010139627,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"16/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.73064643,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Test 7 - 15 Apr 2026","depth":17,"bounds":{"left":0.12184176,"top":0.77773345,"width":0.042386968,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Daily","depth":17,"bounds":{"left":0.35854387,"top":0.77773345,"width":0.010139627,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"16/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.77773345,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ask Jiminny Test Report - 15 Apr 2026","depth":17,"bounds":{"left":0.12184176,"top":0.82482046,"width":0.080784574,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Daily","depth":17,"bounds":{"left":0.35854387,"top":0.82482046,"width":0.010139627,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"16/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.82482046,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Test 6 - 13 Apr 2026","depth":17,"bounds":{"left":0.12184176,"top":0.8719074,"width":0.042386968,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Daily","depth":17,"bounds":{"left":0.35854387,"top":0.8719074,"width":0.010139627,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"14/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.8719074,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ask Jiminny Test Report - 13 Apr 2026","depth":17,"bounds":{"left":0.12184176,"top":0.9189944,"width":0.080784574,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Daily","depth":17,"bounds":{"left":0.35854387,"top":0.9189944,"width":0.010139627,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"14/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.9189944,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Ask Jiminny Test Report - 13 Apr 2026","depth":17,"bounds":{"left":0.12184176,"top":0.9660814,"width":0.080784574,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Daily","depth":17,"bounds":{"left":0.35854387,"top":0.9660814,"width":0.010139627,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"14/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.9660814,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-8524314458828241255
|
-7622374253988746171
|
visual_change
|
accessibility
|
NULL
|
Platform Sprint 2 Q2 - Platform Team - Scrum Board Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira
Project Phoenix – Figma
Project Phoenix – Figma
[JY-20372] AI Reports > Empty page design and promotion - Jira
[JY-20372] AI Reports > Empty page design and promotion - Jira
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Jiminny MCP Connector - Product - Confluence
Jiminny MCP Connector - Product - Confluence
Jiminny Mail
Jiminny Mail
[JY-20500] Batch initial sync for Salesforce - Jira
[JY-20500] Batch initial sync for Salesforce - Jira
Feed — jiminny — Sentry
Feed — jiminny — Sentry
Jiminny
Jiminny
Pipelines - jiminny/app
Pipelines - jiminny/app
Formalize
Formalize
[SRD-6793] Les Mills activity types not pulling in - Jira
[SRD-6793] Les Mills activity types not pulling in - Jira
Search results: calendar | Jiminny Help Center
Search results: calendar | Jiminny Help Center
Jiminny
Jiminny
Jiminny
Jiminny
Close tab
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
JY-18909-automated-reports-ask-jiminny ■ 874522
27
27
AI Reports
AI Reports
Ask Jiminny reports
Ask Jiminny reports
Report name
Period
Report Type Report Type
Report Type
Report Type
Clear all
NAME
FREQUENCY
SHARED
DATE
ACTIONS
Share With Team Test - Mar 2026
Monthly
21/04/2026
Share With Team Test - Mar 2026
Monthly
21/04/2026
Only Recorded Monthly - Ves Calls - Mar 2026
Monthly
21/04/2026
Only Recorded Monthly - Ves Calls - Mar 2026
Monthly
21/04/2026
Only Recorded Monthly - Ves Calls - Mar 2026
Monthly
21/04/2026
Only Recorded Monthly - Ves Calls - Mar 2026
Monthly
21/04/2026
Expires On - 20 April - New - 13 - 19 Apr 2026
Monthly
20/04/2026
Expires On - 20 April - New - 13 - 19 Apr 2026
Monthly
20/04/2026
Expires On - 20 April - New - 13 - 19 Apr 2026
Monthly
20/04/2026
Expires On - 20 April - New - 13 - 19 Apr 2026
Monthly
20/04/2026
Health - 9 - 15 Apr 2026
Weekly
16/04/2026
Test 6 - 15 Apr 2026
Daily
16/04/2026
Test 7 - 15 Apr 2026
Daily
16/04/2026
Ask Jiminny Test Report - 15 Apr 2026
Daily
16/04/2026
Test 6 - 13 Apr 2026
Daily
14/04/2026
Ask Jiminny Test Report - 13 Apr 2026
Daily
14/04/2026
Ask Jiminny Test Report - 13 Apr 2026
Daily
14/04/2026...
|
66910
|
|
66967
|
NULL
|
0
|
2026-04-21T15:20:00.435618+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776784800435_m2.jpg...
|
Slack
|
Aneliya Angelova, Nikolay Yankov, Steliyan Georgie Aneliya Angelova, Nikolay Yankov, Steliyan Georgiev (DM) - Jiminny Inc - 2 new items - Slack...
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Aneliya Angelova
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Aneliya Angelova
Today at 5:45:34 PM
5:45 PM
@Nikolay Yankov
@Nikolay Yankov
Ники има една промяна която Галя иска в колоната SHARED
значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като "Shared With"
Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна
Today at 5:45:41 PM
5:45
тази промяна за теб ли е
Nikolay Yankov
Today at 5:48:38 PM
5:48 PM
ами от BE идва инфото какво да се покаже в тази колона -
recipients
полето
Today at 5:49:13 PM
5:49
Лукаш, можеш ли да го промениш
Aneliya Angelova
Today at 5:49:18 PM
5:49 PM
oki
Today at 5:49:35 PM
5:49
ще го опиша в сторито и това
Lukas Kovalik
Today at 5:50:29 PM
5:50 PM
да може
Today at 5:51:41 PM
5:51
това е само при Ask Jiminny или всички
Aneliya Angelova
Today at 5:52:05 PM
5:52 PM
Ask Jiminny
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Nikolay Yankov
Today at 5:55:21 PM
5:55 PM
kiosk-нах се с Аделина да видя за
Shared By
и ми направи впечатление, че тя като user, с когото е шернато, тя вижда и всички останли с които е шернато (в response-a на request-a, не в UI)
Мисля си, че ще е добре да го запечатаме това да не expose-ва информация за всички с които е шернато
какво мислите?
Untitled.png
Toggle file
Untitled.png
Download Untitled.png
Share file: Untitled.png
View canvas details
More actions
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
New
Aneliya Angelova
Today at 6:15:00 PM
6:15 PM
съгласна съм с Ники
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:18:27 PM
6:18 PM
аз няма претенции, мога да ги пропусна ако user не е creator
1 reaction, react with +1 emoji
1
Add reaction…
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Nikolay Yankov
is typing
Todor Stamatov, Direct Message, 1 of 15 suggestions
Nikolay Yankov is typing...
|
[{"role":"AXPopUpButton","text [{"role":"AXPopUpButton","text":"Switch workspaces… (Jiminny Inc) Has new messages","depth":14,"bounds":{"left":0.0056515955,"top":0.058260176,"width":0.011968086,"height":0.028731046},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"Home","depth":14,"bounds":{"left":0.0029920214,"top":0.10055866,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Home","depth":16,"bounds":{"left":0.0066489363,"top":0.13806863,"width":0.009973404,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"DMs","depth":14,"bounds":{"left":0.0029920214,"top":0.15482841,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"DMs","depth":16,"bounds":{"left":0.0076462766,"top":0.19233839,"width":0.007978723,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Activity","depth":14,"bounds":{"left":0.0029920214,"top":0.20909816,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Activity","depth":16,"bounds":{"left":0.004986702,"top":0.24660814,"width":0.012965426,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":14,"bounds":{"left":0.0029920214,"top":0.26336792,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":16,"bounds":{"left":0.0076462766,"top":0.3008779,"width":0.0076462766,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Later","depth":14,"bounds":{"left":0.0029920214,"top":0.31763768,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Later","depth":16,"bounds":{"left":0.00731383,"top":0.35514766,"width":0.008643617,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"More…","depth":14,"bounds":{"left":0.0029920214,"top":0.3719074,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More","depth":16,"bounds":{"left":0.006981383,"top":0.4094174,"width":0.008976064,"height":0.0103751},"role_description":"text"},{"role":"AXStaticText","text":"Unreads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Threads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Huddles","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Drafts & sent","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Directories","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-x-integration-app","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-inner-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"ai-chapter","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"alerts","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"backend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"c-learning-people","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"confusion-clinic","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"curiosity_lab","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"engineering","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"frontend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"general","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"infra-changes","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-bg","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-copilot-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-zoom-phone-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-tickets","depth":23,"bounds":{"left":0.042220745,"top":0.09736632,"width":0.034906916,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"product_launches","depth":23,"bounds":{"left":0.042220745,"top":0.11971269,"width":0.03856383,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"random","depth":23,"bounds":{"left":0.042220745,"top":0.14205906,"width":0.01662234,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"releases","depth":23,"bounds":{"left":0.042220745,"top":0.16440542,"width":0.01761968,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"support","depth":23,"bounds":{"left":0.042220745,"top":0.1867518,"width":0.016954787,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"thank-yous","depth":23,"bounds":{"left":0.042220745,"top":0.20909816,"width":0.024268618,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"the_people_of_jiminny","depth":23,"bounds":{"left":0.042220745,"top":0.23144454,"width":0.04488032,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"bounds":{"left":0.042220745,"top":0.28411812,"width":0.03756649,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"bounds":{"left":0.07945479,"top":0.28411812,"width":0.0063164895,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"bounds":{"left":0.08211436,"top":0.28411812,"width":0.014295213,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"bounds":{"left":0.09607713,"top":0.30167598,"width":0.0003324468,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Steliyan Georgiev","depth":23,"bounds":{"left":0.09607713,"top":0.30167598,"width":0.0003324468,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"bounds":{"left":0.042220745,"top":0.3064645,"width":0.03756649,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Mario Georgiev","depth":23,"bounds":{"left":0.042220745,"top":0.32881084,"width":0.033909574,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"bounds":{"left":0.042220745,"top":0.35115722,"width":0.032912236,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Todor Stamatov","depth":23,"bounds":{"left":0.042220745,"top":0.3735036,"width":0.034242023,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Gabriela Dureva","depth":23,"bounds":{"left":0.042220745,"top":0.39584997,"width":0.03523936,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Petko Kashinski","depth":23,"bounds":{"left":0.042220745,"top":0.41819632,"width":0.034242023,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Vasil Vasilev","depth":23,"bounds":{"left":0.042220745,"top":0.4405427,"width":0.026263298,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Nikolov","depth":23,"bounds":{"left":0.042220745,"top":0.46288908,"width":0.034242023,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Galya Dimitrova","depth":23,"bounds":{"left":0.042220745,"top":0.48523542,"width":0.034906916,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Stefka Stoyanova","depth":23,"bounds":{"left":0.042220745,"top":0.50758183,"width":0.03756649,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tomov","depth":23,"bounds":{"left":0.042220745,"top":0.52992815,"width":0.030585106,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tanev","depth":23,"bounds":{"left":0.042220745,"top":0.5522745,"width":0.028922873,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Ivanov","depth":23,"bounds":{"left":0.042220745,"top":0.5746209,"width":0.031914894,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Ves","depth":23,"bounds":{"left":0.042220745,"top":0.5969673,"width":0.0076462766,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Jira Cloud","depth":23,"bounds":{"left":0.042220745,"top":0.64964086,"width":0.022273935,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Toast","depth":23,"bounds":{"left":0.042220745,"top":0.67198724,"width":0.011635638,"height":0.014365523},"role_description":"text"},{"role":"AXRadioButton","text":"Messages","depth":17,"bounds":{"left":0.10206117,"top":0.09177973,"width":0.030585106,"height":0.030327214},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Messages","depth":19,"bounds":{"left":0.111369684,"top":0.10055866,"width":0.01861702,"height":0.012769354},"role_description":"text"},{"role":"AXRadioButton","text":"Add canvas","depth":18,"bounds":{"left":0.13397606,"top":0.09177973,"width":0.033909574,"height":0.030327214},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Add canvas","depth":20,"bounds":{"left":0.14328457,"top":0.10055866,"width":0.021941489,"height":0.012769354},"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":17,"bounds":{"left":0.16921543,"top":0.09177973,"width":0.020944148,"height":0.030327214},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":19,"bounds":{"left":0.17852394,"top":0.10055866,"width":0.008976064,"height":0.012769354},"role_description":"text"},{"role":"AXPopUpButton","text":"Add and Edit Channel Tabs","depth":17,"bounds":{"left":0.19115691,"top":0.09177973,"width":0.010970744,"height":0.030327214},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Canvas","depth":17,"bounds":{"left":0.096409574,"top":0.0518755,"width":0.015625,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"List","depth":17,"bounds":{"left":0.096409574,"top":0.0518755,"width":0.0076462766,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Folder","depth":17,"bounds":{"left":0.096409574,"top":0.0518755,"width":0.013962766,"height":0.0007980846},"role_description":"text"},{"role":"AXPopUpButton","text":"Jump to date","depth":23,"bounds":{"left":0.15026596,"top":0.12689546,"width":0.025265958,"height":0.022346368},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:45:34 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:45 PM","depth":25,"role_description":"text"},{"role":"AXLink","text":"@Nikolay Yankov","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"@Nikolay Yankov","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"Ники има една промяна която Галя иска в колоната SHARED","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като \"Shared With\"","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна","depth":25,"role_description":"text"},{"role":"AXLink","text":"Today at 5:45:41 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:45","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"тази промяна за теб ли е","depth":25,"role_description":"text"},{"role":"AXButton","text":"Nikolay Yankov","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:48:38 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:48 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"ами от BE идва инфото какво да се покаже в тази колона -","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"recipients","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"полето","depth":25,"role_description":"text"},{"role":"AXLink","text":"Today at 5:49:13 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:49","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"Лукаш, можеш ли да го промениш","depth":25,"role_description":"text"},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:49:18 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:49 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"oki","depth":25,"role_description":"text"},{"role":"AXLink","text":"Today at 5:49:35 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:49","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"ще го опиша в сторито и това","depth":25,"role_description":"text"},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:50:29 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:50 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"да може","depth":25,"role_description":"text"},{"role":"AXLink","text":"Today at 5:51:41 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:51","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"това е само при Ask Jiminny или всички","depth":25,"role_description":"text"},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"bounds":{"left":0.11801862,"top":0.121308856,"width":0.038896278,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.15658244,"top":0.12290503,"width":0.0029920214,"height":0.015163607},"role_description":"text"},{"role":"AXLink","text":"Today at 5:52:05 PM","depth":24,"bounds":{"left":0.15924202,"top":0.12529927,"width":0.015292553,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:52 PM","depth":25,"bounds":{"left":0.15924202,"top":0.12529927,"width":0.015292553,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"Ask Jiminny","depth":25,"bounds":{"left":0.11801862,"top":0.14046289,"width":0.025930852,"height":0.015163607},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.11572227,"width":0.010638298,"height":0.018355945},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.11572227,"width":0.010638298,"height":0.018355945},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.11572227,"width":0.010638298,"height":0.018355945},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.11572227,"width":0.010638298,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.11572227,"width":0.010638298,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.11572227,"width":0.0003324468,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.11572227,"width":0.0003324468,"height":0.018355945},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.11572227,"width":0.0003324468,"height":0.018355945},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Nikolay Yankov","depth":24,"bounds":{"left":0.11801862,"top":0.16280925,"width":0.034242023,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.15226063,"top":0.16440542,"width":0.0026595744,"height":0.015163607},"role_description":"text"},{"role":"AXLink","text":"Today at 5:55:21 PM","depth":24,"bounds":{"left":0.1549202,"top":0.16679968,"width":0.014960106,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:55 PM","depth":25,"bounds":{"left":0.1549202,"top":0.16679968,"width":0.014960106,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"kiosk-нах се с Аделина да видя за","depth":25,"bounds":{"left":0.11801862,"top":0.1819633,"width":0.078457445,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"Shared By","depth":26,"bounds":{"left":0.1974734,"top":0.18435754,"width":0.021941489,"height":0.012769354},"role_description":"text"},{"role":"AXStaticText","text":"и ми направи впечатление, че тя като user, с когото е шернато, тя вижда и всички останли с които е шернато (в response-a на request-a, не в UI)","depth":25,"bounds":{"left":0.11801862,"top":0.19952115,"width":0.10139628,"height":0.06783719},"role_description":"text"},{"role":"AXStaticText","text":"Мисля си, че ще е добре да го запечатаме това да не expose-ва информация за всички с които е шернато","depth":25,"bounds":{"left":0.11801862,"top":0.2697526,"width":0.10073138,"height":0.05027933},"role_description":"text"},{"role":"AXStaticText","text":"какво мислите?","depth":25,"bounds":{"left":0.11801862,"top":0.32242617,"width":0.035904255,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"Untitled.png","depth":25,"bounds":{"left":0.11801862,"top":0.34397447,"width":0.023603724,"height":0.013567438},"role_description":"text"},{"role":"AXStaticText","text":"","depth":25,"bounds":{"left":0.14128989,"top":0.34317636,"width":0.0016622341,"height":0.015163607},"role_description":"text"},{"role":"AXButton","text":"Toggle file","depth":25,"bounds":{"left":0.14261968,"top":0.3423783,"width":0.006981383,"height":0.016759777},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXLink","text":"Untitled.png","depth":27,"bounds":{"left":0.11801862,"top":0.3623304,"width":0.1043883,"height":0.118914604},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Download Untitled.png","depth":28,"bounds":{"left":0.17519946,"top":0.3735036,"width":0.010638298,"height":0.026336791},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Share file: Untitled.png","depth":28,"bounds":{"left":0.18583776,"top":0.3735036,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View canvas details","depth":28,"bounds":{"left":0.19647606,"top":0.3735036,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":28,"bounds":{"left":0.20711437,"top":0.3735036,"width":0.010638298,"height":0.026336791},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.14924182,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.14924182,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.14924182,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.14924182,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.14924182,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.14924182,"width":0.0003324468,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.14924182,"width":0.0003324468,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.14924182,"width":0.0003324468,"height":0.026336791},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"New","depth":22,"bounds":{"left":0.21343085,"top":0.48044693,"width":0.00930851,"height":0.012769354},"role_description":"text"},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"bounds":{"left":0.11801862,"top":0.49002394,"width":0.038896278,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.15658244,"top":0.49162012,"width":0.0029920214,"height":0.015163607},"role_description":"text"},{"role":"AXLink","text":"Today at 6:15:00 PM","depth":24,"bounds":{"left":0.15924202,"top":0.49401435,"width":0.015292553,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:15 PM","depth":25,"bounds":{"left":0.15924202,"top":0.49401435,"width":0.015292553,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"съгласна съм с Ники","depth":25,"bounds":{"left":0.11801862,"top":0.509178,"width":0.04720745,"height":0.015163607},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.4764565,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.4764565,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.4764565,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.4764565,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.4764565,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.4764565,"width":0.0003324468,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.4764565,"width":0.0003324468,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.4764565,"width":0.0003324468,"height":0.026336791},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"bounds":{"left":0.11801862,"top":0.53152436,"width":0.030917553,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.14860372,"top":0.5331205,"width":0.0029920214,"height":0.015163607},"role_description":"text"},{"role":"AXLink","text":"Today at 6:18:27 PM","depth":24,"bounds":{"left":0.1512633,"top":0.5355148,"width":0.015292553,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:18 PM","depth":25,"bounds":{"left":0.1512633,"top":0.5355148,"width":0.015292553,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"аз няма претенции, мога да ги пропусна ако user не е creator","depth":25,"bounds":{"left":0.11801862,"top":0.5506784,"width":0.10139628,"height":0.032721467},"role_description":"text"},{"role":"AXCheckBox","text":"1 reaction, react with +1 emoji","depth":25,"bounds":{"left":0.11801862,"top":0.58739024,"width":0.014295213,"height":0.019952115},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"1","depth":26,"bounds":{"left":0.12732713,"top":0.5913807,"width":0.0023271276,"height":0.011971269},"role_description":"text"},{"role":"AXButton","text":"Add reaction…","depth":25,"bounds":{"left":0.13331117,"top":0.58739024,"width":0.011635638,"height":0.019952115},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.5179569,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.5179569,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.5179569,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.5179569,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.5179569,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.5179569,"width":0.0003324468,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.5179569,"width":0.0003324468,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.5179569,"width":0.0003324468,"height":0.026336791},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"","depth":23,"bounds":{"left":0.10372341,"top":0.6272945,"width":0.118351065,"height":0.030327214},"value":"","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Nikolay Yankov","depth":19,"bounds":{"left":0.107380316,"top":0.6943336,"width":0.023603724,"height":0.0103751},"role_description":"text"},{"role":"AXStaticText","text":"is typing","depth":19,"bounds":{"left":0.1306516,"top":0.6943336,"width":0.013962766,"height":0.0103751},"role_description":"text"},{"role":"AXStaticText","text":"Todor Stamatov, Direct Message, 1 of 15 suggestions","depth":11,"bounds":{"left":0.0,"top":0.7126895,"width":0.026263298,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov is typing","depth":11,"bounds":{"left":0.0,"top":0.7126895,"width":0.015625,"height":0.0007980846},"role_description":"text"}]...
|
-8533084208619472249
|
-1207786247622066063
|
click
|
hybrid
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Aneliya Angelova
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Aneliya Angelova
Today at 5:45:34 PM
5:45 PM
@Nikolay Yankov
@Nikolay Yankov
Ники има една промяна която Галя иска в колоната SHARED
значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като "Shared With"
Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна
Today at 5:45:41 PM
5:45
тази промяна за теб ли е
Nikolay Yankov
Today at 5:48:38 PM
5:48 PM
ами от BE идва инфото какво да се покаже в тази колона -
recipients
полето
Today at 5:49:13 PM
5:49
Лукаш, можеш ли да го промениш
Aneliya Angelova
Today at 5:49:18 PM
5:49 PM
oki
Today at 5:49:35 PM
5:49
ще го опиша в сторито и това
Lukas Kovalik
Today at 5:50:29 PM
5:50 PM
да може
Today at 5:51:41 PM
5:51
това е само при Ask Jiminny или всички
Aneliya Angelova
Today at 5:52:05 PM
5:52 PM
Ask Jiminny
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Nikolay Yankov
Today at 5:55:21 PM
5:55 PM
kiosk-нах се с Аделина да видя за
Shared By
и ми направи впечатление, че тя като user, с когото е шернато, тя вижда и всички останли с които е шернато (в response-a на request-a, не в UI)
Мисля си, че ще е добре да го запечатаме това да не expose-ва информация за всички с които е шернато
какво мислите?
Untitled.png
Toggle file
Untitled.png
Download Untitled.png
Share file: Untitled.png
View canvas details
More actions
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
New
Aneliya Angelova
Today at 6:15:00 PM
6:15 PM
съгласна съм с Ники
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:18:27 PM
6:18 PM
аз няма претенции, мога да ги пропусна ако user не е creator
1 reaction, react with +1 emoji
1
Add reaction…
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Nikolay Yankov
is typing
Todor Stamatov, Direct Message, 1 of 15 suggestions
Nikolay Yankov is typing
HomeActivitsMoreSlackcalVIewJiminny ...# platform-tickets# product launchesa random# releases# support# thank-yous# the people of iimi.ó Direct messages(3 Aneliya Angelova, ...f. Aneliya AngelovaMario Georgiev• Nikolav YankovSs: Todor StamatovP Gabriela DurevalPetko Kashinski8 Vasil VasilevNikolav NikolovGalya DimitrovaA Stefka Stovanova#Ctovan TomowStovan TaneyNikolav IvanovVes::: AppsJira CloudTostRecordSelector.phoT ResolvecompanvNameByEmaC) TimePeriod terator.ono> Mimport›M InternallKioskv N AutomatedRenortsC) ActivitvTvoeService.ohoC) Ask.liminnvRenortActivitvS(c) AutomatedRenortsCallbackC AutomatedReportsService.(C) Dea|StadecService nhn(C) RecinientsService nhnmistonWindowhelp@ Describe what you are looking for* Aneliya Angelova, ...MessagesAdd canvaUr FilesAhellya Angelc TodayAsk JiminnyNikolay Yankov 5:55PMkiosk-нaх cе с Аделина да видя за Shared вукогото е шеонато, тя вижла и всичкиостанли с които е шернато (в response-a нarequest-a, нe в UDМисля си, че ще е лобре ла го запечатаметова ла не expose-ва информация за всички.с които е шернатокакво мислитеUntitled.ongaкepoпskepository.onp(C) Service.php© Field.phpervice.phpOkeporcontroller.onpC)AutomatedReportsSendcommano.ong©) AutomatedReportsServiceTest.php©)ActivityLogged.php© AutomatedReportsCallbackService.phg© RequestGenerateAskJi:Results(Collection SautomatedReportResults): arraythis->transformReportType(Sreport->getTypeO)).chis->oenerarekeporckesulcUown LoadurL saucomareokeporckesuLco>generateReportResultViewUrl(SautomatedReportResult)automatedReportResult->getbeneratedAto?->to1so8601Strina0.Aneliya Angelova 6:15 PMсьгласна сьм с никиLukas Kovalik 6:18 PMаз няма претенции, мога да ги пропусна акоuser He e creatorMessage Aneliya Angetova, Nikolay Yankov, Steli..+ Aa €'sAutomatedRenort Srenort): arravl-Cnpator 02->aetllund0array_filterdents(Sreport->getRecipientsO).fient): bool => Srecipient['id'] !== $creatorUuid,Report)) {... arrayvalues(sth1s->transtormbroupsteam: Sreport-›getreamo, groupsids: Sreport->getbroupso0)...Sreciplents)3 usagespublic function hasCallTypeConference(AutomatedReport $report): bool{...;3 usaaespublic function hasCallTypeDialer(AutomatedReport $report): boolf...}tnansformens1 usageprivate function transformTeam(Team Steam): array{...}A102 X3 X34 ^ V Q 161166175177—179182_184=1891 187_193192— 194196200204=custom.log4 SF [jiminny@localhost] X# concole [ppon1A ho_local Uiminny@localnostA console (EU]report-not-generated.blade.phgC) sendreportNotGenerateamallJob.phpA console [STAGING]e jiminnyFELECT * FROM activity_searches whereELECT * FROM activity search filters WiEKe aLLvi SEN-D18 A14 22 24 ME"ELECT * FROM automated_reports where 1d = 68)IPDATE automated_reports set playbook categories = NULL where id¡ELECT * FROM automated_report_results where id = 275;¡ELECT * FROM automated_reports order by id desc;ELECT * FROM automated_report_results order by id desc;ielect * from activity_searches where user_id = 143;elect * From ask anvthina nromnts.¡ELECT * FROM groups WHERE id = 1439;ELECT * FROM users WHERE group_id = 1439;ielect * from permissions; # 158elect x tron roleselect * from permission_roleielect * from teams where id = 1:ielect * from groups q JOIN playbooks p 1..n<->1: on g.playbook idelect * trom qroups where 1d = 281ielect * from playbooks where team id = 1:elect * trom playbooks where 10 = 1791ielect * from playbook categories where id = 1391:elect * trom users where 10 = 1451ielect * from crm profiles where user 1d = 145%elect * from activities where crm_configuration_id = 39 and typend crm orovider id IS NOT NULL ORDER by id desc:elect * from activities where id = 422003: # 00U04000000B6foMACELECT ar.id, ar.uuid, ar.media type, ar.status, a.typeROM automated renont results anOIN automated_reports a ON a.id = ar.report.idTHERE a.type ='ask_jiminnyITMTT 10•HELECTautomated_report_results.* FROMNNEP IOTM 'automatod nonontelMHEpsautomated_report_results'.'report_id' = automated_reports"automatod nonont noculte' 'aononatod at'TC MOT MuLIANDautomated_reports'.'team_id' = 1AND JSON_CONTAINS('automated_reports'.'recipients'. 1635, '$."yAsk anvthina (84-D+ « Code IClaude Qnus 4.7 Medium100% SzTue 21 Apr 18:20:00CascadeReview Planhat IntearAutomated Reports RCalendar Multi-Domal+O •run tests and fix if not passingdeste/umt/Reposcor/es/Au tona tedheportsReposttorytest.php lest5/inst/Pol1ctes/CanAcCe3sA.Reportstest. php/tects/linit/Policies/GanAcceccAiRenortsTect.ohn 2>61PHPUnit 11.5.55 by Sebastian Beramann and contrilbutors.PhP 0.3:30Configuration: /home/jaminny/phpunit.xml95 4 452 127939 / 453 ( 419A|| 453 tests pass (6 pre-existina skiooed. 5 unrelated PHPUnit deprecation notices). No fixes needed.Teal aePo. 4 spac...
|
66965
|
|
66968
|
NULL
|
0
|
2026-04-21T15:20:00.435559+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776784800435_m1.jpg...
|
Slack
|
Aneliya Angelova, Nikolay Yankov, Steliyan Georgie Aneliya Angelova, Nikolay Yankov, Steliyan Georgiev (DM) - Jiminny Inc - 2 new items - Slack...
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Aneliya Angelova
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Aneliya Angelova
Today at 5:45:34 PM
5:45 PM
@Nikolay Yankov
@Nikolay Yankov
Ники има една промяна която Галя иска в колоната SHARED
значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като "Shared With"
Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна
Today at 5:45:41 PM
5:45
тази промяна за теб ли е
Nikolay Yankov
Today at 5:48:38 PM
5:48 PM
ами от BE идва инфото какво да се покаже в тази колона -
recipients
полето
Today at 5:49:13 PM
5:49
Лукаш, можеш ли да го промениш
Aneliya Angelova
Today at 5:49:18 PM
5:49 PM
oki
Today at 5:49:35 PM
5:49
ще го опиша в сторито и това
Lukas Kovalik
Today at 5:50:29 PM
5:50 PM
да може
Today at 5:51:41 PM
5:51
това е само при Ask Jiminny или всички
Aneliya Angelova
Today at 5:52:05 PM
5:52 PM
Ask Jiminny
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Nikolay Yankov
Today at 5:55:21 PM
5:55 PM
kiosk-нах се с Аделина да видя за
Shared By
и ми направи впечатление, че тя като user, с когото е шернато, тя вижда и всички останли с които е шернато (в response-a на request-a, не в UI)
Мисля си, че ще е добре да го запечатаме това да не expose-ва информация за всички с които е шернато
какво мислите?
Untitled.png
Toggle file
Untitled.png
Download Untitled.png
Share file: Untitled.png
View canvas details
More actions
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
New
Aneliya Angelova
Today at 6:15:00 PM
6:15 PM
съгласна съм с Ники
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:18:27 PM
6:18 PM
аз няма претенции, мога да ги пропусна ако user не е creator
1 reaction, react with +1 emoji
1
Add reaction…
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Nikolay Yankov
is typing
Todor Stamatov, Direct Message, 1 of 15 suggestions
Nikolay Yankov is typing...
|
[{"role":"AXPopUpButton","text [{"role":"AXPopUpButton","text":"Switch workspaces… (Jiminny Inc) Has new messages","depth":14,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"Home","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Home","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"DMs","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"DMs","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"Activity","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Activity","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"Later","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Later","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"More…","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More","depth":16,"role_description":"text"},{"role":"AXStaticText","text":"Unreads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Threads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Huddles","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Drafts & sent","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Directories","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-x-integration-app","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-inner-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"ai-chapter","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"alerts","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"backend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"c-learning-people","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"confusion-clinic","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"curiosity_lab","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"engineering","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"frontend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"general","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"infra-changes","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-bg","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-copilot-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-zoom-phone-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-tickets","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"product_launches","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"random","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"releases","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"support","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"thank-yous","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"the_people_of_jiminny","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Steliyan Georgiev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Mario Georgiev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Todor Stamatov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Gabriela Dureva","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Petko Kashinski","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Vasil Vasilev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Nikolov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Galya Dimitrova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Stefka Stoyanova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tomov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tanev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Ivanov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Ves","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Jira Cloud","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Toast","depth":23,"role_description":"text"},{"role":"AXRadioButton","text":"Messages","depth":17,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Messages","depth":19,"role_description":"text"},{"role":"AXRadioButton","text":"Add canvas","depth":18,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Add canvas","depth":20,"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":17,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":19,"role_description":"text"},{"role":"AXPopUpButton","text":"Add and Edit Channel Tabs","depth":17,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Canvas","depth":17,"role_description":"text"},{"role":"AXStaticText","text":"List","depth":17,"role_description":"text"},{"role":"AXStaticText","text":"Folder","depth":17,"role_description":"text"},{"role":"AXPopUpButton","text":"Jump to date","depth":23,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:45:34 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:45 PM","depth":25,"role_description":"text"},{"role":"AXLink","text":"@Nikolay Yankov","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"@Nikolay Yankov","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"Ники има една промяна която Галя иска в колоната SHARED","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като \"Shared With\"","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна","depth":25,"role_description":"text"},{"role":"AXLink","text":"Today at 5:45:41 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:45","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"тази промяна за теб ли е","depth":25,"role_description":"text"},{"role":"AXButton","text":"Nikolay Yankov","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:48:38 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:48 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"ами от BE идва инфото какво да се покаже в тази колона -","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"recipients","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"полето","depth":25,"role_description":"text"},{"role":"AXLink","text":"Today at 5:49:13 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:49","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"Лукаш, можеш ли да го промениш","depth":25,"role_description":"text"},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:49:18 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:49 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"oki","depth":25,"role_description":"text"},{"role":"AXLink","text":"Today at 5:49:35 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:49","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"ще го опиша в сторито и това","depth":25,"role_description":"text"},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:50:29 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:50 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"да може","depth":25,"role_description":"text"},{"role":"AXLink","text":"Today at 5:51:41 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:51","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"това е само при Ask Jiminny или всички","depth":25,"role_description":"text"},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:52:05 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:52 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"Ask Jiminny","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Nikolay Yankov","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:55:21 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:55 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"kiosk-нах се с Аделина да видя за","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"Shared By","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"и ми направи впечатление, че тя като user, с когото е шернато, тя вижда и всички останли с които е шернато (в response-a на request-a, не в UI)","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"Мисля си, че ще е добре да го запечатаме това да не expose-ва информация за всички с които е шернато","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"какво мислите?","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"Untitled.png","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"","depth":25,"role_description":"text"},{"role":"AXButton","text":"Toggle file","depth":25,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXLink","text":"Untitled.png","depth":27,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Download Untitled.png","depth":28,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Share file: Untitled.png","depth":28,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View canvas details","depth":28,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":28,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"New","depth":22,"role_description":"text"},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:15:00 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:15 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"съгласна съм с Ники","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:18:27 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:18 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"аз няма претенции, мога да ги пропусна ако user не е creator","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"1 reaction, react with +1 emoji","depth":25,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"1","depth":26,"role_description":"text"},{"role":"AXButton","text":"Add reaction…","depth":25,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"","depth":23,"value":"","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Nikolay Yankov","depth":19,"role_description":"text"},{"role":"AXStaticText","text":"is typing","depth":19,"role_description":"text"},{"role":"AXStaticText","text":"Todor Stamatov, Direct Message, 1 of 15 suggestions","depth":11,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov is typing","depth":11,"role_description":"text"}]...
|
-8533084208619472249
|
-1207786247622066063
|
click
|
hybrid
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Aneliya Angelova
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Aneliya Angelova
Today at 5:45:34 PM
5:45 PM
@Nikolay Yankov
@Nikolay Yankov
Ники има една промяна която Галя иска в колоната SHARED
значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като "Shared With"
Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна
Today at 5:45:41 PM
5:45
тази промяна за теб ли е
Nikolay Yankov
Today at 5:48:38 PM
5:48 PM
ами от BE идва инфото какво да се покаже в тази колона -
recipients
полето
Today at 5:49:13 PM
5:49
Лукаш, можеш ли да го промениш
Aneliya Angelova
Today at 5:49:18 PM
5:49 PM
oki
Today at 5:49:35 PM
5:49
ще го опиша в сторито и това
Lukas Kovalik
Today at 5:50:29 PM
5:50 PM
да може
Today at 5:51:41 PM
5:51
това е само при Ask Jiminny или всички
Aneliya Angelova
Today at 5:52:05 PM
5:52 PM
Ask Jiminny
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Nikolay Yankov
Today at 5:55:21 PM
5:55 PM
kiosk-нах се с Аделина да видя за
Shared By
и ми направи впечатление, че тя като user, с когото е шернато, тя вижда и всички останли с които е шернато (в response-a на request-a, не в UI)
Мисля си, че ще е добре да го запечатаме това да не expose-ва информация за всички с които е шернато
какво мислите?
Untitled.png
Toggle file
Untitled.png
Download Untitled.png
Share file: Untitled.png
View canvas details
More actions
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
New
Aneliya Angelova
Today at 6:15:00 PM
6:15 PM
съгласна съм с Ники
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:18:27 PM
6:18 PM
аз няма претенции, мога да ги пропусна ако user не е creator
1 reaction, react with +1 emoji
1
Add reaction…
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Nikolay Yankov
is typing
Todor Stamatov, Direct Message, 1 of 15 suggestions
Nikolay Yankov is typing
iTerm2ShellEditViewSessionScriptsProfilesWindowHelpБГ100% <78-zsh* Build full day activity...• *4|DOCKER-zshworker-nudges:worker-nudges_00: started₴2-zshscreenpipe*What's next:Try Docker Debug for seamless, persistent debugging tools in any container or image + docker debug docker_lamp_1Learn moreat [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-18909-automated-reports-ask-jiminny) $ csfixdockerexec -it docker_lamp_1./vendor/bin/php-cs-fixer fix--config=.php-cs-fixer.dist.php -v --using-cache=no --diffPHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.PHPruntime:8.3.30Running analysis on 7 cores with 10 files per process.Parallel runner is an experimental feature and may be unstable, use it at your own risk. Feedback highly appreciated!Loadedconfigdefault from-php-cs-fixer.dist.php".5609/5609100%= 285-zsh86Tue 21 Apr 18:20:00APP (-zsh)T₴1+Fixed 0 of 5609 files in 36.627 seconds, 60.00 MB memory usedWhat's next:Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-18909-automated-reports-ask-jiminny) $ ||...
|
66966
|
|
66969
|
1510
|
0
|
2026-04-21T15:20:18.146827+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776784818146_m2.jpg...
|
PhpStorm
|
faVsco.js – AutomatedReportsService.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsServiceTest
Run 'AutomatedReportsServiceTest'
Debug 'AutomatedReportsServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
102
3
34
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Kiosk\AutomatedReports;
use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Carbon\Exceptions\InvalidFormatException;
use DateTime;
use DateTimeInterface;
use DateTimeZone;
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcher;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Jiminny\Component\ActivitySearch\FilterDefinition\InputTypeEnum;
use Jiminny\Component\AskAnything\AskAnythingPromptService;
use Jiminny\Component\AskAnything\Dtos\AskAnythingPromptDto;
use Jiminny\Component\UrlGenerator\Webhook;
use Jiminny\Contracts\Repositories\PlaybookCategoryRepository;
use Jiminny\Contracts\Repositories\TeamRepository;
use Jiminny\Contracts\Repositories\UserRepository;
use Jiminny\Exceptions\ApplicationException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Exceptions\ModelNotFoundException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateReportJob;
use Jiminny\Models\Activity\Search;
use Jiminny\Models\AskAnything\AskAnythingPrompt;
use Jiminny\Models\AskAnything\AskAnythingPromptTarget;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Contracts\UserContract;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AskAnythingRepository;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Repositories\GroupRepository;
use Jiminny\Repositories\SearchRepository;
use Jiminny\Repositories\StageRepository;
use Throwable;
class AutomatedReportsService
{
public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';
public const string TYPE_ASK_JIMINNY = 'ask_jiminny';
/**
* Standard report types (used by kiosk for existing automated reports).
*/
// @TODO this will add filter, however if we need to control feature by FF we need conditional logic
public const array TYPES = [
['id' => 'exec_summary', 'name' => 'Exec Summary'],
['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],
['id' => 'product_feedback', 'name' => 'Product Feedback'],
['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],
// ['id' => 'questions', 'name' => 'Questions'],
// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],
];
public const array ALL_TYPES = [
...self::TYPES,
['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],
];
public const string FREQUENCY_DAILY = 'daily';
public const string FREQUENCY_WEEKLY = 'weekly';
public const string FREQUENCY_MONTHLY = 'monthly';
public const string FREQUENCY_QUARTERLY = 'quarterly';
public const string FREQUENCY_ONE_OFF = 'one_off';
/**
* Frequencies for standard (non-Ask Jiminny) reports.
*/
public const array FREQUENCIES = [
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
/**
* Frequencies for Ask Jiminny reports.
*/
public const array ASK_JIMINNY_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
];
public const string MEDIA_TYPE_PDF = 'pdf';
public const string MEDIA_TYPE_PODCAST = 'podcast';
public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];
public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];
public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];
public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];
public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];
public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];
public const int SENT_REPORT_AT_HOURS = 5;
public const string PDF_KEY = 'pdf';
public const string AUDIO_KEY = 'audio';
private const array ALL_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
private const string S3_DIR = 'reports';
private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];
private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];
public function __construct(
private readonly TeamRepository $teamRepository,
private readonly GroupRepository $groupRepository,
private readonly UserRepository $userRepository,
private readonly StageRepository $stageRepository,
private readonly DealStagesService $dealStagesService,
private readonly RecipientsService $recipientsService,
private readonly AutomatedReportsRepository $automatedReportsRepository,
private readonly Webhook $webhookService,
private readonly BusDispatcher $dispatcher,
private readonly ActivityTypeService $activityTypeService,
private readonly PlaybookCategoryRepository $playbookCategoryRepository,
private readonly AskAnythingPromptService $askAnythingPromptService,
private readonly SearchRepository $activitySearchRepository,
private readonly AskAnythingRepository $askAnythingRepository,
) {
}
public static function getTypes(): array
{
$types = self::TYPES;
return array_map(static function ($type) {
return $type['id'];
}, $types);
}
public static function getCallTypes(): array
{
return array_map(static function ($callType) {
return $callType['id'];
}, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);
}
public static function getFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::FREQUENCIES);
}
// front-facing structure
public function getReportEnabledFieldData(bool $value = false): array
{
return [
'id' => 'report_enabled',
'label' => '',
'inputType' => InputTypeEnum::TOGGLE,
'value' => $value,
];
}
// Organizations = Teams
public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array
{
$options = $this->getTeams();
if ($shortVersion) {
return [
'id' => 'organization',
'label' => 'Organization',
'options' => $options,
];
}
return [
'id' => 'organization',
'label' => 'Organization',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $options,
'value' => $value,
'dependencies' => [
'teams',
'deal_stage_at_call',
'current_deal_stage',
'recipients',
ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,
],
'dependsOn' => [],
];
}
// Teams = Groups
public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array
{
if ($shortVersion) {
return [
'id' => 'teams',
'label' => 'Team',
'options' => $options,
];
}
return [
'id' => 'teams',
'label' => 'Team',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => false,
'placeholder' => 'Select',
'options' => $options,
'value' => $value, // value should be an array of objects {id, name}
'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],
'dependsOn' => [],
];
}
public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array
{
$types = [];
if ($team instanceof Team) {
if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
$types = self::TYPES;
}
if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {
$types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];
}
} else {
$types = self::TYPES;
}
if ($shortVersion) {
return [
'id' => 'report_type',
'label' => 'Report Type',
'options' => $types,
];
}
return [
'id' => 'report_type',
'label' => 'Report Type',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $types,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getFrequencyFieldData(?string $value = null): array
{
return [
'id' => 'frequency',
'label' => 'Frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => self::FREQUENCIES,
'value' => $value,
'dependencies' => ['period'],
'dependsOn' => [],
];
}
public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array
{
return [
'id' => 'period',
'label' => 'Select one-off period',
'inputType' => InputTypeEnum::DATE_RANGE,
'required' => true,
'placeholder' => 'Select',
'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],
'queryParams' => [
'startDate' => 'start_date_period',
'endDate' => 'end_date_period',
],
'dependencies' => [],
'dependsOn' => ['frequency'],
];
}
public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array
{
return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);
}
public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);
}
public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);
}
public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'deal_value',
'label' => 'Deal Value',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_deal_value',
'max' => 'max_deal_value',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array
{
$value = [];
$conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;
$dialerOn && $value[] = self::CALL_TYPE_DIALER;
return [
'id' => 'call_type',
'label' => 'Call Type',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => [
self::CALL_TYPE_CONFERENCE,
self::CALL_TYPE_DIALER,
],
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getMediaTypeFieldData(?AutomatedReport $report = null): array
{
$value = [];
if ($report) {
$value = $this->transformMediaTypes($report);
}
return [
'id' => 'media_types',
'label' => 'Export as',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => self::MEDIA_TYPE_OBJECTS,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'call_duration',
'label' => 'Call Duration',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_call_duration',
'max' => 'max_call_duration',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getRecipientsFieldData(?Team $team = null, array $value = []): array
{
return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);
}
public function getJiminnyRecipientsFieldData(array $value = []): array
{
return $this->recipientsService->getJiminnyRecipientsFieldData($value);
}
public function getAdditionalPromptInputFieldData(?string $value = null): array
{
return [
'id' => 'additional_prompt_input',
'label' => 'Special requirements',
'inputType' => InputTypeEnum::TEXTAREA,
'required' => false,
'placeholder' => 'What should be the focus of the report?',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCustomReportNameFieldData(?string $value = null): array
{
return [
'id' => 'custom_name',
'label' => 'Custom report name',
'inputType' => InputTypeEnum::TEXT,
'required' => false,
'placeholder' => 'Enter custom name',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
// data providers
public function getTeams(): array
{
$teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);
$teamData = [];
foreach ($teams as $team) {
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
continue;
}
$teamData[] = $this->transformTeam($team);
}
return $teamData;
}
public function getTeamGroups(string $teamUuid): array
{
$data = [];
$team = $this->getTeam($teamUuid);
if ($team !== null) {
$groups = $team->groups()->get();
foreach ($groups as $group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
];
}
}
return $data;
}
public function getTeamsGroupsOptions(array $filterTeamUuids = []): array
{
$data = [];
$teams = $this->getTeams();
foreach ($teams as $team) {
if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {
continue;
}
$data[] = [
'label' => $team['name'],
'groups' => $this->getTeamGroups($team['id']),
];
}
return $data;
}
public function getTeam(string $teamUuid): ?Team
{
return $this->teamRepository->idOrUuid($teamUuid);
}
public function getTeamById(int $teamId): ?Team
{
return $this->teamRepository->find($teamId);
}
public function getGroupsUuids(AutomatedReport $report): array
{
$uuids = [];
$reportGroups = $report->getGroups();
foreach ($reportGroups as $groupId) {
if ($group = $this->groupRepository->find($groupId)) {
$uuids[] = $group->getUuid();
}
}
return $uuids;
}
public function getPlaybookCategoriesUuids(AutomatedReport $report): array
{
$uuids = [];
$playbookCategories = $report->getPlaybookCategories();
foreach ($playbookCategories as $id) {
if ($category = $this->playbookCategoryRepository->find($id)) {
$uuids[] = $category->getUuid();
}
}
return $uuids;
}
public function getDealAtCallStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getDealAtCallStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getCurrentDealStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getCurrentDealStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getRecipients());
}
public function getJiminnyUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function extractUserUuids(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => $user->getUuid())
->values()
->all();
}
// get mail data
public function getRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getRecipients());
}
/**
* @return array<UserContract>
*/
public function getRecipientUserObjects(AutomatedReport $report): array
{
$userIds = $report->getRecipients()['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->values()
->all();
}
private function getJiminnyRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function buildRecipientUsers(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => [
'email' => $user->getEmailAddress(),
'name' => $user->getName(),
'timezone' => $user->getTimezone()->getName(),
])
->values()
->all();
}
public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array
{
if ($report->isAskJiminnyReport()) {
$recipients = $this->resolveAskJiminnyRecipients($report);
} else {
$recipients = $this->getRecipientUsers($report);
if ($includeJiminny) {
$recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));
}
}
$emails = [];
return array_values(array_filter(
$recipients,
static function ($recipient) use (&$emails) {
if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {
return false;
}
$emails[] = $recipient['email'];
return true;
}
));
}
private function resolveAskJiminnyRecipients(AutomatedReport $report): array
{
$recipients = [];
$creator = $report->getCreator();
if ($creator !== null) {
$recipients[] = [
'email' => $creator->getEmailAddress(),
'name' => $creator->getName(),
'timezone' => $creator->getTimezone()->getName(),
];
}
return array_merge(
$recipients,
$this->buildRecipientUsers($report->getRecipients()),
$this->getGroupRecipientUsers($report),
);
}
private function getGroupRecipientUsers(AutomatedReport $report): array
{
$users = [];
foreach ($report->getGroups() as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group === null) {
continue;
}
foreach ($group->getMembers() as $member) {
$users[] = [
'email' => $member->getEmailAddress(),
'name' => $member->getName(),
'timezone' => $member->getTimezone()->getName(),
];
}
}
return $users;
}
public function getReportTypeName(AutomatedReportResult $report): string
{
$type = $report->getReport()->getType();
$getType = $this->transformReportType($type);
return $getType['name'];
}
public function getReportPeriodName(AutomatedReportResult $report): string
{
$from = $report->getFromDate();
$to = $report->getToDate();
$frequency = $report->getReport()->getFrequency();
if ($from === null || $to === null) {
if (! $report->getReport()->isAskJiminnyReport()) {
$invalidPeriod = $from === null ? 'from' : 'to';
throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);
}
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
}
return $this->formatReportPeriodName($frequency, $from, $to);
}
private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string
{
$fromYear = $from->format('Y');
$toYear = $to->format('Y');
$differentYears = $fromYear !== $toYear;
switch ($frequency) {
case self::FREQUENCY_DAILY:
return $from->format('j M Y');
case self::FREQUENCY_QUARTERLY:
// 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ
$startMonth = $from->format('M');
$endMonth = $to->copy()->subMonth();
$endMonthName = $endMonth->format('M');
$endMonthYear = $endMonth->format('Y');
if ($differentYears) {
return "{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}";
}
return "{$startMonth} - {$endMonthName} {$toYear}";
case self::FREQUENCY_MONTHLY:
// 'May 2025' - monthly reports are always within the same year
return $from->format('M Y');
case self::FREQUENCY_WEEKLY:
// '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ
$startDay = $from->format('j');
$endDay = $to->format('j');
$startMonth = $from->format('M');
$endMonth = $to->format('M');
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
if ($startMonth !== $endMonth) {
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
}
return "{$startDay} - {$endDay} {$endMonth} {$toYear}";
case self::FREQUENCY_ONE_OFF:
// '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ
$startDay = $from->format('j');
$startMonth = $from->format('M');
$endDay = $to->format('j');
$endMonth = $to->format('M');
// If same month and year, use a format like '2-31 May 2025'
if ($startMonth === $endMonth && ! $differentYears) {
return "{$startDay} - {$endDay} {$startMonth} {$toYear}";
}
// If different years, include both years
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
// Same year but different months
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
default:
// Default format for unknown frequencies
return $from->format('j M Y') . ' - ' . $to->format('j M Y');
}
}
public function getReportTeamsName(AutomatedReportResult $report): string
{
$groups = $report->getGroups();
if (empty($groups)) {
return 'All';
}
// Get group names from repository
$groupNames = [];
foreach ($groups as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group) {
$groupNames[] = $group->getName();
}
}
if (count($groupNames) === 1) {
// Single team format
$teamsName = $groupNames[0];
} else {
// Multiple teams format
$teamsName = implode(', ', $groupNames);
}
return $teamsName;
}
public function getReportFileName(AutomatedReportResult $report): string
{
$customName = $report->getReport()->getCustomName();
$periodName = $this->getReportPeriodName($report);
$filenameSuffix = $this->getFilenameSuffix($report);
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$customName} - {$periodName}");
}
$baseName = $this->getReportTypeName($report);
if ($filenameSuffix) {
$baseName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}");
}
public function getReportFileNameWithExtension(AutomatedReportResult $result): string
{
$extension = $this->getMediaTypeMetadata($result)['extension'];
return $this->getReportFileName($result) . '.' . $extension;
}
public function sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool
{
$recipients = array_map('intval', $report->getRecipients()['users'] ?? []);
return in_array($user->getId(), $recipients);
}
public function transformReportResults(Collection $automatedReportResults): array
{
$data = [];
foreach ($automatedReportResults as $automatedReportResult) {
/** @var AutomatedReportResult $automatedReportResult */
$report = $automatedReportResult->getReport();
$createdBy = $report->getCreator();
$creator = [
'id' => $createdBy?->getUuid(),
'name' => $createdBy?->getName(),
'email' => $createdBy?->getEmailAddress(),
'photoUrl' => $createdBy?->getPhotoUrl(),
];
$data[] = [
'id' => $automatedReportResult->getUuid(),
'name' => $automatedReportResult->getName(),
'frequency' => $this->transformFrequency($report->getFrequency()),
'recipients' => $this->buildRecipients($report),
'report_type' => $this->transformReportType($report->getType()),
'media_type' => $automatedReportResult->getMediaType(),
'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),
'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),
'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),
'creator' => $creator,
];
}
return $data;
}
private function buildRecipients(AutomatedReport $report): array
{
$creatorUuid = $report->getCreator()?->getUuid();
$recipients = array_values(array_filter(
$this->transformRecipients($report->getRecipients()),
static fn (array $recipient): bool => $recipient['id'] !== $creatorUuid,
));
if (! $report->isAskJiminnyReport()) {
return $recipients;
}
return [
...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),
...$recipients,
];
}
public function hasCallTypeConference(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);
}
public function hasCallTypeDialer(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);
}
// transformers
private function transformTeam(Team $team): array
{
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
return [];
}
return [
'id' => $team->getUuid(),
'name' => $team->getName(),
];
}
private function transformReportFullView(AutomatedReport $report): array
{
$base = $this->transformReportBase($report);
return $report->getType() === self::TYPE_ASK_JIMINNY
? $base + $this->transformAskJiminnyFields($report)
: $base + $this->transformStandardReportFields($report);
}
private function transformReportBase(AutomatedReport $report): array
{
return [
'id' => $report->getUuid(),
'organization' => $this->transformOrganization(team: $report->getTeam()),
'report_type' => $this->transformReportType($report->getType()),
'frequency' => $this->transformFrequency($report->getFrequency()),
];
}
private function transformStandardReportFields(AutomatedReport $report): array
{
$team = $report->getTeam();
return [
'report_enabled' => $report->getStatus(),
'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),
'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),
'deal_value_min' => $report->getDealValueMin(),
'deal_value_max' => $report->getDealValueMax(),
'call_types' => $this->transformCallType($report->getCallTypes()),
'media_types' => $this->transformMediaTypes($report),
'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),
'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),
'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),
'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),
'recipients' => $this->transformRecipients($report->getRecipients()),
'created_by' => $this->transformCreator($report->getCreator()),
'additional_prompt_input' => $report->getAdditionalPromptInput(),
'custom_name' => $report->getCustomName(),
'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),
'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),
'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),
];
}
private function transformAskJiminnyFields(AutomatedReport $report): array
{
$team = $report->getTeam();
$creatorId = $report->getAttribute('created_by');
$explicitUserIds = array_values(array_filter(
$report->getRecipients()['users'] ?? [],
static fn ($id) => $id !== $creatorId
));
return [
'report_name' => $report->getCustomName(),
'enabled' => $report->getStatus(),
'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),
'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),
'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),
'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),
];
}
private function transformOrganization(?Team $team): array
{
return [
'id' => $team?->getUuid(),
'name' => $team?->getName(),
];
}
private function transformReportType(string $type): array
{
foreach (self::ALL_TYPES as $typeItem) {
if ($typeItem['id'] === $type) {
return $typeItem;
}
}
return [];
}
private function transformCallType(array $types): array
{
$result = [];
$callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];
foreach ($types as $type) {
foreach ($callTypes as $callTypeItem) {
if ($callTypeItem['id'] === $type) {
$result[] = $callTypeItem;
break;
}
}
}
return $result;
}
private function transformMediaTypes(AutomatedReport $report): array
{
$values = [];
foreach ($report->getMediaTypes() as $mediaType) {
if (! in_array($mediaType, self::MEDIA_TYPES, true)) {
continue;
}
$values[] = match ($mediaType) {
self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,
self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,
};
}
return $values;
}
private function transformFrequency(string $frequency): array
{
foreach (self::ALL_FREQUENCIES as $frequencyItem) {
if ($frequencyItem['id'] === $frequency) {
return $frequencyItem;
}
}
return [];
}
public function transformDurationToMinutes(?int $duration): ?int
{
if (! $duration) {
return null;
}
return (int) ($duration / 60);
}
private function transformGroups(?Team $team, array $groupsIds): array
{
if (empty($groupsIds) || ! $team) {
return [];
}
$data = [];
foreach ($groupsIds as $groupId) {
$group = $team->groups()->where('id', $groupId)->first();
if ($group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
'photoUrl' => $group->getPhotoUrl(),
];
}
}
return $data;
}
private function transformStages(?Team $team, array $stagesIds): array
{
if (empty($stagesIds) || ! $team) {
return [];
}
$data = [];
foreach ($stagesIds as $stageId) {
$stage = $team->stages()->where('id', $stageId)->first();
if ($stage) {
$data[] = [
'id' => $stage->getUuid(),
'name' => $stage->getName(),
];
}
}
return $data;
}
private function transformRecipients(array $recipients): array
{
$users = [];
foreach ($recipients['users'] ?? [] as $userId) {
$users[] = $this->transformUser($userId);
}
return $users;
}
private function transformCreator(?User $user): ?array
{
if ($user === null) {
return null;
}
return $this->transformUser($user->getId());
}
private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array
{
if ($prompt === null) {
return null;
}
return [
'id' => $prompt->getUuid(),
'name' => $prompt->getTitle(),
];
}
private function transformSafeSearch(?Search $search): ?array
{
if ($search === null) {
return null;
}
return [
'id' => $search->getUuid(),
'name' => $search->getName(),
];
}
private function transformUser(int $userId): array
{
/* @var ?User $user */
$user = $this->userRepository->find($userId);
return [
'id' => $user?->getUuid(),
'name' => $user?->getName(),
'email' => $user?->getEmailAddress(),
'photoUrl' => $user?->getPhotoUrl(),
];
}
public function create(array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$validatedData['created_by'] = auth()->id();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
public function update(string $uuid, array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$report = $this->automatedReportsRepository->findByUuid($uuid);
if (! $report) {
throw new InvalidArgumentException('Report not found');
}
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
/**
* Create an Ask Jiminny report.
*/
public function createAskJiminnyReport(array $data, User $creator): array
{
$validatedData = $this->validateAskJiminnyReportData($data, $creator);
$validatedData['created_by'] = $creator->getId();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
return $this->transformReportFullView($automatedReport);
}
/**
* Update an Ask Jiminny report.
*/
public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array
{
if (! $report->isAskJiminnyReport()) {
throw new InvalidArgumentException('Report is not an Ask Jiminny report');
}
$validatedData = $this->validateAskJiminnyReportData($data, $user);
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
return $this->transformReportFullView($automatedReport);
}
public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array
{
$this->automatedReportsRepository->update($report, ['status' => $status]);
return $this->transformReportFullView($report->fresh());
}
/**
* Validate and transform data for Ask Jiminny reports.
*/
private function validateAskJiminnyReportData(array $data, User $user): array
{
// Validate name
$name = trim($data['report_name'] ?? '');
if (empty($name)) {
throw new InvalidArgumentException('Report name is required');
}
if (mb_strlen($name) > 50) {
throw new InvalidArgumentException('Report name must be 50 characters or less');
}
// Validate frequency (only daily, weekly, monthly for Ask Jiminny)
$frequency = $data['frequency'] ?? null;
$askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];
if (! in_array($frequency, $askJiminnyFrequencies, true)) {
throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');
}
// Validate expiration date
$expiresAt = $data['expires_on'] ?? null;
if (empty($expiresAt)) {
throw new InvalidArgumentException('Expiration date is required');
}
try {
$expiresAtDate = Carbon::parse($expiresAt);
} catch (InvalidFormatException $e) {
throw new InvalidArgumentException('Expiration date format is invalid');
}
$maxExpiration = Carbon::now()->addYear()->endOfDay();
if ($expiresAtDate->gt($maxExpiration)) {
throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');
}
if ($expiresAtDate->isPast()) {
throw new InvalidArgumentException('Expiration date cannot be in the past');
}
// Validate saved search
$activitySearchId = $data['saved_search'] ?? null;
if (empty($activitySearchId)) {
throw new InvalidArgumentException('Saved search is required');
}
$savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);
if (! $savedSearch) {
throw new InvalidArgumentException('Saved search not found or does not belong to you');
}
// Validate saved prompt
$askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;
if (empty($askAnythingPromptId)) {
throw new InvalidArgumentException('Ask Jiminny prompt is required');
}
$prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);
if (! $prompt) {
throw new InvalidArgumentException('Ask Jiminny prompt not found');
}
// Validate status
$status = $data['enabled'] ?? false;
$recipientUserIds = [$user->getId()];
if (! empty($data['share_users'])) {
$sharedUserIds = $this->validateAndGetUserIdsByTeam(
$user->team,
(array) $data['share_users']
);
$recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);
}
$sharedGroupIds = [];
if (! empty($data['share_teams'])) {
$sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);
}
$recipientUserIds = array_values(array_unique($recipientUserIds));
return [
'team_id' => $user->getTeamId(),
'type' => self::TYPE_ASK_JIMINNY,
'status' => (bool) $status,
'frequency' => $frequency,
'custom_name' => $name,
'activity_search_id' => $savedSearch->getId(),
'ask_anything_prompt_id' => $prompt->getId(),
'expires_at' => $expiresAtDate->toDateString(),
'media_types' => [self::MEDIA_TYPE_PDF],
'call_types' => [],
'recipients' => ['users' => $recipientUserIds],
'groups' => $sharedGroupIds,
];
}
public static function getAskJiminnyFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::ASK_JIMINNY_FREQUENCIES);
}
public function getAskJiminnyReportFilters(User $user): array
{
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
return [
[
'id' => 'prompt',
'label' => 'Prompt',
'options' => $prompts,
],
[
'id' => 'saved_search',
'label' => 'Saved Search',
'options' => $savedSearches,
],
];
}
public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array
{
$team = $user->getTeam();
$userTimezone = $user->getTimezone();
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
$teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [
'id' => $group->getUuid(),
'name' => $group->getName(),
])->values()->all();
$shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];
$sharedTeamsValue = [];
$sharedUsersValue = [];
if ($report) {
$sharedTeamsValue = $this->transformGroups($team, $report->getGroups());
$recipientUserIds = $report->getRecipients()['users'] ?? [];
$creatorId = $report->getAttribute('created_by');
$sharedUserIds = array_values(array_filter(
$recipientUserIds,
static fn ($id) => $id !== $creatorId
));
$sharedUsersValue = collect($sharedUserIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (User $u) => [
'id' => $u->getUuid(),
'name' => $u->getName(),
])
->values()
->all();
}
return [
'fields' => [
[
'id' => 'enabled',
'inputType' => InputTypeEnum::TOGGLE,
'label' => '',
'value' => $report?->getStatus() ?? false,
],
[
'id' => 'report_name',
'inputType' => InputTypeEnum::TEXT,
'label' => 'Name',
'placeholder' => 'Enter name',
'required' => true,
'validation' => ['maxLength' => 50],
'value' => $report?->getCustomName() ?? '',
],
[
'id' => 'frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'label' => 'Frequency',
'required' => true,
'placeholder' => 'Select',
'options' => self::ASK_JIMINNY_FREQUENCIES,
'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,
],
[
'id' => 'expires_on',
'inputType' => InputTypeEnum::DATE,
'label' => 'Expires on',
'required' => true,
'placeholder' => 'Select',
'validation' => [
'minDate' => now($userTimezone)->toDateString(),
'maxDate' => now($userT...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"#11894 on JY-18909-automated-reports-ask-jiminny, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.12134308,"height":0.025538707},"help_text":"Pull request #11894 exists for current branch JY-18909-automated-reports-ask-jiminny","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8218085,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AutomatedReportsServiceTest","depth":6,"bounds":{"left":0.83710104,"top":0.019952115,"width":0.078457445,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AutomatedReportsServiceTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AutomatedReportsServiceTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"102","depth":4,"bounds":{"left":0.4424867,"top":0.19952115,"width":0.011968086,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"3","depth":4,"bounds":{"left":0.45644948,"top":0.19952115,"width":0.007978723,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"34","depth":4,"bounds":{"left":0.4664229,"top":0.19952115,"width":0.010305851,"height":0.015163607},"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.47839096,"top":0.19792499,"width":0.00731383,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.48570478,"top":0.19792499,"width":0.006981383,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Kiosk\\AutomatedReports;\n\nuse Carbon\\CarbonImmutable;\nuse Carbon\\CarbonInterface;\nuse Carbon\\Exceptions\\InvalidFormatException;\nuse DateTime;\nuse DateTimeInterface;\nuse DateTimeZone;\nuse Illuminate\\Contracts\\Bus\\Dispatcher as BusDispatcher;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Support\\Facades\\Log;\nuse Illuminate\\Support\\Facades\\Storage;\nuse Jiminny\\Component\\ActivitySearch\\FilterDefinition\\InputTypeEnum;\nuse Jiminny\\Component\\AskAnything\\AskAnythingPromptService;\nuse Jiminny\\Component\\AskAnything\\Dtos\\AskAnythingPromptDto;\nuse Jiminny\\Component\\UrlGenerator\\Webhook;\nuse Jiminny\\Contracts\\Repositories\\PlaybookCategoryRepository;\nuse Jiminny\\Contracts\\Repositories\\TeamRepository;\nuse Jiminny\\Contracts\\Repositories\\UserRepository;\nuse Jiminny\\Exceptions\\ApplicationException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Exceptions\\ModelNotFoundException;\nuse Jiminny\\Jobs\\AutomatedReports\\RequestGenerateReportJob;\nuse Jiminny\\Models\\Activity\\Search;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPrompt;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPromptTarget;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Contracts\\UserContract;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Repositories\\AskAnythingRepository;\nuse Jiminny\\Repositories\\AutomatedReportsRepository;\nuse Jiminny\\Repositories\\GroupRepository;\nuse Jiminny\\Repositories\\SearchRepository;\nuse Jiminny\\Repositories\\StageRepository;\nuse Throwable;\n\nclass AutomatedReportsService\n{\n public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';\n public const string TYPE_ASK_JIMINNY = 'ask_jiminny';\n\n /**\n * Standard report types (used by kiosk for existing automated reports).\n */\n // @TODO this will add filter, however if we need to control feature by FF we need conditional logic\n public const array TYPES = [\n ['id' => 'exec_summary', 'name' => 'Exec Summary'],\n ['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],\n ['id' => 'product_feedback', 'name' => 'Product Feedback'],\n ['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],\n// ['id' => 'questions', 'name' => 'Questions'],\n// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],\n ];\n\n public const array ALL_TYPES = [\n ...self::TYPES,\n ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],\n ];\n\n public const string FREQUENCY_DAILY = 'daily';\n public const string FREQUENCY_WEEKLY = 'weekly';\n public const string FREQUENCY_MONTHLY = 'monthly';\n public const string FREQUENCY_QUARTERLY = 'quarterly';\n public const string FREQUENCY_ONE_OFF = 'one_off';\n\n /**\n * Frequencies for standard (non-Ask Jiminny) reports.\n */\n public const array FREQUENCIES = [\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n\n /**\n * Frequencies for Ask Jiminny reports.\n */\n public const array ASK_JIMINNY_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ];\n\n public const string MEDIA_TYPE_PDF = 'pdf';\n public const string MEDIA_TYPE_PODCAST = 'podcast';\n public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];\n public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];\n public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];\n public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];\n\n public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];\n public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];\n public const int SENT_REPORT_AT_HOURS = 5;\n public const string PDF_KEY = 'pdf';\n public const string AUDIO_KEY = 'audio';\n\n private const array ALL_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n private const string S3_DIR = 'reports';\n private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];\n private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];\n\n public function __construct(\n private readonly TeamRepository $teamRepository,\n private readonly GroupRepository $groupRepository,\n private readonly UserRepository $userRepository,\n private readonly StageRepository $stageRepository,\n private readonly DealStagesService $dealStagesService,\n private readonly RecipientsService $recipientsService,\n private readonly AutomatedReportsRepository $automatedReportsRepository,\n private readonly Webhook $webhookService,\n private readonly BusDispatcher $dispatcher,\n private readonly ActivityTypeService $activityTypeService,\n private readonly PlaybookCategoryRepository $playbookCategoryRepository,\n private readonly AskAnythingPromptService $askAnythingPromptService,\n private readonly SearchRepository $activitySearchRepository,\n private readonly AskAnythingRepository $askAnythingRepository,\n ) {\n }\n\n public static function getTypes(): array\n {\n $types = self::TYPES;\n\n return array_map(static function ($type) {\n return $type['id'];\n }, $types);\n }\n\n public static function getCallTypes(): array\n {\n return array_map(static function ($callType) {\n return $callType['id'];\n }, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);\n }\n\n public static function getFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::FREQUENCIES);\n }\n\n // front-facing structure\n public function getReportEnabledFieldData(bool $value = false): array\n {\n return [\n 'id' => 'report_enabled',\n 'label' => '',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'value' => $value,\n ];\n }\n\n // Organizations = Teams\n public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array\n {\n $options = $this->getTeams();\n\n if ($shortVersion) {\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value,\n 'dependencies' => [\n 'teams',\n 'deal_stage_at_call',\n 'current_deal_stage',\n 'recipients',\n ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,\n ],\n 'dependsOn' => [],\n ];\n }\n\n // Teams = Groups\n public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array\n {\n if ($shortVersion) {\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value, // value should be an array of objects {id, name}\n 'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],\n 'dependsOn' => [],\n ];\n }\n\n public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array\n {\n $types = [];\n if ($team instanceof Team) {\n if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n $types = self::TYPES;\n }\n if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {\n $types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];\n }\n } else {\n $types = self::TYPES;\n }\n\n if ($shortVersion) {\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'options' => $types,\n ];\n }\n\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $types,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getFrequencyFieldData(?string $value = null): array\n {\n return [\n 'id' => 'frequency',\n 'label' => 'Frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::FREQUENCIES,\n 'value' => $value,\n 'dependencies' => ['period'],\n 'dependsOn' => [],\n ];\n }\n\n public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array\n {\n return [\n 'id' => 'period',\n 'label' => 'Select one-off period',\n 'inputType' => InputTypeEnum::DATE_RANGE,\n 'required' => true,\n 'placeholder' => 'Select',\n 'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],\n 'queryParams' => [\n 'startDate' => 'start_date_period',\n 'endDate' => 'end_date_period',\n ],\n 'dependencies' => [],\n 'dependsOn' => ['frequency'],\n ];\n }\n\n public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array\n {\n return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);\n }\n\n public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);\n }\n\n public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);\n }\n\n public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'deal_value',\n 'label' => 'Deal Value',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_deal_value',\n 'max' => 'max_deal_value',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array\n {\n $value = [];\n $conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;\n $dialerOn && $value[] = self::CALL_TYPE_DIALER;\n\n return [\n 'id' => 'call_type',\n 'label' => 'Call Type',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => [\n self::CALL_TYPE_CONFERENCE,\n self::CALL_TYPE_DIALER,\n ],\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getMediaTypeFieldData(?AutomatedReport $report = null): array\n {\n $value = [];\n\n if ($report) {\n $value = $this->transformMediaTypes($report);\n }\n\n return [\n 'id' => 'media_types',\n 'label' => 'Export as',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => self::MEDIA_TYPE_OBJECTS,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'call_duration',\n 'label' => 'Call Duration',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_call_duration',\n 'max' => 'max_call_duration',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getRecipientsFieldData(?Team $team = null, array $value = []): array\n {\n return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);\n }\n\n public function getJiminnyRecipientsFieldData(array $value = []): array\n {\n return $this->recipientsService->getJiminnyRecipientsFieldData($value);\n }\n\n public function getAdditionalPromptInputFieldData(?string $value = null): array\n {\n return [\n 'id' => 'additional_prompt_input',\n 'label' => 'Special requirements',\n 'inputType' => InputTypeEnum::TEXTAREA,\n 'required' => false,\n 'placeholder' => 'What should be the focus of the report?',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCustomReportNameFieldData(?string $value = null): array\n {\n return [\n 'id' => 'custom_name',\n 'label' => 'Custom report name',\n 'inputType' => InputTypeEnum::TEXT,\n 'required' => false,\n 'placeholder' => 'Enter custom name',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n // data providers\n public function getTeams(): array\n {\n $teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);\n\n $teamData = [];\n foreach ($teams as $team) {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n continue;\n }\n\n $teamData[] = $this->transformTeam($team);\n }\n\n return $teamData;\n }\n\n public function getTeamGroups(string $teamUuid): array\n {\n $data = [];\n $team = $this->getTeam($teamUuid);\n\n if ($team !== null) {\n $groups = $team->groups()->get();\n\n foreach ($groups as $group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n public function getTeamsGroupsOptions(array $filterTeamUuids = []): array\n {\n $data = [];\n $teams = $this->getTeams();\n\n foreach ($teams as $team) {\n if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {\n continue;\n }\n\n $data[] = [\n 'label' => $team['name'],\n 'groups' => $this->getTeamGroups($team['id']),\n ];\n }\n\n return $data;\n }\n\n public function getTeam(string $teamUuid): ?Team\n {\n return $this->teamRepository->idOrUuid($teamUuid);\n }\n\n public function getTeamById(int $teamId): ?Team\n {\n return $this->teamRepository->find($teamId);\n }\n\n public function getGroupsUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportGroups = $report->getGroups();\n foreach ($reportGroups as $groupId) {\n if ($group = $this->groupRepository->find($groupId)) {\n $uuids[] = $group->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getPlaybookCategoriesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $playbookCategories = $report->getPlaybookCategories();\n foreach ($playbookCategories as $id) {\n if ($category = $this->playbookCategoryRepository->find($id)) {\n $uuids[] = $category->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getDealAtCallStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getDealAtCallStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getCurrentDealStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getCurrentDealStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getRecipients());\n }\n\n public function getJiminnyUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function extractUserUuids(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => $user->getUuid())\n ->values()\n ->all();\n }\n\n // get mail data\n public function getRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getRecipients());\n }\n\n /**\n * @return array<UserContract>\n */\n public function getRecipientUserObjects(AutomatedReport $report): array\n {\n $userIds = $report->getRecipients()['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->values()\n ->all();\n }\n\n private function getJiminnyRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function buildRecipientUsers(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => [\n 'email' => $user->getEmailAddress(),\n 'name' => $user->getName(),\n 'timezone' => $user->getTimezone()->getName(),\n ])\n ->values()\n ->all();\n }\n\n public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array\n {\n if ($report->isAskJiminnyReport()) {\n $recipients = $this->resolveAskJiminnyRecipients($report);\n } else {\n $recipients = $this->getRecipientUsers($report);\n if ($includeJiminny) {\n $recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));\n }\n }\n\n $emails = [];\n\n return array_values(array_filter(\n $recipients,\n static function ($recipient) use (&$emails) {\n if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {\n return false;\n }\n $emails[] = $recipient['email'];\n\n return true;\n }\n ));\n }\n\n private function resolveAskJiminnyRecipients(AutomatedReport $report): array\n {\n $recipients = [];\n\n $creator = $report->getCreator();\n if ($creator !== null) {\n $recipients[] = [\n 'email' => $creator->getEmailAddress(),\n 'name' => $creator->getName(),\n 'timezone' => $creator->getTimezone()->getName(),\n ];\n }\n\n return array_merge(\n $recipients,\n $this->buildRecipientUsers($report->getRecipients()),\n $this->getGroupRecipientUsers($report),\n );\n }\n\n private function getGroupRecipientUsers(AutomatedReport $report): array\n {\n $users = [];\n foreach ($report->getGroups() as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group === null) {\n continue;\n }\n foreach ($group->getMembers() as $member) {\n $users[] = [\n 'email' => $member->getEmailAddress(),\n 'name' => $member->getName(),\n 'timezone' => $member->getTimezone()->getName(),\n ];\n }\n }\n\n return $users;\n }\n\n public function getReportTypeName(AutomatedReportResult $report): string\n {\n $type = $report->getReport()->getType();\n\n $getType = $this->transformReportType($type);\n\n return $getType['name'];\n }\n\n public function getReportPeriodName(AutomatedReportResult $report): string\n {\n $from = $report->getFromDate();\n $to = $report->getToDate();\n $frequency = $report->getReport()->getFrequency();\n\n if ($from === null || $to === null) {\n if (! $report->getReport()->isAskJiminnyReport()) {\n $invalidPeriod = $from === null ? 'from' : 'to';\n\n throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);\n }\n\n $period = $this->calculateFromAndToDatePeriod($frequency);\n $from = $period['fromDate'];\n $to = $period['toDate'];\n }\n\n return $this->formatReportPeriodName($frequency, $from, $to);\n }\n\n private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string\n {\n $fromYear = $from->format('Y');\n $toYear = $to->format('Y');\n $differentYears = $fromYear !== $toYear;\n\n switch ($frequency) {\n case self::FREQUENCY_DAILY:\n return $from->format('j M Y');\n\n case self::FREQUENCY_QUARTERLY:\n // 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ\n $startMonth = $from->format('M');\n $endMonth = $to->copy()->subMonth();\n $endMonthName = $endMonth->format('M');\n $endMonthYear = $endMonth->format('Y');\n\n if ($differentYears) {\n return \"{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}\";\n }\n\n return \"{$startMonth} - {$endMonthName} {$toYear}\";\n\n case self::FREQUENCY_MONTHLY:\n // 'May 2025' - monthly reports are always within the same year\n return $from->format('M Y');\n\n case self::FREQUENCY_WEEKLY:\n // '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ\n $startDay = $from->format('j');\n $endDay = $to->format('j');\n $startMonth = $from->format('M');\n $endMonth = $to->format('M');\n\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n if ($startMonth !== $endMonth) {\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n return \"{$startDay} - {$endDay} {$endMonth} {$toYear}\";\n\n case self::FREQUENCY_ONE_OFF:\n // '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ\n $startDay = $from->format('j');\n $startMonth = $from->format('M');\n $endDay = $to->format('j');\n $endMonth = $to->format('M');\n\n // If same month and year, use a format like '2-31 May 2025'\n if ($startMonth === $endMonth && ! $differentYears) {\n return \"{$startDay} - {$endDay} {$startMonth} {$toYear}\";\n }\n\n // If different years, include both years\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n // Same year but different months\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n\n default:\n // Default format for unknown frequencies\n return $from->format('j M Y') . ' - ' . $to->format('j M Y');\n }\n }\n\n public function getReportTeamsName(AutomatedReportResult $report): string\n {\n $groups = $report->getGroups();\n\n if (empty($groups)) {\n return 'All';\n }\n\n // Get group names from repository\n $groupNames = [];\n foreach ($groups as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group) {\n $groupNames[] = $group->getName();\n }\n }\n\n if (count($groupNames) === 1) {\n // Single team format\n $teamsName = $groupNames[0];\n } else {\n // Multiple teams format\n $teamsName = implode(', ', $groupNames);\n }\n\n return $teamsName;\n }\n\n public function getReportFileName(AutomatedReportResult $report): string\n {\n $customName = $report->getReport()->getCustomName();\n $periodName = $this->getReportPeriodName($report);\n $filenameSuffix = $this->getFilenameSuffix($report);\n\n if ($customName) {\n if ($filenameSuffix) {\n $customName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$customName} - {$periodName}\");\n }\n\n $baseName = $this->getReportTypeName($report);\n\n if ($filenameSuffix) {\n $baseName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}\");\n }\n\n public function getReportFileNameWithExtension(AutomatedReportResult $result): string\n {\n $extension = $this->getMediaTypeMetadata($result)['extension'];\n\n return $this->getReportFileName($result) . '.' . $extension;\n }\n\n public function sanitizeFileName(string $fileName): string\n {\n return str_replace(['/', '\\\\'], '-', $fileName);\n }\n\n public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool\n {\n $recipients = array_map('intval', $report->getRecipients()['users'] ?? []);\n\n return in_array($user->getId(), $recipients);\n }\n\n public function transformReportResults(Collection $automatedReportResults): array\n {\n $data = [];\n foreach ($automatedReportResults as $automatedReportResult) {\n /** @var AutomatedReportResult $automatedReportResult */\n\n $report = $automatedReportResult->getReport();\n\n $createdBy = $report->getCreator();\n $creator = [\n 'id' => $createdBy?->getUuid(),\n 'name' => $createdBy?->getName(),\n 'email' => $createdBy?->getEmailAddress(),\n 'photoUrl' => $createdBy?->getPhotoUrl(),\n ];\n\n $data[] = [\n 'id' => $automatedReportResult->getUuid(),\n 'name' => $automatedReportResult->getName(),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n 'recipients' => $this->buildRecipients($report),\n 'report_type' => $this->transformReportType($report->getType()),\n 'media_type' => $automatedReportResult->getMediaType(),\n 'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),\n 'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),\n 'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),\n 'creator' => $creator,\n ];\n }\n\n return $data;\n }\n\n private function buildRecipients(AutomatedReport $report): array\n {\n $creatorUuid = $report->getCreator()?->getUuid();\n\n $recipients = array_values(array_filter(\n $this->transformRecipients($report->getRecipients()),\n static fn (array $recipient): bool => $recipient['id'] !== $creatorUuid,\n ));\n\n if (! $report->isAskJiminnyReport()) {\n return $recipients;\n }\n\n return [\n ...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),\n ...$recipients,\n ];\n }\n\n public function hasCallTypeConference(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);\n }\n\n public function hasCallTypeDialer(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);\n }\n\n // transformers\n private function transformTeam(Team $team): array\n {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n return [];\n }\n\n return [\n 'id' => $team->getUuid(),\n 'name' => $team->getName(),\n ];\n }\n\n private function transformReportFullView(AutomatedReport $report): array\n {\n $base = $this->transformReportBase($report);\n\n return $report->getType() === self::TYPE_ASK_JIMINNY\n ? $base + $this->transformAskJiminnyFields($report)\n : $base + $this->transformStandardReportFields($report);\n }\n\n private function transformReportBase(AutomatedReport $report): array\n {\n return [\n 'id' => $report->getUuid(),\n 'organization' => $this->transformOrganization(team: $report->getTeam()),\n 'report_type' => $this->transformReportType($report->getType()),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n ];\n }\n\n private function transformStandardReportFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n\n return [\n 'report_enabled' => $report->getStatus(),\n 'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),\n 'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),\n 'deal_value_min' => $report->getDealValueMin(),\n 'deal_value_max' => $report->getDealValueMax(),\n 'call_types' => $this->transformCallType($report->getCallTypes()),\n 'media_types' => $this->transformMediaTypes($report),\n 'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),\n 'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),\n 'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),\n 'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),\n 'recipients' => $this->transformRecipients($report->getRecipients()),\n 'created_by' => $this->transformCreator($report->getCreator()),\n 'additional_prompt_input' => $report->getAdditionalPromptInput(),\n 'custom_name' => $report->getCustomName(),\n 'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),\n 'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),\n 'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),\n ];\n }\n\n private function transformAskJiminnyFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n $creatorId = $report->getAttribute('created_by');\n $explicitUserIds = array_values(array_filter(\n $report->getRecipients()['users'] ?? [],\n static fn ($id) => $id !== $creatorId\n ));\n\n return [\n 'report_name' => $report->getCustomName(),\n 'enabled' => $report->getStatus(),\n 'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),\n 'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),\n 'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),\n 'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),\n ];\n }\n\n private function transformOrganization(?Team $team): array\n {\n return [\n 'id' => $team?->getUuid(),\n 'name' => $team?->getName(),\n ];\n }\n\n private function transformReportType(string $type): array\n {\n foreach (self::ALL_TYPES as $typeItem) {\n if ($typeItem['id'] === $type) {\n return $typeItem;\n }\n }\n\n return [];\n }\n\n private function transformCallType(array $types): array\n {\n $result = [];\n $callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];\n\n foreach ($types as $type) {\n foreach ($callTypes as $callTypeItem) {\n if ($callTypeItem['id'] === $type) {\n $result[] = $callTypeItem;\n\n break;\n }\n }\n }\n\n return $result;\n }\n\n private function transformMediaTypes(AutomatedReport $report): array\n {\n $values = [];\n\n foreach ($report->getMediaTypes() as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n continue;\n }\n\n $values[] = match ($mediaType) {\n self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,\n self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,\n };\n }\n\n return $values;\n }\n\n private function transformFrequency(string $frequency): array\n {\n foreach (self::ALL_FREQUENCIES as $frequencyItem) {\n if ($frequencyItem['id'] === $frequency) {\n return $frequencyItem;\n }\n }\n\n return [];\n }\n\n public function transformDurationToMinutes(?int $duration): ?int\n {\n if (! $duration) {\n return null;\n }\n\n return (int) ($duration / 60);\n }\n\n private function transformGroups(?Team $team, array $groupsIds): array\n {\n if (empty($groupsIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($groupsIds as $groupId) {\n $group = $team->groups()->where('id', $groupId)->first();\n\n if ($group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n 'photoUrl' => $group->getPhotoUrl(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformStages(?Team $team, array $stagesIds): array\n {\n if (empty($stagesIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($stagesIds as $stageId) {\n $stage = $team->stages()->where('id', $stageId)->first();\n\n if ($stage) {\n $data[] = [\n 'id' => $stage->getUuid(),\n 'name' => $stage->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformRecipients(array $recipients): array\n {\n $users = [];\n foreach ($recipients['users'] ?? [] as $userId) {\n $users[] = $this->transformUser($userId);\n }\n\n return $users;\n }\n\n private function transformCreator(?User $user): ?array\n {\n if ($user === null) {\n return null;\n }\n\n return $this->transformUser($user->getId());\n }\n\n private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array\n {\n if ($prompt === null) {\n return null;\n }\n\n return [\n 'id' => $prompt->getUuid(),\n 'name' => $prompt->getTitle(),\n ];\n }\n\n private function transformSafeSearch(?Search $search): ?array\n {\n if ($search === null) {\n return null;\n }\n\n return [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ];\n }\n\n private function transformUser(int $userId): array\n {\n /* @var ?User $user */\n $user = $this->userRepository->find($userId);\n\n return [\n 'id' => $user?->getUuid(),\n 'name' => $user?->getName(),\n 'email' => $user?->getEmailAddress(),\n 'photoUrl' => $user?->getPhotoUrl(),\n ];\n }\n\n public function create(array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $validatedData['created_by'] = auth()->id();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function update(string $uuid, array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $report = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $report) {\n throw new InvalidArgumentException('Report not found');\n }\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Create an Ask Jiminny report.\n */\n public function createAskJiminnyReport(array $data, User $creator): array\n {\n $validatedData = $this->validateAskJiminnyReportData($data, $creator);\n $validatedData['created_by'] = $creator->getId();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Update an Ask Jiminny report.\n */\n public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array\n {\n if (! $report->isAskJiminnyReport()) {\n throw new InvalidArgumentException('Report is not an Ask Jiminny report');\n }\n\n $validatedData = $this->validateAskJiminnyReportData($data, $user);\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array\n {\n $this->automatedReportsRepository->update($report, ['status' => $status]);\n\n return $this->transformReportFullView($report->fresh());\n }\n\n /**\n * Validate and transform data for Ask Jiminny reports.\n */\n private function validateAskJiminnyReportData(array $data, User $user): array\n {\n // Validate name\n $name = trim($data['report_name'] ?? '');\n if (empty($name)) {\n throw new InvalidArgumentException('Report name is required');\n }\n if (mb_strlen($name) > 50) {\n throw new InvalidArgumentException('Report name must be 50 characters or less');\n }\n\n // Validate frequency (only daily, weekly, monthly for Ask Jiminny)\n $frequency = $data['frequency'] ?? null;\n $askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];\n if (! in_array($frequency, $askJiminnyFrequencies, true)) {\n throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');\n }\n\n // Validate expiration date\n $expiresAt = $data['expires_on'] ?? null;\n if (empty($expiresAt)) {\n throw new InvalidArgumentException('Expiration date is required');\n }\n\n try {\n $expiresAtDate = Carbon::parse($expiresAt);\n } catch (InvalidFormatException $e) {\n throw new InvalidArgumentException('Expiration date format is invalid');\n }\n $maxExpiration = Carbon::now()->addYear()->endOfDay();\n if ($expiresAtDate->gt($maxExpiration)) {\n throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');\n }\n if ($expiresAtDate->isPast()) {\n throw new InvalidArgumentException('Expiration date cannot be in the past');\n }\n\n // Validate saved search\n $activitySearchId = $data['saved_search'] ?? null;\n if (empty($activitySearchId)) {\n throw new InvalidArgumentException('Saved search is required');\n }\n $savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);\n if (! $savedSearch) {\n throw new InvalidArgumentException('Saved search not found or does not belong to you');\n }\n\n // Validate saved prompt\n $askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;\n if (empty($askAnythingPromptId)) {\n throw new InvalidArgumentException('Ask Jiminny prompt is required');\n }\n $prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);\n if (! $prompt) {\n throw new InvalidArgumentException('Ask Jiminny prompt not found');\n }\n\n // Validate status\n $status = $data['enabled'] ?? false;\n\n $recipientUserIds = [$user->getId()];\n\n if (! empty($data['share_users'])) {\n $sharedUserIds = $this->validateAndGetUserIdsByTeam(\n $user->team,\n (array) $data['share_users']\n );\n $recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);\n }\n\n $sharedGroupIds = [];\n if (! empty($data['share_teams'])) {\n $sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);\n }\n\n $recipientUserIds = array_values(array_unique($recipientUserIds));\n\n return [\n 'team_id' => $user->getTeamId(),\n 'type' => self::TYPE_ASK_JIMINNY,\n 'status' => (bool) $status,\n 'frequency' => $frequency,\n 'custom_name' => $name,\n 'activity_search_id' => $savedSearch->getId(),\n 'ask_anything_prompt_id' => $prompt->getId(),\n 'expires_at' => $expiresAtDate->toDateString(),\n 'media_types' => [self::MEDIA_TYPE_PDF],\n 'call_types' => [],\n 'recipients' => ['users' => $recipientUserIds],\n 'groups' => $sharedGroupIds,\n ];\n }\n\n public static function getAskJiminnyFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::ASK_JIMINNY_FREQUENCIES);\n }\n\n public function getAskJiminnyReportFilters(User $user): array\n {\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n return [\n [\n 'id' => 'prompt',\n 'label' => 'Prompt',\n 'options' => $prompts,\n ],\n [\n 'id' => 'saved_search',\n 'label' => 'Saved Search',\n 'options' => $savedSearches,\n ],\n ];\n }\n\n public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array\n {\n $team = $user->getTeam();\n $userTimezone = $user->getTimezone();\n\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n $teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ])->values()->all();\n\n $shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];\n\n $sharedTeamsValue = [];\n $sharedUsersValue = [];\n if ($report) {\n $sharedTeamsValue = $this->transformGroups($team, $report->getGroups());\n\n $recipientUserIds = $report->getRecipients()['users'] ?? [];\n $creatorId = $report->getAttribute('created_by');\n $sharedUserIds = array_values(array_filter(\n $recipientUserIds,\n static fn ($id) => $id !== $creatorId\n ));\n $sharedUsersValue = collect($sharedUserIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (User $u) => [\n 'id' => $u->getUuid(),\n 'name' => $u->getName(),\n ])\n ->values()\n ->all();\n }\n\n return [\n 'fields' => [\n [\n 'id' => 'enabled',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'label' => '',\n 'value' => $report?->getStatus() ?? false,\n ],\n [\n 'id' => 'report_name',\n 'inputType' => InputTypeEnum::TEXT,\n 'label' => 'Name',\n 'placeholder' => 'Enter name',\n 'required' => true,\n 'validation' => ['maxLength' => 50],\n 'value' => $report?->getCustomName() ?? '',\n ],\n [\n 'id' => 'frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Frequency',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::ASK_JIMINNY_FREQUENCIES,\n 'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,\n ],\n [\n 'id' => 'expires_on',\n 'inputType' => InputTypeEnum::DATE,\n 'label' => 'Expires on',\n 'required' => true,\n 'placeholder' => 'Select',\n 'validation' => [\n 'minDate' => now($userTimezone)->toDateString(),\n 'maxDate' => now($userTimezone)->addYear()->toDateString(),\n ],\n 'value' => $report?->getExpiresAt()?->toDateString(),\n ],\n [\n 'id' => 'share_teams',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team',\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $teamGroups,\n 'value' => $sharedTeamsValue,\n ],\n [\n 'id' => 'share_users',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team member',\n 'required' => false,\n 'placeholder' => 'Select',\n 'groupLabelKey' => 'label',\n 'groupValuesKey' => 'users',\n 'optionLabelKey' => 'name',\n 'optionValueKey' => 'id',\n 'options' => $shareUsers,\n 'value' => $sharedUsersValue,\n ],\n [\n 'id' => 'saved_search',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Saved search',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $savedSearches,\n 'value' => $report && $report->getSavedSearch() ? [\n 'id' => $report->getSavedSearch()->getUuid(),\n 'name' => $report->getSavedSearch()->getName(),\n ] : null,\n ],\n [\n 'id' => 'ask_jiminny_prompt',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Ask Jiminny prompt',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $prompts,\n 'value' => $report && $report->getAskAnythingPrompt() ? [\n 'id' => $report->getAskAnythingPrompt()->getUuid(),\n 'name' => $report->getAskAnythingPrompt()->getTitle(),\n ] : null,\n ],\n ],\n ];\n }\n\n private function updateResultNames(AutomatedReport $automatedReport): void\n {\n $results = $this->automatedReportsRepository->getResultsByReport($automatedReport);\n\n foreach ($results as $result) {\n $result->update(['name' => $this->getReportFileName($result)]);\n }\n }\n\n public function updateStatus(string $uuid, array $data): array\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $automatedReport->update([\n 'status' => $status,\n ]);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n private function generateOneOffReport(AutomatedReport $automatedReport): void\n {\n // the scheduler handles all the other frequency types\n if ($automatedReport->getStatus() === false || $automatedReport->getFrequency() !== self::FREQUENCY_ONE_OFF) {\n return;\n }\n\n $this->dispatcher->dispatch(new RequestGenerateReportJob($automatedReport->getUuid()));\n }\n\n public function getReport(string $uuid): AutomatedReport\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n return $automatedReport;\n }\n\n public function get(string $uuid): array\n {\n $automatedReport = $this->getReport($uuid);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function list(string $sortColumn = 'created_at', string $sortDirection = 'desc'): array\n {\n $results = [];\n $collection = $this->automatedReportsRepository->getAllStandardReports($sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function listAskJiminnyReports(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): array {\n $results = [];\n $collection = $this->automatedReportsRepository->getAskJiminnyReportsByUser($user, $sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function delete(string $uuid): void\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $automatedReport->delete();\n }\n\n public function createReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n return $this->automatedReportsRepository->createResult(\n array_merge(\n [\n 'report_id' => $automatedReport->getId(),\n 'status' => AutomatedReportResult::STATUS_DEFAULT,\n ],\n $data\n )\n );\n }\n\n public function getOrCreateReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n $existing = $this->automatedReportsRepository->findLatestDefaultOrFailedResult($automatedReport);\n\n if ($existing !== null) {\n $existing->update(['status' => AutomatedReportResult::STATUS_DEFAULT]);\n\n return $existing;\n }\n\n return $this->createReportResult($automatedReport, $data);\n }\n\n public function getReportResult(string $resultUuid): AutomatedReportResult\n {\n $report = $this->automatedReportsRepository->findResultByUuid($resultUuid);\n\n if (! $report) {\n throw new ModelNotFoundException('Report Result not found');\n }\n\n return $report;\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return $this->automatedReportsRepository->findChildResult($result, $type);\n }\n\n // prophet API calls\n /**\n * @throws ApplicationException\n */\n public function getGenerateReportPayload(AutomatedReport $automatedReport, string $reportResultUuid): array\n {\n $period = $this->calculateFromAndToDate($automatedReport);\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n return [\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResultUuid,\n 'report_type' => $automatedReport->getType(),\n 'media_types' => $automatedReport->getMediaTypes(),\n 'from_date' => $fromDate->startOfDay()->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->endOfDay()->format(DateTimeInterface::RFC3339),\n 'group_ids' => $automatedReport->getGroups(),\n 'call_deal_stage' => $automatedReport->getDealAtCallStages(),\n 'current_deal_stage' => $automatedReport->getCurrentDealStages(),\n 'deal_min_value' => $automatedReport->getDealValueMin(),\n 'deal_max_value' => $automatedReport->getDealValueMax(),\n 'call_types' => $automatedReport->getCallTypes(),\n 'call_duration_min_seconds' => $automatedReport->getCallDurationMin(),\n 'call_duration_max_seconds' => $automatedReport->getCallDurationMax(),\n 'special_requirements' => $automatedReport->getAdditionalPromptInput(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->formatReportPeriodName(\n $automatedReport->getFrequency(),\n $fromDate,\n $toDate,\n ),\n 'playbook_categories' => $automatedReport->getPlaybookCategories(),\n 'custom_name' => $automatedReport->getCustomName(),\n ];\n }\n\n // $inputPayload - FE payload structure\n public function getActivitiesCountPayload(array $inputPayload): array\n {\n // Use validateAndTransformData to validate and normalize input\n $validatedData = $this->validateAndTransformData($inputPayload);\n $period = $this->calculateFromAndToDatePeriod(\n $validatedData['frequency'],\n Carbon::parse($validatedData['from']),\n Carbon::parse($validatedData['to']),\n );\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n // Create payload similar to getGenerateReportPayload\n return [\n 'team_id' => $validatedData['team_id'],\n 'group_ids' => $validatedData['groups'] ?? [],\n 'report_type' => $validatedData['type'],\n 'from_date' => $fromDate->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->format(DateTimeInterface::RFC3339),\n 'call_deal_stage' => $validatedData['deal_at_call_stages'] ?? [],\n 'current_deal_stage' => $validatedData['current_deal_stages'] ?? [],\n 'deal_min_value' => $validatedData['deal_value_min'] ?? null,\n 'deal_max_value' => $validatedData['deal_value_max'] ?? null,\n 'call_types' => $validatedData['call_types'],\n 'call_duration_min_seconds' => $validatedData['call_duration_min'] ?? null,\n 'call_duration_max_seconds' => $validatedData['call_duration_max'] ?? null,\n 'special_requirements' => $validatedData['additional_prompt_input'] ?? null,\n 'playbook_categories' => $validatedData['playbook_categories'] ?? [],\n 'request_id' => null,\n 'callback_url' => null,\n ];\n }\n\n public function shouldSendReport(array $users, ?CarbonInterface $generatedAt = null): bool\n {\n if (empty($users)) {\n return false;\n }\n\n $earliestTz = collect($users)\n ->mapWithKeys(function (array $user) {\n $tz = new DateTimeZone($user['timezone']);\n $nowUtc = new DateTime('now', new DateTimeZone('UTC'));\n $offset = $tz->getOffset($nowUtc);\n\n return [$user['timezone'] => $offset];\n })\n ->sortDesc()\n ->keys()\n ->first();\n\n $now = Carbon::now($earliestTz);\n $isScheduledTime = (int) $now->format('H') === self::SENT_REPORT_AT_HOURS;\n\n if ($isScheduledTime) {\n return true;\n }\n\n return $this->hasPassedScheduledTime($generatedAt, $earliestTz);\n }\n\n public function hasPassedScheduledTime(?CarbonInterface $generatedAt, string $timezone): bool\n {\n if ($generatedAt === null) {\n return false;\n }\n\n $now = Carbon::now($timezone);\n $scheduledTime = $now->copy()->setTime(self::SENT_REPORT_AT_HOURS, 0, 0);\n\n if ($now->hour < self::SENT_REPORT_AT_HOURS) {\n $scheduledTime = $scheduledTime->subDay();\n }\n\n $scheduledTimeUtc = $scheduledTime->copy()->utc();\n $generatedAtUtc = $generatedAt->copy()->utc();\n $nowUtc = $now->copy()->utc();\n\n return $generatedAtUtc->lt($scheduledTimeUtc) && $nowUtc->gt($scheduledTimeUtc);\n }\n\n public function calculateFromAndToDatePeriod(\n string $frequency,\n ?Carbon $fromDate = null,\n ?Carbon $toDate = null\n ): array {\n if ($frequency === self::FREQUENCY_ONE_OFF) {\n return [\n 'fromDate' => $fromDate,\n 'toDate' => $toDate,\n ];\n }\n\n $now = Carbon::now();\n\n return match ($frequency) {\n self::FREQUENCY_DAILY => [\n 'fromDate' => $now->copy()->subDay()->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_WEEKLY => [\n 'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_MONTHLY => [\n 'fromDate' => $now->copy()->subMonths(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_QUARTERLY => [\n 'fromDate' => $now->copy()->subMonths(3)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n default => throw new InvalidArgumentException(\"Unsupported frequency: {$frequency}\"),\n };\n }\n\n private function calculateFromAndToDate(AutomatedReport $automatedReport): array\n {\n return $this->calculateFromAndToDatePeriod(\n $automatedReport->getFrequency(),\n $automatedReport->getFrom(),\n $automatedReport->getTo()\n );\n }\n\n public function getAskJiminnyGenerateReportPayload(\n AutomatedReport $automatedReport,\n AutomatedReportResult $reportResult,\n array $activityIds,\n ): array {\n return [\n 'user_question' => $automatedReport->getAskAnythingPrompt()?->getContent(),\n 'call_ids' => array_map('strval', $activityIds),\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResult->getUuid(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->getReportPeriodName($reportResult),\n 'report_name' => $automatedReport->getCustomName(),\n ];\n }\n\n private function getCallbackUrl(): string\n {\n return $this->webhookService->route('jiminny.webhook.reports.ready');\n }\n\n /**\n * Validate and transform payload data for automated reports\n *\n * @param array $data\n *\n * @throws InvalidArgumentException\n *\n * @return array\n */\n private function validateAndTransformData(array $data): array\n {\n // Validate organization (team) and check feature\n $team = $this->validateOrganization($data['organization'] ?? null);\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $type = $this->validateReportType($data['report_type'] ?? null);\n $frequency = $this->validateFrequency($data['frequency'] ?? null);\n $additionalPromptInput = $this->validateAdditionalPromptInput(\n $data['additional_prompt_input'] ?? null\n );\n $customReportName = $this->validateCustomReportName($data['custom_name'] ?? null);\n\n // Prepare data for the database\n $reportData = [\n 'team_id' => $team->getId(),\n 'type' => $type,\n 'status' => $status,\n 'frequency' => $frequency,\n 'additional_prompt_input' => $additionalPromptInput,\n 'custom_name' => $customReportName,\n ];\n\n // Validate deal values\n $reportData = $this->validateDealValues($data, $reportData);\n\n // Validate date range\n $reportData = $this->validateDateRange($data, $reportData, $frequency);\n\n // Validate call durations\n $reportData = $this->validateCallDurations($data, $reportData);\n\n // Validate call types\n $reportData = $this->validateCallTypes($data, $reportData);\n\n // Validate media types\n $reportData = $this->validateMediaTypes($data, $reportData);\n\n // Validate groups\n if (isset($data['teams'])) {\n $reportData['groups'] = $this->validateAndGetGroupIds($team, $data['teams']);\n }\n\n // Validate deal stages\n $reportData = $this->validateDealStages($data, $reportData, $team, $type);\n\n // Validate playbook categories\n $reportData = $this->validatePlaybookCategories($data, $reportData, $team);\n\n // Validate recipients\n $reportData['recipients'] = [\n 'users' => $this->validateAndGetUserIdsByTeam($team, $data['recipients'] ?? []),\n ];\n\n if (isset($data['jiminny_recipients'])) {\n // Validate Jiminny recipients\n $reportData['jiminny_recipients'] = [\n 'users' => $this->validateAndGetJiminnyUserIds((array) $data['jiminny_recipients']),\n ];\n }\n\n return $reportData;\n }\n\n private function validateDealValues(array $data, array $reportData): array\n {\n if (isset($data['min_deal_value'])) {\n $reportData['deal_value_min'] = (int) $data['min_deal_value'];\n\n if ($reportData['deal_value_min'] > 4294967295 || $reportData['deal_value_min'] < 0) {\n throw new InvalidArgumentException('Min deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_deal_value'])) {\n $reportData['deal_value_max'] = (int) $data['max_deal_value'];\n\n if ($reportData['deal_value_max'] > 4294967295 || $reportData['deal_value_max'] < 0) {\n throw new InvalidArgumentException('Max deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['min_deal_value'], $data['max_deal_value'])\n && $data['min_deal_value'] > $data['max_deal_value']\n ) {\n throw new InvalidArgumentException('Min deal value cannot be greater than max deal value');\n }\n\n return $reportData;\n }\n\n private function validateDateRange(array $data, array $reportData, string $frequency): array\n {\n // Set date range only for one_off frequency\n if ($frequency === 'one_off') {\n if (isset($data['start_date_period'])) {\n $reportData['from'] = $this->parseDate($data['start_date_period']);\n }\n\n if (isset($data['end_date_period'])) {\n $reportData['to'] = $this->parseDate($data['end_date_period']);\n }\n\n if (empty($reportData['from']) || empty($reportData['to'])) {\n throw new InvalidArgumentException(\n 'Start date and end date are required for one_off frequency'\n );\n }\n } else {\n $reportData['from'] = null;\n $reportData['to'] = null;\n }\n\n return $reportData;\n }\n\n private function validateCallDurations(array $data, array $reportData): array\n {\n // Convert call durations from minutes to seconds\n if (isset($data['min_call_duration'])) {\n $reportData['call_duration_min'] = (int) $data['min_call_duration'] * 60;\n\n if ($reportData['call_duration_min'] > 4294967295 || $reportData['call_duration_min'] < 0) {\n throw new InvalidArgumentException('Min call duration should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_call_duration'])) {\n $reportData['call_duration_max'] = (int) $data['max_call_duration'] * 60;\n\n if ($reportData['call_duration_max'] > 4294967295 || $reportData['call_duration_max'] < 0) {\n throw new InvalidArgumentException('Max call duration should be between 0 and 4294967295');\n }\n }\n\n return $reportData;\n }\n\n private function validateCallTypes(array $data, array $reportData): array\n {\n // Set call types\n $reportData['call_types'] = $data['call_type'] ?? [];\n if (empty($reportData['call_types'])) {\n $reportData['call_types'] = self::getCallTypes();\n }\n\n foreach ($reportData['call_types'] as $callType) {\n if (! in_array($callType, self::getCallTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Call type %s is invalid', $callType));\n }\n }\n\n return $reportData;\n }\n\n private function validateMediaTypes(array $data, array $reportData): array\n {\n // Set media types from input data\n $reportData['media_types'] = $data['media_types'] ?? [];\n\n if (empty($reportData['media_types'])) {\n throw new InvalidArgumentException('Media types are required');\n }\n\n foreach ($reportData['media_types'] as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n throw new InvalidArgumentException(sprintf('Media type %s is invalid', $mediaType));\n }\n }\n\n return $reportData;\n }\n\n private function validateDealStages(array $data, array $reportData, Team $team, string $reportType): array\n {\n // Validate and set deal stages\n if (isset($data['deal_stage_at_call'])) {\n $reportData['deal_at_call_stages'] =\n $this->validateAndGetDealStageIds($team, $data['deal_stage_at_call'], 'Deal stage at call');\n }\n\n if (isset($data['current_deal_stage'])) {\n $reportData['current_deal_stages'] =\n $this->validateAndGetDealStageIds($team, $data['current_deal_stage'], 'Current deal stage');\n }\n\n // Ensure current_deal_stage is not provided for loss_analysis report type\n if ($reportType === self::TYPE_LOSS_ANALYSIS && ! empty($data['current_deal_stage'])) {\n throw new InvalidArgumentException('Current deal stage is not applicable for Loss Analysis reports');\n }\n\n return $reportData;\n }\n\n // transform uuid to id\n private function validatePlaybookCategories(array $data, array $reportData, Team $team): array\n {\n $key = 'playbook_categories';\n\n if (isset($data[$key])) {\n $payloadIds = $data[$key];\n $ids = [];\n\n foreach ($payloadIds as $uuid) {\n $uuid = (string) $uuid;\n\n try {\n $playbookCategory = $this->playbookCategoryRepository->findByUuid($uuid);\n } catch (Throwable $throwable) {\n Log::error(__METHOD__ . ' ' . $throwable->getMessage());\n\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory) {\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory->hasPlaybook()) {\n throw new InvalidArgumentException(sprintf('Playbook category %s has no playbook', $uuid));\n }\n\n if ($playbookCategory->getPlaybook()->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Playbook category %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $ids[] = $playbookCategory->getId();\n }\n\n $reportData[$key] = $ids;\n }\n\n return $reportData;\n }\n\n private function validateReportStatus($status): bool\n {\n if (! in_array($status, [true, false], true)) {\n throw new InvalidArgumentException('Report status is invalid');\n }\n\n return $status;\n }\n\n private function validateReportType($type): string\n {\n if (! in_array($type, self::getTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Report type is invalid: %s', $type));\n }\n\n return $type;\n }\n\n private function validateFrequency($frequency): string\n {\n if (! in_array($frequency, self::getFrequencies(), true)) {\n throw new InvalidArgumentException('Frequency is invalid');\n }\n\n return $frequency;\n }\n\n private function validateAdditionalPromptInput(?string $additionalPromptInput): ?string\n {\n if ($additionalPromptInput && strlen($additionalPromptInput) > 5000) {\n throw new InvalidArgumentException('Additional Prompt Input should be less than 5000 characters');\n }\n\n return $additionalPromptInput;\n }\n\n private function validateCustomReportName(?string $customReportName): ?string\n {\n if ($customReportName === null || $customReportName === '') {\n return null;\n }\n\n if (strlen($customReportName) > 70) {\n throw new InvalidArgumentException('Custom report name should be less than 70 characters');\n }\n\n return $customReportName;\n }\n\n private function validateOrganization(?string $organizationUuid): Team\n {\n if (! $organizationUuid) {\n throw new InvalidArgumentException('Organization is required');\n }\n\n $team = $this->teamRepository->idOrUuid($organizationUuid);\n\n if (! $team) {\n throw new InvalidArgumentException('Organization not found');\n }\n\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n throw new InvalidArgumentException('Organization does not have the Automated Reports feature');\n }\n\n return $team;\n }\n\n private function validateAndGetGroupIds(Team $team, array $teamUuids): array\n {\n $groupIds = [];\n\n foreach ($teamUuids as $uuid) {\n $group = $this->groupRepository->findByUuid($uuid);\n\n if ($group === null || $group->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Group %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $groupIds[] = $group->getId();\n\n }\n\n return $groupIds;\n }\n\n private function validateAndGetDealStageIds(Team $team, array $stageUuids, string $propertyLabel): array\n {\n $stageIds = [];\n\n foreach ($stageUuids as $uuid) {\n $stage = $this->stageRepository->findByUuid($uuid);\n\n if ($stage === null || $stage->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Stage %s not found for team %s for %s', $uuid, $team->getUuid(), $propertyLabel)\n );\n }\n\n $stageIds[] = $stage->getId();\n }\n\n return $stageIds;\n }\n\n private function validateAndGetUserIds(array $userUuids, callable $teamCheck): array\n {\n if (empty($userUuids)) {\n return [];\n }\n\n $userIds = [];\n\n foreach ($userUuids as $uuid) {\n $user = $this->userRepository->findByUuid($uuid);\n\n if (! $user || ! $user->isStatusActive()) {\n throw new InvalidArgumentException(\n sprintf('User %s not found or is not active', $uuid)\n );\n }\n\n if (! $teamCheck($user)) {\n throw new InvalidArgumentException(\n sprintf('User %s does not belong to the allowed team(s)', $uuid)\n );\n }\n\n $userIds[] = $user->getId();\n }\n\n return $userIds;\n }\n\n private function validateAndGetUserIdsByTeam(Team $team, array $userUuids): array\n {\n return $this->validateAndGetUserIds($userUuids, fn ($user) => $user->getTeamId() === $team->getId());\n }\n\n private function validateAndGetJiminnyUserIds(array $userUuids): array\n {\n $allowedTeamIds = config('kiosk.teamIds', []);\n\n return $this->validateAndGetUserIds($userUuids, fn ($user) => in_array($user->getTeamId(), $allowedTeamIds, true));\n }\n\n private function parseDate(string $dateString): string\n {\n return date('Y-m-d H:i:s', strtotime($dateString));\n }\n\n private function generateReportResultViewUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.view', ['uuid' => $result->getUuid()]);\n }\n\n private function generateReportResultDownloadUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.download', ['uuid' => $result->getUuid()]);\n }\n\n private function getReportMediaRouteResource(AutomatedReportResult $result): string\n {\n if ($result->getMediaType() === self::MEDIA_TYPE_PDF) {\n return self::PDF_KEY;\n } elseif ($result->getMediaType() === self::MEDIA_TYPE_PODCAST) {\n return self::AUDIO_KEY;\n }\n\n throw new \\InvalidArgumentException('Unknown media type.');\n }\n\n public function getMediaPath(AutomatedReportResult $result): ?string\n {\n $url = match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => $result->getPdfUrl(),\n self::MEDIA_TYPE_PODCAST => $result->getPodcastAudioUrl(),\n default => null,\n };\n\n if ($url === null) {\n return null;\n }\n\n $path = parse_url(trim($url, '\"\\''), PHP_URL_PATH);\n\n return $path ?: null;\n }\n\n public function getFilenameSuffix(AutomatedReportResult $result): ?string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => 'Podcast',\n default => null,\n };\n }\n\n public function getMailSubjectSuffix(AutomatedReportResult $result): string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => 'report',\n self::MEDIA_TYPE_PODCAST => 'podcast',\n default => '',\n };\n }\n\n public function getMediaTypeMetadata(AutomatedReportResult $result): array\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => ['extension' => 'mp3', 'mime' => 'audio/mpeg'],\n self::MEDIA_TYPE_PDF => ['extension' => 'pdf', 'mime' => 'application/pdf'],\n default => ['extension' => null, 'mime' => null],\n };\n }\n\n public function deleteS3Files(AutomatedReportResult $result): void\n {\n $teamUuid = $result->getReport()->getTeam()->getUuid();\n $reportUuid = $result->getUuid();\n\n // delete all files for a report uuid no mather of pdf, podcast, or both\n // in case of both - the podcast files are linked to the pdf (parent) uuid\n // pdf and podcast date times should be close\n $path = sprintf('%s/%s/%s', $teamUuid, self::S3_DIR, $reportUuid);\n\n foreach (self::FILE_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted S3 file', [\n 'path' => $file,\n ]);\n }\n }\n\n foreach (self::FILE_PODCAST_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '_podcast.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted Podcast S3 file', [\n 'path' => $file,\n ]);\n }\n }\n }\n\n /**\n *\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): Collection\n {\n return $this->automatedReportsRepository->getTeamIdsWithReportsResults($teamId);\n }\n\n /**\n * Core delete logic for report results using a query\n *\n * @param Builder $query\n * @param array $logContext\n *\n * @return int\n */\n private function deleteReportResultsByQuery(Builder $query, array $logContext = []): int\n {\n $deletedCount = 0;\n\n if ($query->exists()) {\n Log::info(\n 'Run delete report results',\n array_merge(\n $logContext,\n [\n 'service' => 'AutomatedReportsService',\n ]\n )\n );\n\n $query->chunkById(50, function ($results) use (&$deletedCount, $logContext) {\n foreach ($results as $result) {\n $this->deleteReportResult($result);\n $deletedCount++;\n\n Log::info(\n 'Deleted a report result',\n array_merge(\n $logContext,\n [\n 'result_id' => $result->getId(),\n 'report_id' => $result->getReportId(),\n ]\n )\n );\n }\n });\n }\n\n return $deletedCount;\n }\n\n /**\n * Delete report results for a team by retention period\n *\n * @param Team $team\n * @param CarbonImmutable $retentionDate\n *\n * @return int Number of deleted report results\n */\n public function deleteReportsResultsInRetentionPeriod(Team $team, CarbonImmutable $retentionDate): int\n {\n $reportIds = $this->automatedReportsRepository->getReportIdsByTeam($team);\n\n if ($reportIds->isEmpty()) {\n return 0;\n }\n\n $query = $this->automatedReportsRepository\n ->getReportResultsQueryForRetention($team, $retentionDate);\n\n return $this->deleteReportResultsByQuery($query, [\n 'team_id' => $team->getId(),\n 'retention_date' => $retentionDate->toDateTimeString(),\n ]);\n }\n\n /**\n * Delete ALL report results for a specific automated report\n *\n * @param string $uuid\n *\n * @return int\n */\n public function deleteReportResults(string $uuid): int\n {\n $report = $this->getReport($uuid);\n\n $query = $this->automatedReportsRepository->getResultsByReportQuery($report);\n\n return $this->deleteReportResultsByQuery($query, [\n 'report_uuid' => $uuid,\n 'report_id' => $report->getId(),\n ]);\n }\n\n public function deleteReportResult(AutomatedReportResult $result): void\n {\n $this->deleteS3Files($result);\n\n $result->delete();\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getTeamReports(Team $team): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getReportsByTeam($team);\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getReportResults(AutomatedReport $report): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getResultsByReport($report);\n }\n\n public function deleteAllReportResults(AutomatedReport $report): void\n {\n $results = $this->getReportResults($report);\n\n /** @var AutomatedReportResult $result */\n foreach ($results as $result) {\n Log::info('Deleting result', [\n 'report' => $report->getId(),\n 'result' => $result->getId(),\n ]);\n\n $this->deleteReportResult($result);\n }\n }\n\n public function deleteAllData(Team $team): void\n {\n Log::info('Deleting automated report and results for team', [\n 'team' => $team->getId(),\n ]);\n\n $reports = $this->getTeamReports($team);\n\n /** @var AutomatedReport $report */\n foreach ($reports as $report) {\n Log::info('Deleting report', [\n 'team' => $team->getId(),\n 'report' => $report->getId(),\n ]);\n\n $this->deleteAllReportResults($report);\n\n $report->delete();\n }\n }\n}","depth":4,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Kiosk\\AutomatedReports;\n\nuse Carbon\\CarbonImmutable;\nuse Carbon\\CarbonInterface;\nuse Carbon\\Exceptions\\InvalidFormatException;\nuse DateTime;\nuse DateTimeInterface;\nuse DateTimeZone;\nuse Illuminate\\Contracts\\Bus\\Dispatcher as BusDispatcher;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Support\\Facades\\Log;\nuse Illuminate\\Support\\Facades\\Storage;\nuse Jiminny\\Component\\ActivitySearch\\FilterDefinition\\InputTypeEnum;\nuse Jiminny\\Component\\AskAnything\\AskAnythingPromptService;\nuse Jiminny\\Component\\AskAnything\\Dtos\\AskAnythingPromptDto;\nuse Jiminny\\Component\\UrlGenerator\\Webhook;\nuse Jiminny\\Contracts\\Repositories\\PlaybookCategoryRepository;\nuse Jiminny\\Contracts\\Repositories\\TeamRepository;\nuse Jiminny\\Contracts\\Repositories\\UserRepository;\nuse Jiminny\\Exceptions\\ApplicationException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Exceptions\\ModelNotFoundException;\nuse Jiminny\\Jobs\\AutomatedReports\\RequestGenerateReportJob;\nuse Jiminny\\Models\\Activity\\Search;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPrompt;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPromptTarget;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Contracts\\UserContract;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Repositories\\AskAnythingRepository;\nuse Jiminny\\Repositories\\AutomatedReportsRepository;\nuse Jiminny\\Repositories\\GroupRepository;\nuse Jiminny\\Repositories\\SearchRepository;\nuse Jiminny\\Repositories\\StageRepository;\nuse Throwable;\n\nclass AutomatedReportsService\n{\n public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';\n public const string TYPE_ASK_JIMINNY = 'ask_jiminny';\n\n /**\n * Standard report types (used by kiosk for existing automated reports).\n */\n // @TODO this will add filter, however if we need to control feature by FF we need conditional logic\n public const array TYPES = [\n ['id' => 'exec_summary', 'name' => 'Exec Summary'],\n ['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],\n ['id' => 'product_feedback', 'name' => 'Product Feedback'],\n ['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],\n// ['id' => 'questions', 'name' => 'Questions'],\n// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],\n ];\n\n public const array ALL_TYPES = [\n ...self::TYPES,\n ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],\n ];\n\n public const string FREQUENCY_DAILY = 'daily';\n public const string FREQUENCY_WEEKLY = 'weekly';\n public const string FREQUENCY_MONTHLY = 'monthly';\n public const string FREQUENCY_QUARTERLY = 'quarterly';\n public const string FREQUENCY_ONE_OFF = 'one_off';\n\n /**\n * Frequencies for standard (non-Ask Jiminny) reports.\n */\n public const array FREQUENCIES = [\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n\n /**\n * Frequencies for Ask Jiminny reports.\n */\n public const array ASK_JIMINNY_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ];\n\n public const string MEDIA_TYPE_PDF = 'pdf';\n public const string MEDIA_TYPE_PODCAST = 'podcast';\n public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];\n public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];\n public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];\n public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];\n\n public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];\n public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];\n public const int SENT_REPORT_AT_HOURS = 5;\n public const string PDF_KEY = 'pdf';\n public const string AUDIO_KEY = 'audio';\n\n private const array ALL_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n private const string S3_DIR = 'reports';\n private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];\n private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];\n\n public function __construct(\n private readonly TeamRepository $teamRepository,\n private readonly GroupRepository $groupRepository,\n private readonly UserRepository $userRepository,\n private readonly StageRepository $stageRepository,\n private readonly DealStagesService $dealStagesService,\n private readonly RecipientsService $recipientsService,\n private readonly AutomatedReportsRepository $automatedReportsRepository,\n private readonly Webhook $webhookService,\n private readonly BusDispatcher $dispatcher,\n private readonly ActivityTypeService $activityTypeService,\n private readonly PlaybookCategoryRepository $playbookCategoryRepository,\n private readonly AskAnythingPromptService $askAnythingPromptService,\n private readonly SearchRepository $activitySearchRepository,\n private readonly AskAnythingRepository $askAnythingRepository,\n ) {\n }\n\n public static function getTypes(): array\n {\n $types = self::TYPES;\n\n return array_map(static function ($type) {\n return $type['id'];\n }, $types);\n }\n\n public static function getCallTypes(): array\n {\n return array_map(static function ($callType) {\n return $callType['id'];\n }, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);\n }\n\n public static function getFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::FREQUENCIES);\n }\n\n // front-facing structure\n public function getReportEnabledFieldData(bool $value = false): array\n {\n return [\n 'id' => 'report_enabled',\n 'label' => '',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'value' => $value,\n ];\n }\n\n // Organizations = Teams\n public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array\n {\n $options = $this->getTeams();\n\n if ($shortVersion) {\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value,\n 'dependencies' => [\n 'teams',\n 'deal_stage_at_call',\n 'current_deal_stage',\n 'recipients',\n ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,\n ],\n 'dependsOn' => [],\n ];\n }\n\n // Teams = Groups\n public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array\n {\n if ($shortVersion) {\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value, // value should be an array of objects {id, name}\n 'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],\n 'dependsOn' => [],\n ];\n }\n\n public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array\n {\n $types = [];\n if ($team instanceof Team) {\n if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n $types = self::TYPES;\n }\n if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {\n $types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];\n }\n } else {\n $types = self::TYPES;\n }\n\n if ($shortVersion) {\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'options' => $types,\n ];\n }\n\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $types,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getFrequencyFieldData(?string $value = null): array\n {\n return [\n 'id' => 'frequency',\n 'label' => 'Frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::FREQUENCIES,\n 'value' => $value,\n 'dependencies' => ['period'],\n 'dependsOn' => [],\n ];\n }\n\n public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array\n {\n return [\n 'id' => 'period',\n 'label' => 'Select one-off period',\n 'inputType' => InputTypeEnum::DATE_RANGE,\n 'required' => true,\n 'placeholder' => 'Select',\n 'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],\n 'queryParams' => [\n 'startDate' => 'start_date_period',\n 'endDate' => 'end_date_period',\n ],\n 'dependencies' => [],\n 'dependsOn' => ['frequency'],\n ];\n }\n\n public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array\n {\n return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);\n }\n\n public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);\n }\n\n public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);\n }\n\n public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'deal_value',\n 'label' => 'Deal Value',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_deal_value',\n 'max' => 'max_deal_value',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array\n {\n $value = [];\n $conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;\n $dialerOn && $value[] = self::CALL_TYPE_DIALER;\n\n return [\n 'id' => 'call_type',\n 'label' => 'Call Type',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => [\n self::CALL_TYPE_CONFERENCE,\n self::CALL_TYPE_DIALER,\n ],\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getMediaTypeFieldData(?AutomatedReport $report = null): array\n {\n $value = [];\n\n if ($report) {\n $value = $this->transformMediaTypes($report);\n }\n\n return [\n 'id' => 'media_types',\n 'label' => 'Export as',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => self::MEDIA_TYPE_OBJECTS,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'call_duration',\n 'label' => 'Call Duration',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_call_duration',\n 'max' => 'max_call_duration',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getRecipientsFieldData(?Team $team = null, array $value = []): array\n {\n return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);\n }\n\n public function getJiminnyRecipientsFieldData(array $value = []): array\n {\n return $this->recipientsService->getJiminnyRecipientsFieldData($value);\n }\n\n public function getAdditionalPromptInputFieldData(?string $value = null): array\n {\n return [\n 'id' => 'additional_prompt_input',\n 'label' => 'Special requirements',\n 'inputType' => InputTypeEnum::TEXTAREA,\n 'required' => false,\n 'placeholder' => 'What should be the focus of the report?',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCustomReportNameFieldData(?string $value = null): array\n {\n return [\n 'id' => 'custom_name',\n 'label' => 'Custom report name',\n 'inputType' => InputTypeEnum::TEXT,\n 'required' => false,\n 'placeholder' => 'Enter custom name',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n // data providers\n public function getTeams(): array\n {\n $teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);\n\n $teamData = [];\n foreach ($teams as $team) {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n continue;\n }\n\n $teamData[] = $this->transformTeam($team);\n }\n\n return $teamData;\n }\n\n public function getTeamGroups(string $teamUuid): array\n {\n $data = [];\n $team = $this->getTeam($teamUuid);\n\n if ($team !== null) {\n $groups = $team->groups()->get();\n\n foreach ($groups as $group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n public function getTeamsGroupsOptions(array $filterTeamUuids = []): array\n {\n $data = [];\n $teams = $this->getTeams();\n\n foreach ($teams as $team) {\n if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {\n continue;\n }\n\n $data[] = [\n 'label' => $team['name'],\n 'groups' => $this->getTeamGroups($team['id']),\n ];\n }\n\n return $data;\n }\n\n public function getTeam(string $teamUuid): ?Team\n {\n return $this->teamRepository->idOrUuid($teamUuid);\n }\n\n public function getTeamById(int $teamId): ?Team\n {\n return $this->teamRepository->find($teamId);\n }\n\n public function getGroupsUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportGroups = $report->getGroups();\n foreach ($reportGroups as $groupId) {\n if ($group = $this->groupRepository->find($groupId)) {\n $uuids[] = $group->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getPlaybookCategoriesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $playbookCategories = $report->getPlaybookCategories();\n foreach ($playbookCategories as $id) {\n if ($category = $this->playbookCategoryRepository->find($id)) {\n $uuids[] = $category->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getDealAtCallStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getDealAtCallStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getCurrentDealStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getCurrentDealStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getRecipients());\n }\n\n public function getJiminnyUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function extractUserUuids(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => $user->getUuid())\n ->values()\n ->all();\n }\n\n // get mail data\n public function getRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getRecipients());\n }\n\n /**\n * @return array<UserContract>\n */\n public function getRecipientUserObjects(AutomatedReport $report): array\n {\n $userIds = $report->getRecipients()['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->values()\n ->all();\n }\n\n private function getJiminnyRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function buildRecipientUsers(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => [\n 'email' => $user->getEmailAddress(),\n 'name' => $user->getName(),\n 'timezone' => $user->getTimezone()->getName(),\n ])\n ->values()\n ->all();\n }\n\n public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array\n {\n if ($report->isAskJiminnyReport()) {\n $recipients = $this->resolveAskJiminnyRecipients($report);\n } else {\n $recipients = $this->getRecipientUsers($report);\n if ($includeJiminny) {\n $recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));\n }\n }\n\n $emails = [];\n\n return array_values(array_filter(\n $recipients,\n static function ($recipient) use (&$emails) {\n if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {\n return false;\n }\n $emails[] = $recipient['email'];\n\n return true;\n }\n ));\n }\n\n private function resolveAskJiminnyRecipients(AutomatedReport $report): array\n {\n $recipients = [];\n\n $creator = $report->getCreator();\n if ($creator !== null) {\n $recipients[] = [\n 'email' => $creator->getEmailAddress(),\n 'name' => $creator->getName(),\n 'timezone' => $creator->getTimezone()->getName(),\n ];\n }\n\n return array_merge(\n $recipients,\n $this->buildRecipientUsers($report->getRecipients()),\n $this->getGroupRecipientUsers($report),\n );\n }\n\n private function getGroupRecipientUsers(AutomatedReport $report): array\n {\n $users = [];\n foreach ($report->getGroups() as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group === null) {\n continue;\n }\n foreach ($group->getMembers() as $member) {\n $users[] = [\n 'email' => $member->getEmailAddress(),\n 'name' => $member->getName(),\n 'timezone' => $member->getTimezone()->getName(),\n ];\n }\n }\n\n return $users;\n }\n\n public function getReportTypeName(AutomatedReportResult $report): string\n {\n $type = $report->getReport()->getType();\n\n $getType = $this->transformReportType($type);\n\n return $getType['name'];\n }\n\n public function getReportPeriodName(AutomatedReportResult $report): string\n {\n $from = $report->getFromDate();\n $to = $report->getToDate();\n $frequency = $report->getReport()->getFrequency();\n\n if ($from === null || $to === null) {\n if (! $report->getReport()->isAskJiminnyReport()) {\n $invalidPeriod = $from === null ? 'from' : 'to';\n\n throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);\n }\n\n $period = $this->calculateFromAndToDatePeriod($frequency);\n $from = $period['fromDate'];\n $to = $period['toDate'];\n }\n\n return $this->formatReportPeriodName($frequency, $from, $to);\n }\n\n private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string\n {\n $fromYear = $from->format('Y');\n $toYear = $to->format('Y');\n $differentYears = $fromYear !== $toYear;\n\n switch ($frequency) {\n case self::FREQUENCY_DAILY:\n return $from->format('j M Y');\n\n case self::FREQUENCY_QUARTERLY:\n // 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ\n $startMonth = $from->format('M');\n $endMonth = $to->copy()->subMonth();\n $endMonthName = $endMonth->format('M');\n $endMonthYear = $endMonth->format('Y');\n\n if ($differentYears) {\n return \"{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}\";\n }\n\n return \"{$startMonth} - {$endMonthName} {$toYear}\";\n\n case self::FREQUENCY_MONTHLY:\n // 'May 2025' - monthly reports are always within the same year\n return $from->format('M Y');\n\n case self::FREQUENCY_WEEKLY:\n // '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ\n $startDay = $from->format('j');\n $endDay = $to->format('j');\n $startMonth = $from->format('M');\n $endMonth = $to->format('M');\n\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n if ($startMonth !== $endMonth) {\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n return \"{$startDay} - {$endDay} {$endMonth} {$toYear}\";\n\n case self::FREQUENCY_ONE_OFF:\n // '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ\n $startDay = $from->format('j');\n $startMonth = $from->format('M');\n $endDay = $to->format('j');\n $endMonth = $to->format('M');\n\n // If same month and year, use a format like '2-31 May 2025'\n if ($startMonth === $endMonth && ! $differentYears) {\n return \"{$startDay} - {$endDay} {$startMonth} {$toYear}\";\n }\n\n // If different years, include both years\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n // Same year but different months\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n\n default:\n // Default format for unknown frequencies\n return $from->format('j M Y') . ' - ' . $to->format('j M Y');\n }\n }\n\n public function getReportTeamsName(AutomatedReportResult $report): string\n {\n $groups = $report->getGroups();\n\n if (empty($groups)) {\n return 'All';\n }\n\n // Get group names from repository\n $groupNames = [];\n foreach ($groups as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group) {\n $groupNames[] = $group->getName();\n }\n }\n\n if (count($groupNames) === 1) {\n // Single team format\n $teamsName = $groupNames[0];\n } else {\n // Multiple teams format\n $teamsName = implode(', ', $groupNames);\n }\n\n return $teamsName;\n }\n\n public function getReportFileName(AutomatedReportResult $report): string\n {\n $customName = $report->getReport()->getCustomName();\n $periodName = $this->getReportPeriodName($report);\n $filenameSuffix = $this->getFilenameSuffix($report);\n\n if ($customName) {\n if ($filenameSuffix) {\n $customName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$customName} - {$periodName}\");\n }\n\n $baseName = $this->getReportTypeName($report);\n\n if ($filenameSuffix) {\n $baseName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}\");\n }\n\n public function getReportFileNameWithExtension(AutomatedReportResult $result): string\n {\n $extension = $this->getMediaTypeMetadata($result)['extension'];\n\n return $this->getReportFileName($result) . '.' . $extension;\n }\n\n public function sanitizeFileName(string $fileName): string\n {\n return str_replace(['/', '\\\\'], '-', $fileName);\n }\n\n public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool\n {\n $recipients = array_map('intval', $report->getRecipients()['users'] ?? []);\n\n return in_array($user->getId(), $recipients);\n }\n\n public function transformReportResults(Collection $automatedReportResults): array\n {\n $data = [];\n foreach ($automatedReportResults as $automatedReportResult) {\n /** @var AutomatedReportResult $automatedReportResult */\n\n $report = $automatedReportResult->getReport();\n\n $createdBy = $report->getCreator();\n $creator = [\n 'id' => $createdBy?->getUuid(),\n 'name' => $createdBy?->getName(),\n 'email' => $createdBy?->getEmailAddress(),\n 'photoUrl' => $createdBy?->getPhotoUrl(),\n ];\n\n $data[] = [\n 'id' => $automatedReportResult->getUuid(),\n 'name' => $automatedReportResult->getName(),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n 'recipients' => $this->buildRecipients($report),\n 'report_type' => $this->transformReportType($report->getType()),\n 'media_type' => $automatedReportResult->getMediaType(),\n 'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),\n 'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),\n 'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),\n 'creator' => $creator,\n ];\n }\n\n return $data;\n }\n\n private function buildRecipients(AutomatedReport $report): array\n {\n $creatorUuid = $report->getCreator()?->getUuid();\n\n $recipients = array_values(array_filter(\n $this->transformRecipients($report->getRecipients()),\n static fn (array $recipient): bool => $recipient['id'] !== $creatorUuid,\n ));\n\n if (! $report->isAskJiminnyReport()) {\n return $recipients;\n }\n\n return [\n ...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),\n ...$recipients,\n ];\n }\n\n public function hasCallTypeConference(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);\n }\n\n public function hasCallTypeDialer(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);\n }\n\n // transformers\n private function transformTeam(Team $team): array\n {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n return [];\n }\n\n return [\n 'id' => $team->getUuid(),\n 'name' => $team->getName(),\n ];\n }\n\n private function transformReportFullView(AutomatedReport $report): array\n {\n $base = $this->transformReportBase($report);\n\n return $report->getType() === self::TYPE_ASK_JIMINNY\n ? $base + $this->transformAskJiminnyFields($report)\n : $base + $this->transformStandardReportFields($report);\n }\n\n private function transformReportBase(AutomatedReport $report): array\n {\n return [\n 'id' => $report->getUuid(),\n 'organization' => $this->transformOrganization(team: $report->getTeam()),\n 'report_type' => $this->transformReportType($report->getType()),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n ];\n }\n\n private function transformStandardReportFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n\n return [\n 'report_enabled' => $report->getStatus(),\n 'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),\n 'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),\n 'deal_value_min' => $report->getDealValueMin(),\n 'deal_value_max' => $report->getDealValueMax(),\n 'call_types' => $this->transformCallType($report->getCallTypes()),\n 'media_types' => $this->transformMediaTypes($report),\n 'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),\n 'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),\n 'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),\n 'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),\n 'recipients' => $this->transformRecipients($report->getRecipients()),\n 'created_by' => $this->transformCreator($report->getCreator()),\n 'additional_prompt_input' => $report->getAdditionalPromptInput(),\n 'custom_name' => $report->getCustomName(),\n 'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),\n 'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),\n 'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),\n ];\n }\n\n private function transformAskJiminnyFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n $creatorId = $report->getAttribute('created_by');\n $explicitUserIds = array_values(array_filter(\n $report->getRecipients()['users'] ?? [],\n static fn ($id) => $id !== $creatorId\n ));\n\n return [\n 'report_name' => $report->getCustomName(),\n 'enabled' => $report->getStatus(),\n 'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),\n 'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),\n 'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),\n 'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),\n ];\n }\n\n private function transformOrganization(?Team $team): array\n {\n return [\n 'id' => $team?->getUuid(),\n 'name' => $team?->getName(),\n ];\n }\n\n private function transformReportType(string $type): array\n {\n foreach (self::ALL_TYPES as $typeItem) {\n if ($typeItem['id'] === $type) {\n return $typeItem;\n }\n }\n\n return [];\n }\n\n private function transformCallType(array $types): array\n {\n $result = [];\n $callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];\n\n foreach ($types as $type) {\n foreach ($callTypes as $callTypeItem) {\n if ($callTypeItem['id'] === $type) {\n $result[] = $callTypeItem;\n\n break;\n }\n }\n }\n\n return $result;\n }\n\n private function transformMediaTypes(AutomatedReport $report): array\n {\n $values = [];\n\n foreach ($report->getMediaTypes() as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n continue;\n }\n\n $values[] = match ($mediaType) {\n self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,\n self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,\n };\n }\n\n return $values;\n }\n\n private function transformFrequency(string $frequency): array\n {\n foreach (self::ALL_FREQUENCIES as $frequencyItem) {\n if ($frequencyItem['id'] === $frequency) {\n return $frequencyItem;\n }\n }\n\n return [];\n }\n\n public function transformDurationToMinutes(?int $duration): ?int\n {\n if (! $duration) {\n return null;\n }\n\n return (int) ($duration / 60);\n }\n\n private function transformGroups(?Team $team, array $groupsIds): array\n {\n if (empty($groupsIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($groupsIds as $groupId) {\n $group = $team->groups()->where('id', $groupId)->first();\n\n if ($group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n 'photoUrl' => $group->getPhotoUrl(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformStages(?Team $team, array $stagesIds): array\n {\n if (empty($stagesIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($stagesIds as $stageId) {\n $stage = $team->stages()->where('id', $stageId)->first();\n\n if ($stage) {\n $data[] = [\n 'id' => $stage->getUuid(),\n 'name' => $stage->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformRecipients(array $recipients): array\n {\n $users = [];\n foreach ($recipients['users'] ?? [] as $userId) {\n $users[] = $this->transformUser($userId);\n }\n\n return $users;\n }\n\n private function transformCreator(?User $user): ?array\n {\n if ($user === null) {\n return null;\n }\n\n return $this->transformUser($user->getId());\n }\n\n private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array\n {\n if ($prompt === null) {\n return null;\n }\n\n return [\n 'id' => $prompt->getUuid(),\n 'name' => $prompt->getTitle(),\n ];\n }\n\n private function transformSafeSearch(?Search $search): ?array\n {\n if ($search === null) {\n return null;\n }\n\n return [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ];\n }\n\n private function transformUser(int $userId): array\n {\n /* @var ?User $user */\n $user = $this->userRepository->find($userId);\n\n return [\n 'id' => $user?->getUuid(),\n 'name' => $user?->getName(),\n 'email' => $user?->getEmailAddress(),\n 'photoUrl' => $user?->getPhotoUrl(),\n ];\n }\n\n public function create(array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $validatedData['created_by'] = auth()->id();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function update(string $uuid, array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $report = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $report) {\n throw new InvalidArgumentException('Report not found');\n }\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Create an Ask Jiminny report.\n */\n public function createAskJiminnyReport(array $data, User $creator): array\n {\n $validatedData = $this->validateAskJiminnyReportData($data, $creator);\n $validatedData['created_by'] = $creator->getId();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Update an Ask Jiminny report.\n */\n public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array\n {\n if (! $report->isAskJiminnyReport()) {\n throw new InvalidArgumentException('Report is not an Ask Jiminny report');\n }\n\n $validatedData = $this->validateAskJiminnyReportData($data, $user);\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array\n {\n $this->automatedReportsRepository->update($report, ['status' => $status]);\n\n return $this->transformReportFullView($report->fresh());\n }\n\n /**\n * Validate and transform data for Ask Jiminny reports.\n */\n private function validateAskJiminnyReportData(array $data, User $user): array\n {\n // Validate name\n $name = trim($data['report_name'] ?? '');\n if (empty($name)) {\n throw new InvalidArgumentException('Report name is required');\n }\n if (mb_strlen($name) > 50) {\n throw new InvalidArgumentException('Report name must be 50 characters or less');\n }\n\n // Validate frequency (only daily, weekly, monthly for Ask Jiminny)\n $frequency = $data['frequency'] ?? null;\n $askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];\n if (! in_array($frequency, $askJiminnyFrequencies, true)) {\n throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');\n }\n\n // Validate expiration date\n $expiresAt = $data['expires_on'] ?? null;\n if (empty($expiresAt)) {\n throw new InvalidArgumentException('Expiration date is required');\n }\n\n try {\n $expiresAtDate = Carbon::parse($expiresAt);\n } catch (InvalidFormatException $e) {\n throw new InvalidArgumentException('Expiration date format is invalid');\n }\n $maxExpiration = Carbon::now()->addYear()->endOfDay();\n if ($expiresAtDate->gt($maxExpiration)) {\n throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');\n }\n if ($expiresAtDate->isPast()) {\n throw new InvalidArgumentException('Expiration date cannot be in the past');\n }\n\n // Validate saved search\n $activitySearchId = $data['saved_search'] ?? null;\n if (empty($activitySearchId)) {\n throw new InvalidArgumentException('Saved search is required');\n }\n $savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);\n if (! $savedSearch) {\n throw new InvalidArgumentException('Saved search not found or does not belong to you');\n }\n\n // Validate saved prompt\n $askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;\n if (empty($askAnythingPromptId)) {\n throw new InvalidArgumentException('Ask Jiminny prompt is required');\n }\n $prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);\n if (! $prompt) {\n throw new InvalidArgumentException('Ask Jiminny prompt not found');\n }\n\n // Validate status\n $status = $data['enabled'] ?? false;\n\n $recipientUserIds = [$user->getId()];\n\n if (! empty($data['share_users'])) {\n $sharedUserIds = $this->validateAndGetUserIdsByTeam(\n $user->team,\n (array) $data['share_users']\n );\n $recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);\n }\n\n $sharedGroupIds = [];\n if (! empty($data['share_teams'])) {\n $sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);\n }\n\n $recipientUserIds = array_values(array_unique($recipientUserIds));\n\n return [\n 'team_id' => $user->getTeamId(),\n 'type' => self::TYPE_ASK_JIMINNY,\n 'status' => (bool) $status,\n 'frequency' => $frequency,\n 'custom_name' => $name,\n 'activity_search_id' => $savedSearch->getId(),\n 'ask_anything_prompt_id' => $prompt->getId(),\n 'expires_at' => $expiresAtDate->toDateString(),\n 'media_types' => [self::MEDIA_TYPE_PDF],\n 'call_types' => [],\n 'recipients' => ['users' => $recipientUserIds],\n 'groups' => $sharedGroupIds,\n ];\n }\n\n public static function getAskJiminnyFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::ASK_JIMINNY_FREQUENCIES);\n }\n\n public function getAskJiminnyReportFilters(User $user): array\n {\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n return [\n [\n 'id' => 'prompt',\n 'label' => 'Prompt',\n 'options' => $prompts,\n ],\n [\n 'id' => 'saved_search',\n 'label' => 'Saved Search',\n 'options' => $savedSearches,\n ],\n ];\n }\n\n public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array\n {\n $team = $user->getTeam();\n $userTimezone = $user->getTimezone();\n\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n $teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ])->values()->all();\n\n $shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];\n\n $sharedTeamsValue = [];\n $sharedUsersValue = [];\n if ($report) {\n $sharedTeamsValue = $this->transformGroups($team, $report->getGroups());\n\n $recipientUserIds = $report->getRecipients()['users'] ?? [];\n $creatorId = $report->getAttribute('created_by');\n $sharedUserIds = array_values(array_filter(\n $recipientUserIds,\n static fn ($id) => $id !== $creatorId\n ));\n $sharedUsersValue = collect($sharedUserIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (User $u) => [\n 'id' => $u->getUuid(),\n 'name' => $u->getName(),\n ])\n ->values()\n ->all();\n }\n\n return [\n 'fields' => [\n [\n 'id' => 'enabled',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'label' => '',\n 'value' => $report?->getStatus() ?? false,\n ],\n [\n 'id' => 'report_name',\n 'inputType' => InputTypeEnum::TEXT,\n 'label' => 'Name',\n 'placeholder' => 'Enter name',\n 'required' => true,\n 'validation' => ['maxLength' => 50],\n 'value' => $report?->getCustomName() ?? '',\n ],\n [\n 'id' => 'frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Frequency',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::ASK_JIMINNY_FREQUENCIES,\n 'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,\n ],\n [\n 'id' => 'expires_on',\n 'inputType' => InputTypeEnum::DATE,\n 'label' => 'Expires on',\n 'required' => true,\n 'placeholder' => 'Select',\n 'validation' => [\n 'minDate' => now($userTimezone)->toDateString(),\n 'maxDate' => now($userTimezone)->addYear()->toDateString(),\n ],\n 'value' => $report?->getExpiresAt()?->toDateString(),\n ],\n [\n 'id' => 'share_teams',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team',\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $teamGroups,\n 'value' => $sharedTeamsValue,\n ],\n [\n 'id' => 'share_users',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team member',\n 'required' => false,\n 'placeholder' => 'Select',\n 'groupLabelKey' => 'label',\n 'groupValuesKey' => 'users',\n 'optionLabelKey' => 'name',\n 'optionValueKey' => 'id',\n 'options' => $shareUsers,\n 'value' => $sharedUsersValue,\n ],\n [\n 'id' => 'saved_search',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Saved search',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $savedSearches,\n 'value' => $report && $report->getSavedSearch() ? [\n 'id' => $report->getSavedSearch()->getUuid(),\n 'name' => $report->getSavedSearch()->getName(),\n ] : null,\n ],\n [\n 'id' => 'ask_jiminny_prompt',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Ask Jiminny prompt',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $prompts,\n 'value' => $report && $report->getAskAnythingPrompt() ? [\n 'id' => $report->getAskAnythingPrompt()->getUuid(),\n 'name' => $report->getAskAnythingPrompt()->getTitle(),\n ] : null,\n ],\n ],\n ];\n }\n\n private function updateResultNames(AutomatedReport $automatedReport): void\n {\n $results = $this->automatedReportsRepository->getResultsByReport($automatedReport);\n\n foreach ($results as $result) {\n $result->update(['name' => $this->getReportFileName($result)]);\n }\n }\n\n public function updateStatus(string $uuid, array $data): array\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $automatedReport->update([\n 'status' => $status,\n ]);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n private function generateOneOffReport(AutomatedReport $automatedReport): void\n {\n // the scheduler handles all the other frequency types\n if ($automatedReport->getStatus() === false || $automatedReport->getFrequency() !== self::FREQUENCY_ONE_OFF) {\n return;\n }\n\n $this->dispatcher->dispatch(new RequestGenerateReportJob($automatedReport->getUuid()));\n }\n\n public function getReport(string $uuid): AutomatedReport\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n return $automatedReport;\n }\n\n public function get(string $uuid): array\n {\n $automatedReport = $this->getReport($uuid);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function list(string $sortColumn = 'created_at', string $sortDirection = 'desc'): array\n {\n $results = [];\n $collection = $this->automatedReportsRepository->getAllStandardReports($sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function listAskJiminnyReports(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): array {\n $results = [];\n $collection = $this->automatedReportsRepository->getAskJiminnyReportsByUser($user, $sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function delete(string $uuid): void\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $automatedReport->delete();\n }\n\n public function createReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n return $this->automatedReportsRepository->createResult(\n array_merge(\n [\n 'report_id' => $automatedReport->getId(),\n 'status' => AutomatedReportResult::STATUS_DEFAULT,\n ],\n $data\n )\n );\n }\n\n public function getOrCreateReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n $existing = $this->automatedReportsRepository->findLatestDefaultOrFailedResult($automatedReport);\n\n if ($existing !== null) {\n $existing->update(['status' => AutomatedReportResult::STATUS_DEFAULT]);\n\n return $existing;\n }\n\n return $this->createReportResult($automatedReport, $data);\n }\n\n public function getReportResult(string $resultUuid): AutomatedReportResult\n {\n $report = $this->automatedReportsRepository->findResultByUuid($resultUuid);\n\n if (! $report) {\n throw new ModelNotFoundException('Report Result not found');\n }\n\n return $report;\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return $this->automatedReportsRepository->findChildResult($result, $type);\n }\n\n // prophet API calls\n /**\n * @throws ApplicationException\n */\n public function getGenerateReportPayload(AutomatedReport $automatedReport, string $reportResultUuid): array\n {\n $period = $this->calculateFromAndToDate($automatedReport);\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n return [\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResultUuid,\n 'report_type' => $automatedReport->getType(),\n 'media_types' => $automatedReport->getMediaTypes(),\n 'from_date' => $fromDate->startOfDay()->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->endOfDay()->format(DateTimeInterface::RFC3339),\n 'group_ids' => $automatedReport->getGroups(),\n 'call_deal_stage' => $automatedReport->getDealAtCallStages(),\n 'current_deal_stage' => $automatedReport->getCurrentDealStages(),\n 'deal_min_value' => $automatedReport->getDealValueMin(),\n 'deal_max_value' => $automatedReport->getDealValueMax(),\n 'call_types' => $automatedReport->getCallTypes(),\n 'call_duration_min_seconds' => $automatedReport->getCallDurationMin(),\n 'call_duration_max_seconds' => $automatedReport->getCallDurationMax(),\n 'special_requirements' => $automatedReport->getAdditionalPromptInput(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->formatReportPeriodName(\n $automatedReport->getFrequency(),\n $fromDate,\n $toDate,\n ),\n 'playbook_categories' => $automatedReport->getPlaybookCategories(),\n 'custom_name' => $automatedReport->getCustomName(),\n ];\n }\n\n // $inputPayload - FE payload structure\n public function getActivitiesCountPayload(array $inputPayload): array\n {\n // Use validateAndTransformData to validate and normalize input\n $validatedData = $this->validateAndTransformData($inputPayload);\n $period = $this->calculateFromAndToDatePeriod(\n $validatedData['frequency'],\n Carbon::parse($validatedData['from']),\n Carbon::parse($validatedData['to']),\n );\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n // Create payload similar to getGenerateReportPayload\n return [\n 'team_id' => $validatedData['team_id'],\n 'group_ids' => $validatedData['groups'] ?? [],\n 'report_type' => $validatedData['type'],\n 'from_date' => $fromDate->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->format(DateTimeInterface::RFC3339),\n 'call_deal_stage' => $validatedData['deal_at_call_stages'] ?? [],\n 'current_deal_stage' => $validatedData['current_deal_stages'] ?? [],\n 'deal_min_value' => $validatedData['deal_value_min'] ?? null,\n 'deal_max_value' => $validatedData['deal_value_max'] ?? null,\n 'call_types' => $validatedData['call_types'],\n 'call_duration_min_seconds' => $validatedData['call_duration_min'] ?? null,\n 'call_duration_max_seconds' => $validatedData['call_duration_max'] ?? null,\n 'special_requirements' => $validatedData['additional_prompt_input'] ?? null,\n 'playbook_categories' => $validatedData['playbook_categories'] ?? [],\n 'request_id' => null,\n 'callback_url' => null,\n ];\n }\n\n public function shouldSendReport(array $users, ?CarbonInterface $generatedAt = null): bool\n {\n if (empty($users)) {\n return false;\n }\n\n $earliestTz = collect($users)\n ->mapWithKeys(function (array $user) {\n $tz = new DateTimeZone($user['timezone']);\n $nowUtc = new DateTime('now', new DateTimeZone('UTC'));\n $offset = $tz->getOffset($nowUtc);\n\n return [$user['timezone'] => $offset];\n })\n ->sortDesc()\n ->keys()\n ->first();\n\n $now = Carbon::now($earliestTz);\n $isScheduledTime = (int) $now->format('H') === self::SENT_REPORT_AT_HOURS;\n\n if ($isScheduledTime) {\n return true;\n }\n\n return $this->hasPassedScheduledTime($generatedAt, $earliestTz);\n }\n\n public function hasPassedScheduledTime(?CarbonInterface $generatedAt, string $timezone): bool\n {\n if ($generatedAt === null) {\n return false;\n }\n\n $now = Carbon::now($timezone);\n $scheduledTime = $now->copy()->setTime(self::SENT_REPORT_AT_HOURS, 0, 0);\n\n if ($now->hour < self::SENT_REPORT_AT_HOURS) {\n $scheduledTime = $scheduledTime->subDay();\n }\n\n $scheduledTimeUtc = $scheduledTime->copy()->utc();\n $generatedAtUtc = $generatedAt->copy()->utc();\n $nowUtc = $now->copy()->utc();\n\n return $generatedAtUtc->lt($scheduledTimeUtc) && $nowUtc->gt($scheduledTimeUtc);\n }\n\n public function calculateFromAndToDatePeriod(\n string $frequency,\n ?Carbon $fromDate = null,\n ?Carbon $toDate = null\n ): array {\n if ($frequency === self::FREQUENCY_ONE_OFF) {\n return [\n 'fromDate' => $fromDate,\n 'toDate' => $toDate,\n ];\n }\n\n $now = Carbon::now();\n\n return match ($frequency) {\n self::FREQUENCY_DAILY => [\n 'fromDate' => $now->copy()->subDay()->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_WEEKLY => [\n 'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_MONTHLY => [\n 'fromDate' => $now->copy()->subMonths(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_QUARTERLY => [\n 'fromDate' => $now->copy()->subMonths(3)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n default => throw new InvalidArgumentException(\"Unsupported frequency: {$frequency}\"),\n };\n }\n\n private function calculateFromAndToDate(AutomatedReport $automatedReport): array\n {\n return $this->calculateFromAndToDatePeriod(\n $automatedReport->getFrequency(),\n $automatedReport->getFrom(),\n $automatedReport->getTo()\n );\n }\n\n public function getAskJiminnyGenerateReportPayload(\n AutomatedReport $automatedReport,\n AutomatedReportResult $reportResult,\n array $activityIds,\n ): array {\n return [\n 'user_question' => $automatedReport->getAskAnythingPrompt()?->getContent(),\n 'call_ids' => array_map('strval', $activityIds),\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResult->getUuid(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->getReportPeriodName($reportResult),\n 'report_name' => $automatedReport->getCustomName(),\n ];\n }\n\n private function getCallbackUrl(): string\n {\n return $this->webhookService->route('jiminny.webhook.reports.ready');\n }\n\n /**\n * Validate and transform payload data for automated reports\n *\n * @param array $data\n *\n * @throws InvalidArgumentException\n *\n * @return array\n */\n private function validateAndTransformData(array $data): array\n {\n // Validate organization (team) and check feature\n $team = $this->validateOrganization($data['organization'] ?? null);\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $type = $this->validateReportType($data['report_type'] ?? null);\n $frequency = $this->validateFrequency($data['frequency'] ?? null);\n $additionalPromptInput = $this->validateAdditionalPromptInput(\n $data['additional_prompt_input'] ?? null\n );\n $customReportName = $this->validateCustomReportName($data['custom_name'] ?? null);\n\n // Prepare data for the database\n $reportData = [\n 'team_id' => $team->getId(),\n 'type' => $type,\n 'status' => $status,\n 'frequency' => $frequency,\n 'additional_prompt_input' => $additionalPromptInput,\n 'custom_name' => $customReportName,\n ];\n\n // Validate deal values\n $reportData = $this->validateDealValues($data, $reportData);\n\n // Validate date range\n $reportData = $this->validateDateRange($data, $reportData, $frequency);\n\n // Validate call durations\n $reportData = $this->validateCallDurations($data, $reportData);\n\n // Validate call types\n $reportData = $this->validateCallTypes($data, $reportData);\n\n // Validate media types\n $reportData = $this->validateMediaTypes($data, $reportData);\n\n // Validate groups\n if (isset($data['teams'])) {\n $reportData['groups'] = $this->validateAndGetGroupIds($team, $data['teams']);\n }\n\n // Validate deal stages\n $reportData = $this->validateDealStages($data, $reportData, $team, $type);\n\n // Validate playbook categories\n $reportData = $this->validatePlaybookCategories($data, $reportData, $team);\n\n // Validate recipients\n $reportData['recipients'] = [\n 'users' => $this->validateAndGetUserIdsByTeam($team, $data['recipients'] ?? []),\n ];\n\n if (isset($data['jiminny_recipients'])) {\n // Validate Jiminny recipients\n $reportData['jiminny_recipients'] = [\n 'users' => $this->validateAndGetJiminnyUserIds((array) $data['jiminny_recipients']),\n ];\n }\n\n return $reportData;\n }\n\n private function validateDealValues(array $data, array $reportData): array\n {\n if (isset($data['min_deal_value'])) {\n $reportData['deal_value_min'] = (int) $data['min_deal_value'];\n\n if ($reportData['deal_value_min'] > 4294967295 || $reportData['deal_value_min'] < 0) {\n throw new InvalidArgumentException('Min deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_deal_value'])) {\n $reportData['deal_value_max'] = (int) $data['max_deal_value'];\n\n if ($reportData['deal_value_max'] > 4294967295 || $reportData['deal_value_max'] < 0) {\n throw new InvalidArgumentException('Max deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['min_deal_value'], $data['max_deal_value'])\n && $data['min_deal_value'] > $data['max_deal_value']\n ) {\n throw new InvalidArgumentException('Min deal value cannot be greater than max deal value');\n }\n\n return $reportData;\n }\n\n private function validateDateRange(array $data, array $reportData, string $frequency): array\n {\n // Set date range only for one_off frequency\n if ($frequency === 'one_off') {\n if (isset($data['start_date_period'])) {\n $reportData['from'] = $this->parseDate($data['start_date_period']);\n }\n\n if (isset($data['end_date_period'])) {\n $reportData['to'] = $this->parseDate($data['end_date_period']);\n }\n\n if (empty($reportData['from']) || empty($reportData['to'])) {\n throw new InvalidArgumentException(\n 'Start date and end date are required for one_off frequency'\n );\n }\n } else {\n $reportData['from'] = null;\n $reportData['to'] = null;\n }\n\n return $reportData;\n }\n\n private function validateCallDurations(array $data, array $reportData): array\n {\n // Convert call durations from minutes to seconds\n if (isset($data['min_call_duration'])) {\n $reportData['call_duration_min'] = (int) $data['min_call_duration'] * 60;\n\n if ($reportData['call_duration_min'] > 4294967295 || $reportData['call_duration_min'] < 0) {\n throw new InvalidArgumentException('Min call duration should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_call_duration'])) {\n $reportData['call_duration_max'] = (int) $data['max_call_duration'] * 60;\n\n if ($reportData['call_duration_max'] > 4294967295 || $reportData['call_duration_max'] < 0) {\n throw new InvalidArgumentException('Max call duration should be between 0 and 4294967295');\n }\n }\n\n return $reportData;\n }\n\n private function validateCallTypes(array $data, array $reportData): array\n {\n // Set call types\n $reportData['call_types'] = $data['call_type'] ?? [];\n if (empty($reportData['call_types'])) {\n $reportData['call_types'] = self::getCallTypes();\n }\n\n foreach ($reportData['call_types'] as $callType) {\n if (! in_array($callType, self::getCallTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Call type %s is invalid', $callType));\n }\n }\n\n return $reportData;\n }\n\n private function validateMediaTypes(array $data, array $reportData): array\n {\n // Set media types from input data\n $reportData['media_types'] = $data['media_types'] ?? [];\n\n if (empty($reportData['media_types'])) {\n throw new InvalidArgumentException('Media types are required');\n }\n\n foreach ($reportData['media_types'] as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n throw new InvalidArgumentException(sprintf('Media type %s is invalid', $mediaType));\n }\n }\n\n return $reportData;\n }\n\n private function validateDealStages(array $data, array $reportData, Team $team, string $reportType): array\n {\n // Validate and set deal stages\n if (isset($data['deal_stage_at_call'])) {\n $reportData['deal_at_call_stages'] =\n $this->validateAndGetDealStageIds($team, $data['deal_stage_at_call'], 'Deal stage at call');\n }\n\n if (isset($data['current_deal_stage'])) {\n $reportData['current_deal_stages'] =\n $this->validateAndGetDealStageIds($team, $data['current_deal_stage'], 'Current deal stage');\n }\n\n // Ensure current_deal_stage is not provided for loss_analysis report type\n if ($reportType === self::TYPE_LOSS_ANALYSIS && ! empty($data['current_deal_stage'])) {\n throw new InvalidArgumentException('Current deal stage is not applicable for Loss Analysis reports');\n }\n\n return $reportData;\n }\n\n // transform uuid to id\n private function validatePlaybookCategories(array $data, array $reportData, Team $team): array\n {\n $key = 'playbook_categories';\n\n if (isset($data[$key])) {\n $payloadIds = $data[$key];\n $ids = [];\n\n foreach ($payloadIds as $uuid) {\n $uuid = (string) $uuid;\n\n try {\n $playbookCategory = $this->playbookCategoryRepository->findByUuid($uuid);\n } catch (Throwable $throwable) {\n Log::error(__METHOD__ . ' ' . $throwable->getMessage());\n\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory) {\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory->hasPlaybook()) {\n throw new InvalidArgumentException(sprintf('Playbook category %s has no playbook', $uuid));\n }\n\n if ($playbookCategory->getPlaybook()->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Playbook category %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $ids[] = $playbookCategory->getId();\n }\n\n $reportData[$key] = $ids;\n }\n\n return $reportData;\n }\n\n private function validateReportStatus($status): bool\n {\n if (! in_array($status, [true, false], true)) {\n throw new InvalidArgumentException('Report status is invalid');\n }\n\n return $status;\n }\n\n private function validateReportType($type): string\n {\n if (! in_array($type, self::getTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Report type is invalid: %s', $type));\n }\n\n return $type;\n }\n\n private function validateFrequency($frequency): string\n {\n if (! in_array($frequency, self::getFrequencies(), true)) {\n throw new InvalidArgumentException('Frequency is invalid');\n }\n\n return $frequency;\n }\n\n private function validateAdditionalPromptInput(?string $additionalPromptInput): ?string\n {\n if ($additionalPromptInput && strlen($additionalPromptInput) > 5000) {\n throw new InvalidArgumentException('Additional Prompt Input should be less than 5000 characters');\n }\n\n return $additionalPromptInput;\n }\n\n private function validateCustomReportName(?string $customReportName): ?string\n {\n if ($customReportName === null || $customReportName === '') {\n return null;\n }\n\n if (strlen($customReportName) > 70) {\n throw new InvalidArgumentException('Custom report name should be less than 70 characters');\n }\n\n return $customReportName;\n }\n\n private function validateOrganization(?string $organizationUuid): Team\n {\n if (! $organizationUuid) {\n throw new InvalidArgumentException('Organization is required');\n }\n\n $team = $this->teamRepository->idOrUuid($organizationUuid);\n\n if (! $team) {\n throw new InvalidArgumentException('Organization not found');\n }\n\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n throw new InvalidArgumentException('Organization does not have the Automated Reports feature');\n }\n\n return $team;\n }\n\n private function validateAndGetGroupIds(Team $team, array $teamUuids): array\n {\n $groupIds = [];\n\n foreach ($teamUuids as $uuid) {\n $group = $this->groupRepository->findByUuid($uuid);\n\n if ($group === null || $group->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Group %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $groupIds[] = $group->getId();\n\n }\n\n return $groupIds;\n }\n\n private function validateAndGetDealStageIds(Team $team, array $stageUuids, string $propertyLabel): array\n {\n $stageIds = [];\n\n foreach ($stageUuids as $uuid) {\n $stage = $this->stageRepository->findByUuid($uuid);\n\n if ($stage === null || $stage->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Stage %s not found for team %s for %s', $uuid, $team->getUuid(), $propertyLabel)\n );\n }\n\n $stageIds[] = $stage->getId();\n }\n\n return $stageIds;\n }\n\n private function validateAndGetUserIds(array $userUuids, callable $teamCheck): array\n {\n if (empty($userUuids)) {\n return [];\n }\n\n $userIds = [];\n\n foreach ($userUuids as $uuid) {\n $user = $this->userRepository->findByUuid($uuid);\n\n if (! $user || ! $user->isStatusActive()) {\n throw new InvalidArgumentException(\n sprintf('User %s not found or is not active', $uuid)\n );\n }\n\n if (! $teamCheck($user)) {\n throw new InvalidArgumentException(\n sprintf('User %s does not belong to the allowed team(s)', $uuid)\n );\n }\n\n $userIds[] = $user->getId();\n }\n\n return $userIds;\n }\n\n private function validateAndGetUserIdsByTeam(Team $team, array $userUuids): array\n {\n return $this->validateAndGetUserIds($userUuids, fn ($user) => $user->getTeamId() === $team->getId());\n }\n\n private function validateAndGetJiminnyUserIds(array $userUuids): array\n {\n $allowedTeamIds = config('kiosk.teamIds', []);\n\n return $this->validateAndGetUserIds($userUuids, fn ($user) => in_array($user->getTeamId(), $allowedTeamIds, true));\n }\n\n private function parseDate(string $dateString): string\n {\n return date('Y-m-d H:i:s', strtotime($dateString));\n }\n\n private function generateReportResultViewUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.view', ['uuid' => $result->getUuid()]);\n }\n\n private function generateReportResultDownloadUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.download', ['uuid' => $result->getUuid()]);\n }\n\n private function getReportMediaRouteResource(AutomatedReportResult $result): string\n {\n if ($result->getMediaType() === self::MEDIA_TYPE_PDF) {\n return self::PDF_KEY;\n } elseif ($result->getMediaType() === self::MEDIA_TYPE_PODCAST) {\n return self::AUDIO_KEY;\n }\n\n throw new \\InvalidArgumentException('Unknown media type.');\n }\n\n public function getMediaPath(AutomatedReportResult $result): ?string\n {\n $url = match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => $result->getPdfUrl(),\n self::MEDIA_TYPE_PODCAST => $result->getPodcastAudioUrl(),\n default => null,\n };\n\n if ($url === null) {\n return null;\n }\n\n $path = parse_url(trim($url, '\"\\''), PHP_URL_PATH);\n\n return $path ?: null;\n }\n\n public function getFilenameSuffix(AutomatedReportResult $result): ?string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => 'Podcast',\n default => null,\n };\n }\n\n public function getMailSubjectSuffix(AutomatedReportResult $result): string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => 'report',\n self::MEDIA_TYPE_PODCAST => 'podcast',\n default => '',\n };\n }\n\n public function getMediaTypeMetadata(AutomatedReportResult $result): array\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => ['extension' => 'mp3', 'mime' => 'audio/mpeg'],\n self::MEDIA_TYPE_PDF => ['extension' => 'pdf', 'mime' => 'application/pdf'],\n default => ['extension' => null, 'mime' => null],\n };\n }\n\n public function deleteS3Files(AutomatedReportResult $result): void\n {\n $teamUuid = $result->getReport()->getTeam()->getUuid();\n $reportUuid = $result->getUuid();\n\n // delete all files for a report uuid no mather of pdf, podcast, or both\n // in case of both - the podcast files are linked to the pdf (parent) uuid\n // pdf and podcast date times should be close\n $path = sprintf('%s/%s/%s', $teamUuid, self::S3_DIR, $reportUuid);\n\n foreach (self::FILE_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted S3 file', [\n 'path' => $file,\n ]);\n }\n }\n\n foreach (self::FILE_PODCAST_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '_podcast.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted Podcast S3 file', [\n 'path' => $file,\n ]);\n }\n }\n }\n\n /**\n *\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): Collection\n {\n return $this->automatedReportsRepository->getTeamIdsWithReportsResults($teamId);\n }\n\n /**\n * Core delete logic for report results using a query\n *\n * @param Builder $query\n * @param array $logContext\n *\n * @return int\n */\n private function deleteReportResultsByQuery(Builder $query, array $logContext = []): int\n {\n $deletedCount = 0;\n\n if ($query->exists()) {\n Log::info(\n 'Run delete report results',\n array_merge(\n $logContext,\n [\n 'service' => 'AutomatedReportsService',\n ]\n )\n );\n\n $query->chunkById(50, function ($results) use (&$deletedCount, $logContext) {\n foreach ($results as $result) {\n $this->deleteReportResult($result);\n $deletedCount++;\n\n Log::info(\n 'Deleted a report result',\n array_merge(\n $logContext,\n [\n 'result_id' => $result->getId(),\n 'report_id' => $result->getReportId(),\n ]\n )\n );\n }\n });\n }\n\n return $deletedCount;\n }\n\n /**\n * Delete report results for a team by retention period\n *\n * @param Team $team\n * @param CarbonImmutable $retentionDate\n *\n * @return int Number of deleted report results\n */\n public function deleteReportsResultsInRetentionPeriod(Team $team, CarbonImmutable $retentionDate): int\n {\n $reportIds = $this->automatedReportsRepository->getReportIdsByTeam($team);\n\n if ($reportIds->isEmpty()) {\n return 0;\n }\n\n $query = $this->automatedReportsRepository\n ->getReportResultsQueryForRetention($team, $retentionDate);\n\n return $this->deleteReportResultsByQuery($query, [\n 'team_id' => $team->getId(),\n 'retention_date' => $retentionDate->toDateTimeString(),\n ]);\n }\n\n /**\n * Delete ALL report results for a specific automated report\n *\n * @param string $uuid\n *\n * @return int\n */\n public function deleteReportResults(string $uuid): int\n {\n $report = $this->getReport($uuid);\n\n $query = $this->automatedReportsRepository->getResultsByReportQuery($report);\n\n return $this->deleteReportResultsByQuery($query, [\n 'report_uuid' => $uuid,\n 'report_id' => $report->getId(),\n ]);\n }\n\n public function deleteReportResult(AutomatedReportResult $result): void\n {\n $this->deleteS3Files($result);\n\n $result->delete();\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getTeamReports(Team $team): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getReportsByTeam($team);\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getReportResults(AutomatedReport $report): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getResultsByReport($report);\n }\n\n public function deleteAllReportResults(AutomatedReport $report): void\n {\n $results = $this->getReportResults($report);\n\n /** @var AutomatedReportResult $result */\n foreach ($results as $result) {\n Log::info('Deleting result', [\n 'report' => $report->getId(),\n 'result' => $result->getId(),\n ]);\n\n $this->deleteReportResult($result);\n }\n }\n\n public function deleteAllData(Team $team): void\n {\n Log::info('Deleting automated report and results for team', [\n 'team' => $team->getId(),\n ]);\n\n $reports = $this->getTeamReports($team);\n\n /** @var AutomatedReport $report */\n foreach ($reports as $report) {\n Log::info('Deleting report', [\n 'team' => $team->getId(),\n 'report' => $report->getId(),\n ]);\n\n $this->deleteAllReportResults($report);\n\n $report->delete();\n }\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"bounds":{"left":0.50166225,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"bounds":{"left":0.5103058,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"bounds":{"left":0.5212766,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"bounds":{"left":0.5299202,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"bounds":{"left":0.53856385,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"bounds":{"left":0.54953456,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"bounds":{"left":0.56050533,"top":0.14844373,"width":0.024268618,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"bounds":{"left":0.58710104,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"bounds":{"left":0.5980718,"top":0.14844373,"width":0.029587766,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"bounds":{"left":0.6599069,"top":0.14844373,"width":0.02825798,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"18","depth":4,"bounds":{"left":0.63231385,"top":0.17318435,"width":0.009640957,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"14","depth":4,"bounds":{"left":0.64394945,"top":0.17318435,"width":0.009640957,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"2","depth":4,"bounds":{"left":0.6555851,"top":0.17318435,"width":0.007978723,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"4","depth":4,"bounds":{"left":0.6655585,"top":0.17318435,"width":0.007978723,"height":0.015163607},"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.67519945,"top":0.17158818,"width":0.00731383,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.6825133,"top":0.17158818,"width":0.006981383,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o\nJOIN activities a ON o.id = a.opportunity_id\nWHERE a.crm_configuration_id = 39\nAND a.actual_start_time > '2025-10-13'\nAND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM activities\nWHERE crm_configuration_id = 39 and user_id = 143\nand actual_start_time >= '2025-10-13'\nAND type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM opportunities WHERE account_id IN (178);\nselect * from activities where id IN (620137, 620187, 620188, 620189, 620230);\n\n# HS\nSELECT * FROM opportunities WHERE id IN (238);\nselect * from activities where id IN (477,2076);\n\nselect * from users;\n\nSELECT COUNT(*) FROM users;\nSELECT COUNT(*) FROM activities;\nSELECT COUNT(*) FROM opportunities;\n\nUPDATE activities\nSET\n actual_start_time = '2025-12-19 09:00:00',\n actual_end_time = '2025-12-19 10:30:00',\n scheduled_start_time = '2025-12-19 09:00:00',\n scheduled_end_time = '2025-12-19 10:30:00'\nWHERE id IN (407509,407375);\n\nselect * from partners;\n\nSELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id\nFROM activities\nWHERE user_id = 143\nAND actual_start_time >= '2025-10-13 00:00:00'\nAND actual_start_time <= '2026-01-13 23:59:59'\nORDER BY actual_start_time DESC;\n\nSELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;\nSELECT * FROM crm_layouts where crm_configuration_id = 39;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;\n# lead_id\n# account_id 177\n# contact_id 3969\n# opportunity_id\n# stage_id 203\n\nSELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;\n\nSELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'\nAND user_id = 143 and actual_start_time >= '2025-10-13';\n\nSELECT * FROM activities a\n# JOIN opportunities o ON a.opportunity_id = o.id\nWHERE a.crm_configuration_id = 39 AND a.type = 'conference'\nand status = 'completed' and recording_state = 'recorded'\nand a.actual_start_time >= '2025-10-13'\nAND a.user_id = 143\n;\n\nselect * from leads\nwhere crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707\n\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310);\nSELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198\nSELECT * FROM activities WHERE id IN (356001, 356008); # contacts:\n\nSELECT * FROM opportunities WHERE id IN (1707);\nSELECT * FROM stages where id IN (204, 198);\nSELECT * FROM opportunities WHERE account_id IN (178);\nSELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';\nSELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal\n\nSELECT * FROM activities where crm_configuration_id = 39\nAND opportunity_id IS NULL\nAND is_internal = false\nand status = 'completed' and recording_state = 'recorded'\nAND actual_start_time >= '2025-10-13'\nAND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)\n# AND lead_id IN (112, 109)\n;\n\nSELECT * FROM crm_profiles WHERE user_id = 143;\n\nselect * from inboxes; # 212\nselect * from users where id = 143; # 143\nselect * from inbox_email_batches where inbox_id = 212\nand updated_at >= '2026-01-28 00:00:00' order by id desc;\nselect * from inbox_emails where inbox_id = 212\nand batch_id = 95885 order by id desc;\nselect * from email_messages where origin_user_id = 143;\nselect * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';\nselect * from participants where activity_id = 620247;\n\nselect * from crm_profiles where user_id = 143;\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001\nselect * from transcription where activity_id = 356001; # 6943\nselect * from ai_prompts where transcription_id = 6943;\nSELECT * FROM activity_summary_logs where activity_id = 356001;\n\nSELECT * FROM social_accounts WHERE sociable_id = 143;\n\n# ************************************************************************************\nSELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;\n# 422515 softphone tr. 8100\n\nSELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;\n# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS\n\nselect * from ai_prompts where transcription_id IN (8100, 7670);\nselect * from activity_summary_logs where activity_id = 407509;\n\nselect * from sidekick_settings;\nselect * from default_activity_types;\n\nSELECT * FROM contacts WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\nSELECT * FROM leads WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\n\nSELECT * FROM activity_searches where user_id = 143;\nSELECT * FROM groups where team_id = 1;\n\nselect * from teams where id = 1;\nselect * from groups where team_id = 1; # 1150 - 7e75f8025c22\nselect id, name, group_id, status, deleted_at, email\nfrom users where team_id = 1 order by group_id desc ;\n\nselect * from activity_searches where id in (1977, 1978, 1979);\nselect * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);\nselect * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277\nselect * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879\n\nINSERT INTO `activity_search_filters`\n(`activity_search_id`, `filter`, `value`) VALUES\n(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')\n;\n\nselect * from crm_configurations where id = 39;\n\n\nselect sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id\nwhere u.team_id = 1;\nSELECT * FROM social_accounts WHERE sociable_id = 1635;\nSELECT * FROM users WHERE id = 1635;\n\nselect * from teams where id = 1;\nselect * from users where team_id = 1;\nselect * from team_features where team_id = 1;\nselect * from features;\n\nSELECT * FROM activity_searches where id = 1982; # 1981\nSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;\n\nSELECT * FROM automated_reports where id = 68;\nUPDATE automated_reports set playbook_categories = NULL where id = 68;\nSELECT * FROM automated_report_results where id = 275;\n\nSELECT * FROM automated_reports order by id desc;\nSELECT * FROM automated_report_results order by id desc;\nselect * from activity_searches where user_id = 143;\nselect * from ask_anything_prompts;\n\nSELECT * FROM groups WHERE id = 1439;\nSELECT * FROM users WHERE group_id = 1439;\n\nselect * from permissions; # 158\nselect * from roles;\nselect * from permission_role\n\nselect * from teams where id = 1;\nselect * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;\nselect * from groups where id = 28;\nselect * from playbooks where team_id = 1;\nselect * from playbooks where id = 179;\nselect * from playbook_categories where id = 1391;\nselect * from users where id = 143;\nselect * from crm_profiles where user_id = 143;\nselect * from activities where crm_configuration_id = 39 and type = 'conference'\nand crm_provider_id IS NOT NULL ORDER by id desc;\nselect * from activities where id = 422003; # 00UO400000pB6fpMAC\n\nSELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type\nFROM automated_report_results ar\nJOIN automated_reports a ON a.id = ar.report_id\nWHERE a.type = 'ask_jiminny'\nLIMIT 10;\n\nSELECT `automated_report_results`.* FROM `automated_report_results`\nINNER JOIN `automated_reports`\n ON `automated_report_results`.`report_id` = `automated_reports`.`id`\nWHERE `automated_report_results`.`generated_at` IS NOT NULL\n AND `automated_reports`.`team_id` = 1\n AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$.\"users\"')\n;\n\n\nselect * from teams where id = 3143;\nselect * from crm_configurations where id = 500;\nselect * from users where name = 'Integration Account'; # 1695\nSELECT * FROM social_accounts WHERE sociable_id = 1695;\n\nselect * from activities where crm_configuration_id = 39\nand recording_state = 'recorded' and duration > 60\nand status = 'completed' and actual_start_time >= '2025-12-01';\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;\n\nselect * from leads;","depth":4,"value":"SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o\nJOIN activities a ON o.id = a.opportunity_id\nWHERE a.crm_configuration_id = 39\nAND a.actual_start_time > '2025-10-13'\nAND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM activities\nWHERE crm_configuration_id = 39 and user_id = 143\nand actual_start_time >= '2025-10-13'\nAND type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM opportunities WHERE account_id IN (178);\nselect * from activities where id IN (620137, 620187, 620188, 620189, 620230);\n\n# HS\nSELECT * FROM opportunities WHERE id IN (238);\nselect * from activities where id IN (477,2076);\n\nselect * from users;\n\nSELECT COUNT(*) FROM users;\nSELECT COUNT(*) FROM activities;\nSELECT COUNT(*) FROM opportunities;\n\nUPDATE activities\nSET\n actual_start_time = '2025-12-19 09:00:00',\n actual_end_time = '2025-12-19 10:30:00',\n scheduled_start_time = '2025-12-19 09:00:00',\n scheduled_end_time = '2025-12-19 10:30:00'\nWHERE id IN (407509,407375);\n\nselect * from partners;\n\nSELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id\nFROM activities\nWHERE user_id = 143\nAND actual_start_time >= '2025-10-13 00:00:00'\nAND actual_start_time <= '2026-01-13 23:59:59'\nORDER BY actual_start_time DESC;\n\nSELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;\nSELECT * FROM crm_layouts where crm_configuration_id = 39;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;\n# lead_id\n# account_id 177\n# contact_id 3969\n# opportunity_id\n# stage_id 203\n\nSELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;\n\nSELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'\nAND user_id = 143 and actual_start_time >= '2025-10-13';\n\nSELECT * FROM activities a\n# JOIN opportunities o ON a.opportunity_id = o.id\nWHERE a.crm_configuration_id = 39 AND a.type = 'conference'\nand status = 'completed' and recording_state = 'recorded'\nand a.actual_start_time >= '2025-10-13'\nAND a.user_id = 143\n;\n\nselect * from leads\nwhere crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707\n\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310);\nSELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198\nSELECT * FROM activities WHERE id IN (356001, 356008); # contacts:\n\nSELECT * FROM opportunities WHERE id IN (1707);\nSELECT * FROM stages where id IN (204, 198);\nSELECT * FROM opportunities WHERE account_id IN (178);\nSELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';\nSELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal\n\nSELECT * FROM activities where crm_configuration_id = 39\nAND opportunity_id IS NULL\nAND is_internal = false\nand status = 'completed' and recording_state = 'recorded'\nAND actual_start_time >= '2025-10-13'\nAND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)\n# AND lead_id IN (112, 109)\n;\n\nSELECT * FROM crm_profiles WHERE user_id = 143;\n\nselect * from inboxes; # 212\nselect * from users where id = 143; # 143\nselect * from inbox_email_batches where inbox_id = 212\nand updated_at >= '2026-01-28 00:00:00' order by id desc;\nselect * from inbox_emails where inbox_id = 212\nand batch_id = 95885 order by id desc;\nselect * from email_messages where origin_user_id = 143;\nselect * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';\nselect * from participants where activity_id = 620247;\n\nselect * from crm_profiles where user_id = 143;\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001\nselect * from transcription where activity_id = 356001; # 6943\nselect * from ai_prompts where transcription_id = 6943;\nSELECT * FROM activity_summary_logs where activity_id = 356001;\n\nSELECT * FROM social_accounts WHERE sociable_id = 143;\n\n# ************************************************************************************\nSELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;\n# 422515 softphone tr. 8100\n\nSELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;\n# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS\n\nselect * from ai_prompts where transcription_id IN (8100, 7670);\nselect * from activity_summary_logs where activity_id = 407509;\n\nselect * from sidekick_settings;\nselect * from default_activity_types;\n\nSELECT * FROM contacts WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\nSELECT * FROM leads WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\n\nSELECT * FROM activity_searches where user_id = 143;\nSELECT * FROM groups where team_id = 1;\n\nselect * from teams where id = 1;\nselect * from groups where team_id = 1; # 1150 - 7e75f8025c22\nselect id, name, group_id, status, deleted_at, email\nfrom users where team_id = 1 order by group_id desc ;\n\nselect * from activity_searches where id in (1977, 1978, 1979);\nselect * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);\nselect * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277\nselect * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879\n\nINSERT INTO `activity_search_filters`\n(`activity_search_id`, `filter`, `value`) VALUES\n(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')\n;\n\nselect * from crm_configurations where id = 39;\n\n\nselect sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id\nwhere u.team_id = 1;\nSELECT * FROM social_accounts WHERE sociable_id = 1635;\nSELECT * FROM users WHERE id = 1635;\n\nselect * from teams where id = 1;\nselect * from users where team_id = 1;\nselect * from team_features where team_id = 1;\nselect * from features;\n\nSELECT * FROM activity_searches where id = 1982; # 1981\nSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;\n\nSELECT * FROM automated_reports where id = 68;\nUPDATE automated_reports set playbook_categories = NULL where id = 68;\nSELECT * FROM automated_report_results where id = 275;\n\nSELECT * FROM automated_reports order by id desc;\nSELECT * FROM automated_report_results order by id desc;\nselect * from activity_searches where user_id = 143;\nselect * from ask_anything_prompts;\n\nSELECT * FROM groups WHERE id = 1439;\nSELECT * FROM users WHERE group_id = 1439;\n\nselect * from permissions; # 158\nselect * from roles;\nselect * from permission_role\n\nselect * from teams where id = 1;\nselect * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;\nselect * from groups where id = 28;\nselect * from playbooks where team_id = 1;\nselect * from playbooks where id = 179;\nselect * from playbook_categories where id = 1391;\nselect * from users where id = 143;\nselect * from crm_profiles where user_id = 143;\nselect * from activities where crm_configuration_id = 39 and type = 'conference'\nand crm_provider_id IS NOT NULL ORDER by id desc;\nselect * from activities where id = 422003; # 00UO400000pB6fpMAC\n\nSELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type\nFROM automated_report_results ar\nJOIN automated_reports a ON a.id = ar.report_id\nWHERE a.type = 'ask_jiminny'\nLIMIT 10;\n\nSELECT `automated_report_results`.* FROM `automated_report_results`\nINNER JOIN `automated_reports`\n ON `automated_report_results`.`report_id` = `automated_reports`.`id`\nWHERE `automated_report_results`.`generated_at` IS NOT NULL\n AND `automated_reports`.`team_id` = 1\n AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$.\"users\"')\n;\n\n\nselect * from teams where id = 3143;\nselect * from crm_configurations where id = 500;\nselect * from users where name = 'Integration Account'; # 1695\nSELECT * FROM social_accounts WHERE sociable_id = 1695;\n\nselect * from activities where crm_configuration_id = 39\nand recording_state = 'recorded' and duration > 60\nand status = 'completed' and actual_start_time >= '2025-12-01';\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;\n\nselect * from leads;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"bounds":{"left":0.011968086,"top":0.047885075,"width":0.024268618,"height":0.024740623},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-5439226101732026402
|
1126710648141684156
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsServiceTest
Run 'AutomatedReportsServiceTest'
Debug 'AutomatedReportsServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
102
3
34
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Kiosk\AutomatedReports;
use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Carbon\Exceptions\InvalidFormatException;
use DateTime;
use DateTimeInterface;
use DateTimeZone;
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcher;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Jiminny\Component\ActivitySearch\FilterDefinition\InputTypeEnum;
use Jiminny\Component\AskAnything\AskAnythingPromptService;
use Jiminny\Component\AskAnything\Dtos\AskAnythingPromptDto;
use Jiminny\Component\UrlGenerator\Webhook;
use Jiminny\Contracts\Repositories\PlaybookCategoryRepository;
use Jiminny\Contracts\Repositories\TeamRepository;
use Jiminny\Contracts\Repositories\UserRepository;
use Jiminny\Exceptions\ApplicationException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Exceptions\ModelNotFoundException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateReportJob;
use Jiminny\Models\Activity\Search;
use Jiminny\Models\AskAnything\AskAnythingPrompt;
use Jiminny\Models\AskAnything\AskAnythingPromptTarget;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Contracts\UserContract;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AskAnythingRepository;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Repositories\GroupRepository;
use Jiminny\Repositories\SearchRepository;
use Jiminny\Repositories\StageRepository;
use Throwable;
class AutomatedReportsService
{
public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';
public const string TYPE_ASK_JIMINNY = 'ask_jiminny';
/**
* Standard report types (used by kiosk for existing automated reports).
*/
// @TODO this will add filter, however if we need to control feature by FF we need conditional logic
public const array TYPES = [
['id' => 'exec_summary', 'name' => 'Exec Summary'],
['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],
['id' => 'product_feedback', 'name' => 'Product Feedback'],
['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],
// ['id' => 'questions', 'name' => 'Questions'],
// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],
];
public const array ALL_TYPES = [
...self::TYPES,
['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],
];
public const string FREQUENCY_DAILY = 'daily';
public const string FREQUENCY_WEEKLY = 'weekly';
public const string FREQUENCY_MONTHLY = 'monthly';
public const string FREQUENCY_QUARTERLY = 'quarterly';
public const string FREQUENCY_ONE_OFF = 'one_off';
/**
* Frequencies for standard (non-Ask Jiminny) reports.
*/
public const array FREQUENCIES = [
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
/**
* Frequencies for Ask Jiminny reports.
*/
public const array ASK_JIMINNY_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
];
public const string MEDIA_TYPE_PDF = 'pdf';
public const string MEDIA_TYPE_PODCAST = 'podcast';
public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];
public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];
public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];
public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];
public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];
public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];
public const int SENT_REPORT_AT_HOURS = 5;
public const string PDF_KEY = 'pdf';
public const string AUDIO_KEY = 'audio';
private const array ALL_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
private const string S3_DIR = 'reports';
private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];
private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];
public function __construct(
private readonly TeamRepository $teamRepository,
private readonly GroupRepository $groupRepository,
private readonly UserRepository $userRepository,
private readonly StageRepository $stageRepository,
private readonly DealStagesService $dealStagesService,
private readonly RecipientsService $recipientsService,
private readonly AutomatedReportsRepository $automatedReportsRepository,
private readonly Webhook $webhookService,
private readonly BusDispatcher $dispatcher,
private readonly ActivityTypeService $activityTypeService,
private readonly PlaybookCategoryRepository $playbookCategoryRepository,
private readonly AskAnythingPromptService $askAnythingPromptService,
private readonly SearchRepository $activitySearchRepository,
private readonly AskAnythingRepository $askAnythingRepository,
) {
}
public static function getTypes(): array
{
$types = self::TYPES;
return array_map(static function ($type) {
return $type['id'];
}, $types);
}
public static function getCallTypes(): array
{
return array_map(static function ($callType) {
return $callType['id'];
}, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);
}
public static function getFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::FREQUENCIES);
}
// front-facing structure
public function getReportEnabledFieldData(bool $value = false): array
{
return [
'id' => 'report_enabled',
'label' => '',
'inputType' => InputTypeEnum::TOGGLE,
'value' => $value,
];
}
// Organizations = Teams
public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array
{
$options = $this->getTeams();
if ($shortVersion) {
return [
'id' => 'organization',
'label' => 'Organization',
'options' => $options,
];
}
return [
'id' => 'organization',
'label' => 'Organization',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $options,
'value' => $value,
'dependencies' => [
'teams',
'deal_stage_at_call',
'current_deal_stage',
'recipients',
ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,
],
'dependsOn' => [],
];
}
// Teams = Groups
public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array
{
if ($shortVersion) {
return [
'id' => 'teams',
'label' => 'Team',
'options' => $options,
];
}
return [
'id' => 'teams',
'label' => 'Team',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => false,
'placeholder' => 'Select',
'options' => $options,
'value' => $value, // value should be an array of objects {id, name}
'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],
'dependsOn' => [],
];
}
public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array
{
$types = [];
if ($team instanceof Team) {
if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
$types = self::TYPES;
}
if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {
$types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];
}
} else {
$types = self::TYPES;
}
if ($shortVersion) {
return [
'id' => 'report_type',
'label' => 'Report Type',
'options' => $types,
];
}
return [
'id' => 'report_type',
'label' => 'Report Type',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $types,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getFrequencyFieldData(?string $value = null): array
{
return [
'id' => 'frequency',
'label' => 'Frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => self::FREQUENCIES,
'value' => $value,
'dependencies' => ['period'],
'dependsOn' => [],
];
}
public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array
{
return [
'id' => 'period',
'label' => 'Select one-off period',
'inputType' => InputTypeEnum::DATE_RANGE,
'required' => true,
'placeholder' => 'Select',
'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],
'queryParams' => [
'startDate' => 'start_date_period',
'endDate' => 'end_date_period',
],
'dependencies' => [],
'dependsOn' => ['frequency'],
];
}
public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array
{
return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);
}
public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);
}
public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);
}
public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'deal_value',
'label' => 'Deal Value',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_deal_value',
'max' => 'max_deal_value',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array
{
$value = [];
$conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;
$dialerOn && $value[] = self::CALL_TYPE_DIALER;
return [
'id' => 'call_type',
'label' => 'Call Type',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => [
self::CALL_TYPE_CONFERENCE,
self::CALL_TYPE_DIALER,
],
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getMediaTypeFieldData(?AutomatedReport $report = null): array
{
$value = [];
if ($report) {
$value = $this->transformMediaTypes($report);
}
return [
'id' => 'media_types',
'label' => 'Export as',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => self::MEDIA_TYPE_OBJECTS,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'call_duration',
'label' => 'Call Duration',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_call_duration',
'max' => 'max_call_duration',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getRecipientsFieldData(?Team $team = null, array $value = []): array
{
return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);
}
public function getJiminnyRecipientsFieldData(array $value = []): array
{
return $this->recipientsService->getJiminnyRecipientsFieldData($value);
}
public function getAdditionalPromptInputFieldData(?string $value = null): array
{
return [
'id' => 'additional_prompt_input',
'label' => 'Special requirements',
'inputType' => InputTypeEnum::TEXTAREA,
'required' => false,
'placeholder' => 'What should be the focus of the report?',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCustomReportNameFieldData(?string $value = null): array
{
return [
'id' => 'custom_name',
'label' => 'Custom report name',
'inputType' => InputTypeEnum::TEXT,
'required' => false,
'placeholder' => 'Enter custom name',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
// data providers
public function getTeams(): array
{
$teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);
$teamData = [];
foreach ($teams as $team) {
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
continue;
}
$teamData[] = $this->transformTeam($team);
}
return $teamData;
}
public function getTeamGroups(string $teamUuid): array
{
$data = [];
$team = $this->getTeam($teamUuid);
if ($team !== null) {
$groups = $team->groups()->get();
foreach ($groups as $group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
];
}
}
return $data;
}
public function getTeamsGroupsOptions(array $filterTeamUuids = []): array
{
$data = [];
$teams = $this->getTeams();
foreach ($teams as $team) {
if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {
continue;
}
$data[] = [
'label' => $team['name'],
'groups' => $this->getTeamGroups($team['id']),
];
}
return $data;
}
public function getTeam(string $teamUuid): ?Team
{
return $this->teamRepository->idOrUuid($teamUuid);
}
public function getTeamById(int $teamId): ?Team
{
return $this->teamRepository->find($teamId);
}
public function getGroupsUuids(AutomatedReport $report): array
{
$uuids = [];
$reportGroups = $report->getGroups();
foreach ($reportGroups as $groupId) {
if ($group = $this->groupRepository->find($groupId)) {
$uuids[] = $group->getUuid();
}
}
return $uuids;
}
public function getPlaybookCategoriesUuids(AutomatedReport $report): array
{
$uuids = [];
$playbookCategories = $report->getPlaybookCategories();
foreach ($playbookCategories as $id) {
if ($category = $this->playbookCategoryRepository->find($id)) {
$uuids[] = $category->getUuid();
}
}
return $uuids;
}
public function getDealAtCallStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getDealAtCallStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getCurrentDealStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getCurrentDealStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getRecipients());
}
public function getJiminnyUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function extractUserUuids(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => $user->getUuid())
->values()
->all();
}
// get mail data
public function getRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getRecipients());
}
/**
* @return array<UserContract>
*/
public function getRecipientUserObjects(AutomatedReport $report): array
{
$userIds = $report->getRecipients()['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->values()
->all();
}
private function getJiminnyRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function buildRecipientUsers(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => [
'email' => $user->getEmailAddress(),
'name' => $user->getName(),
'timezone' => $user->getTimezone()->getName(),
])
->values()
->all();
}
public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array
{
if ($report->isAskJiminnyReport()) {
$recipients = $this->resolveAskJiminnyRecipients($report);
} else {
$recipients = $this->getRecipientUsers($report);
if ($includeJiminny) {
$recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));
}
}
$emails = [];
return array_values(array_filter(
$recipients,
static function ($recipient) use (&$emails) {
if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {
return false;
}
$emails[] = $recipient['email'];
return true;
}
));
}
private function resolveAskJiminnyRecipients(AutomatedReport $report): array
{
$recipients = [];
$creator = $report->getCreator();
if ($creator !== null) {
$recipients[] = [
'email' => $creator->getEmailAddress(),
'name' => $creator->getName(),
'timezone' => $creator->getTimezone()->getName(),
];
}
return array_merge(
$recipients,
$this->buildRecipientUsers($report->getRecipients()),
$this->getGroupRecipientUsers($report),
);
}
private function getGroupRecipientUsers(AutomatedReport $report): array
{
$users = [];
foreach ($report->getGroups() as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group === null) {
continue;
}
foreach ($group->getMembers() as $member) {
$users[] = [
'email' => $member->getEmailAddress(),
'name' => $member->getName(),
'timezone' => $member->getTimezone()->getName(),
];
}
}
return $users;
}
public function getReportTypeName(AutomatedReportResult $report): string
{
$type = $report->getReport()->getType();
$getType = $this->transformReportType($type);
return $getType['name'];
}
public function getReportPeriodName(AutomatedReportResult $report): string
{
$from = $report->getFromDate();
$to = $report->getToDate();
$frequency = $report->getReport()->getFrequency();
if ($from === null || $to === null) {
if (! $report->getReport()->isAskJiminnyReport()) {
$invalidPeriod = $from === null ? 'from' : 'to';
throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);
}
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
}
return $this->formatReportPeriodName($frequency, $from, $to);
}
private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string
{
$fromYear = $from->format('Y');
$toYear = $to->format('Y');
$differentYears = $fromYear !== $toYear;
switch ($frequency) {
case self::FREQUENCY_DAILY:
return $from->format('j M Y');
case self::FREQUENCY_QUARTERLY:
// 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ
$startMonth = $from->format('M');
$endMonth = $to->copy()->subMonth();
$endMonthName = $endMonth->format('M');
$endMonthYear = $endMonth->format('Y');
if ($differentYears) {
return "{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}";
}
return "{$startMonth} - {$endMonthName} {$toYear}";
case self::FREQUENCY_MONTHLY:
// 'May 2025' - monthly reports are always within the same year
return $from->format('M Y');
case self::FREQUENCY_WEEKLY:
// '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ
$startDay = $from->format('j');
$endDay = $to->format('j');
$startMonth = $from->format('M');
$endMonth = $to->format('M');
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
if ($startMonth !== $endMonth) {
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
}
return "{$startDay} - {$endDay} {$endMonth} {$toYear}";
case self::FREQUENCY_ONE_OFF:
// '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ
$startDay = $from->format('j');
$startMonth = $from->format('M');
$endDay = $to->format('j');
$endMonth = $to->format('M');
// If same month and year, use a format like '2-31 May 2025'
if ($startMonth === $endMonth && ! $differentYears) {
return "{$startDay} - {$endDay} {$startMonth} {$toYear}";
}
// If different years, include both years
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
// Same year but different months
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
default:
// Default format for unknown frequencies
return $from->format('j M Y') . ' - ' . $to->format('j M Y');
}
}
public function getReportTeamsName(AutomatedReportResult $report): string
{
$groups = $report->getGroups();
if (empty($groups)) {
return 'All';
}
// Get group names from repository
$groupNames = [];
foreach ($groups as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group) {
$groupNames[] = $group->getName();
}
}
if (count($groupNames) === 1) {
// Single team format
$teamsName = $groupNames[0];
} else {
// Multiple teams format
$teamsName = implode(', ', $groupNames);
}
return $teamsName;
}
public function getReportFileName(AutomatedReportResult $report): string
{
$customName = $report->getReport()->getCustomName();
$periodName = $this->getReportPeriodName($report);
$filenameSuffix = $this->getFilenameSuffix($report);
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$customName} - {$periodName}");
}
$baseName = $this->getReportTypeName($report);
if ($filenameSuffix) {
$baseName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}");
}
public function getReportFileNameWithExtension(AutomatedReportResult $result): string
{
$extension = $this->getMediaTypeMetadata($result)['extension'];
return $this->getReportFileName($result) . '.' . $extension;
}
public function sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool
{
$recipients = array_map('intval', $report->getRecipients()['users'] ?? []);
return in_array($user->getId(), $recipients);
}
public function transformReportResults(Collection $automatedReportResults): array
{
$data = [];
foreach ($automatedReportResults as $automatedReportResult) {
/** @var AutomatedReportResult $automatedReportResult */
$report = $automatedReportResult->getReport();
$createdBy = $report->getCreator();
$creator = [
'id' => $createdBy?->getUuid(),
'name' => $createdBy?->getName(),
'email' => $createdBy?->getEmailAddress(),
'photoUrl' => $createdBy?->getPhotoUrl(),
];
$data[] = [
'id' => $automatedReportResult->getUuid(),
'name' => $automatedReportResult->getName(),
'frequency' => $this->transformFrequency($report->getFrequency()),
'recipients' => $this->buildRecipients($report),
'report_type' => $this->transformReportType($report->getType()),
'media_type' => $automatedReportResult->getMediaType(),
'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),
'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),
'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),
'creator' => $creator,
];
}
return $data;
}
private function buildRecipients(AutomatedReport $report): array
{
$creatorUuid = $report->getCreator()?->getUuid();
$recipients = array_values(array_filter(
$this->transformRecipients($report->getRecipients()),
static fn (array $recipient): bool => $recipient['id'] !== $creatorUuid,
));
if (! $report->isAskJiminnyReport()) {
return $recipients;
}
return [
...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),
...$recipients,
];
}
public function hasCallTypeConference(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);
}
public function hasCallTypeDialer(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);
}
// transformers
private function transformTeam(Team $team): array
{
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
return [];
}
return [
'id' => $team->getUuid(),
'name' => $team->getName(),
];
}
private function transformReportFullView(AutomatedReport $report): array
{
$base = $this->transformReportBase($report);
return $report->getType() === self::TYPE_ASK_JIMINNY
? $base + $this->transformAskJiminnyFields($report)
: $base + $this->transformStandardReportFields($report);
}
private function transformReportBase(AutomatedReport $report): array
{
return [
'id' => $report->getUuid(),
'organization' => $this->transformOrganization(team: $report->getTeam()),
'report_type' => $this->transformReportType($report->getType()),
'frequency' => $this->transformFrequency($report->getFrequency()),
];
}
private function transformStandardReportFields(AutomatedReport $report): array
{
$team = $report->getTeam();
return [
'report_enabled' => $report->getStatus(),
'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),
'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),
'deal_value_min' => $report->getDealValueMin(),
'deal_value_max' => $report->getDealValueMax(),
'call_types' => $this->transformCallType($report->getCallTypes()),
'media_types' => $this->transformMediaTypes($report),
'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),
'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),
'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),
'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),
'recipients' => $this->transformRecipients($report->getRecipients()),
'created_by' => $this->transformCreator($report->getCreator()),
'additional_prompt_input' => $report->getAdditionalPromptInput(),
'custom_name' => $report->getCustomName(),
'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),
'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),
'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),
];
}
private function transformAskJiminnyFields(AutomatedReport $report): array
{
$team = $report->getTeam();
$creatorId = $report->getAttribute('created_by');
$explicitUserIds = array_values(array_filter(
$report->getRecipients()['users'] ?? [],
static fn ($id) => $id !== $creatorId
));
return [
'report_name' => $report->getCustomName(),
'enabled' => $report->getStatus(),
'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),
'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),
'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),
'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),
];
}
private function transformOrganization(?Team $team): array
{
return [
'id' => $team?->getUuid(),
'name' => $team?->getName(),
];
}
private function transformReportType(string $type): array
{
foreach (self::ALL_TYPES as $typeItem) {
if ($typeItem['id'] === $type) {
return $typeItem;
}
}
return [];
}
private function transformCallType(array $types): array
{
$result = [];
$callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];
foreach ($types as $type) {
foreach ($callTypes as $callTypeItem) {
if ($callTypeItem['id'] === $type) {
$result[] = $callTypeItem;
break;
}
}
}
return $result;
}
private function transformMediaTypes(AutomatedReport $report): array
{
$values = [];
foreach ($report->getMediaTypes() as $mediaType) {
if (! in_array($mediaType, self::MEDIA_TYPES, true)) {
continue;
}
$values[] = match ($mediaType) {
self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,
self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,
};
}
return $values;
}
private function transformFrequency(string $frequency): array
{
foreach (self::ALL_FREQUENCIES as $frequencyItem) {
if ($frequencyItem['id'] === $frequency) {
return $frequencyItem;
}
}
return [];
}
public function transformDurationToMinutes(?int $duration): ?int
{
if (! $duration) {
return null;
}
return (int) ($duration / 60);
}
private function transformGroups(?Team $team, array $groupsIds): array
{
if (empty($groupsIds) || ! $team) {
return [];
}
$data = [];
foreach ($groupsIds as $groupId) {
$group = $team->groups()->where('id', $groupId)->first();
if ($group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
'photoUrl' => $group->getPhotoUrl(),
];
}
}
return $data;
}
private function transformStages(?Team $team, array $stagesIds): array
{
if (empty($stagesIds) || ! $team) {
return [];
}
$data = [];
foreach ($stagesIds as $stageId) {
$stage = $team->stages()->where('id', $stageId)->first();
if ($stage) {
$data[] = [
'id' => $stage->getUuid(),
'name' => $stage->getName(),
];
}
}
return $data;
}
private function transformRecipients(array $recipients): array
{
$users = [];
foreach ($recipients['users'] ?? [] as $userId) {
$users[] = $this->transformUser($userId);
}
return $users;
}
private function transformCreator(?User $user): ?array
{
if ($user === null) {
return null;
}
return $this->transformUser($user->getId());
}
private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array
{
if ($prompt === null) {
return null;
}
return [
'id' => $prompt->getUuid(),
'name' => $prompt->getTitle(),
];
}
private function transformSafeSearch(?Search $search): ?array
{
if ($search === null) {
return null;
}
return [
'id' => $search->getUuid(),
'name' => $search->getName(),
];
}
private function transformUser(int $userId): array
{
/* @var ?User $user */
$user = $this->userRepository->find($userId);
return [
'id' => $user?->getUuid(),
'name' => $user?->getName(),
'email' => $user?->getEmailAddress(),
'photoUrl' => $user?->getPhotoUrl(),
];
}
public function create(array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$validatedData['created_by'] = auth()->id();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
public function update(string $uuid, array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$report = $this->automatedReportsRepository->findByUuid($uuid);
if (! $report) {
throw new InvalidArgumentException('Report not found');
}
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
/**
* Create an Ask Jiminny report.
*/
public function createAskJiminnyReport(array $data, User $creator): array
{
$validatedData = $this->validateAskJiminnyReportData($data, $creator);
$validatedData['created_by'] = $creator->getId();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
return $this->transformReportFullView($automatedReport);
}
/**
* Update an Ask Jiminny report.
*/
public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array
{
if (! $report->isAskJiminnyReport()) {
throw new InvalidArgumentException('Report is not an Ask Jiminny report');
}
$validatedData = $this->validateAskJiminnyReportData($data, $user);
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
return $this->transformReportFullView($automatedReport);
}
public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array
{
$this->automatedReportsRepository->update($report, ['status' => $status]);
return $this->transformReportFullView($report->fresh());
}
/**
* Validate and transform data for Ask Jiminny reports.
*/
private function validateAskJiminnyReportData(array $data, User $user): array
{
// Validate name
$name = trim($data['report_name'] ?? '');
if (empty($name)) {
throw new InvalidArgumentException('Report name is required');
}
if (mb_strlen($name) > 50) {
throw new InvalidArgumentException('Report name must be 50 characters or less');
}
// Validate frequency (only daily, weekly, monthly for Ask Jiminny)
$frequency = $data['frequency'] ?? null;
$askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];
if (! in_array($frequency, $askJiminnyFrequencies, true)) {
throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');
}
// Validate expiration date
$expiresAt = $data['expires_on'] ?? null;
if (empty($expiresAt)) {
throw new InvalidArgumentException('Expiration date is required');
}
try {
$expiresAtDate = Carbon::parse($expiresAt);
} catch (InvalidFormatException $e) {
throw new InvalidArgumentException('Expiration date format is invalid');
}
$maxExpiration = Carbon::now()->addYear()->endOfDay();
if ($expiresAtDate->gt($maxExpiration)) {
throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');
}
if ($expiresAtDate->isPast()) {
throw new InvalidArgumentException('Expiration date cannot be in the past');
}
// Validate saved search
$activitySearchId = $data['saved_search'] ?? null;
if (empty($activitySearchId)) {
throw new InvalidArgumentException('Saved search is required');
}
$savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);
if (! $savedSearch) {
throw new InvalidArgumentException('Saved search not found or does not belong to you');
}
// Validate saved prompt
$askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;
if (empty($askAnythingPromptId)) {
throw new InvalidArgumentException('Ask Jiminny prompt is required');
}
$prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);
if (! $prompt) {
throw new InvalidArgumentException('Ask Jiminny prompt not found');
}
// Validate status
$status = $data['enabled'] ?? false;
$recipientUserIds = [$user->getId()];
if (! empty($data['share_users'])) {
$sharedUserIds = $this->validateAndGetUserIdsByTeam(
$user->team,
(array) $data['share_users']
);
$recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);
}
$sharedGroupIds = [];
if (! empty($data['share_teams'])) {
$sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);
}
$recipientUserIds = array_values(array_unique($recipientUserIds));
return [
'team_id' => $user->getTeamId(),
'type' => self::TYPE_ASK_JIMINNY,
'status' => (bool) $status,
'frequency' => $frequency,
'custom_name' => $name,
'activity_search_id' => $savedSearch->getId(),
'ask_anything_prompt_id' => $prompt->getId(),
'expires_at' => $expiresAtDate->toDateString(),
'media_types' => [self::MEDIA_TYPE_PDF],
'call_types' => [],
'recipients' => ['users' => $recipientUserIds],
'groups' => $sharedGroupIds,
];
}
public static function getAskJiminnyFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::ASK_JIMINNY_FREQUENCIES);
}
public function getAskJiminnyReportFilters(User $user): array
{
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
return [
[
'id' => 'prompt',
'label' => 'Prompt',
'options' => $prompts,
],
[
'id' => 'saved_search',
'label' => 'Saved Search',
'options' => $savedSearches,
],
];
}
public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array
{
$team = $user->getTeam();
$userTimezone = $user->getTimezone();
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
$teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [
'id' => $group->getUuid(),
'name' => $group->getName(),
])->values()->all();
$shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];
$sharedTeamsValue = [];
$sharedUsersValue = [];
if ($report) {
$sharedTeamsValue = $this->transformGroups($team, $report->getGroups());
$recipientUserIds = $report->getRecipients()['users'] ?? [];
$creatorId = $report->getAttribute('created_by');
$sharedUserIds = array_values(array_filter(
$recipientUserIds,
static fn ($id) => $id !== $creatorId
));
$sharedUsersValue = collect($sharedUserIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (User $u) => [
'id' => $u->getUuid(),
'name' => $u->getName(),
])
->values()
->all();
}
return [
'fields' => [
[
'id' => 'enabled',
'inputType' => InputTypeEnum::TOGGLE,
'label' => '',
'value' => $report?->getStatus() ?? false,
],
[
'id' => 'report_name',
'inputType' => InputTypeEnum::TEXT,
'label' => 'Name',
'placeholder' => 'Enter name',
'required' => true,
'validation' => ['maxLength' => 50],
'value' => $report?->getCustomName() ?? '',
],
[
'id' => 'frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'label' => 'Frequency',
'required' => true,
'placeholder' => 'Select',
'options' => self::ASK_JIMINNY_FREQUENCIES,
'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,
],
[
'id' => 'expires_on',
'inputType' => InputTypeEnum::DATE,
'label' => 'Expires on',
'required' => true,
'placeholder' => 'Select',
'validation' => [
'minDate' => now($userTimezone)->toDateString(),
'maxDate' => now($userT...
|
NULL
|
|
66970
|
1509
|
0
|
2026-04-21T15:20:18.998546+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776784818998_m1.jpg...
|
PhpStorm
|
faVsco.js – AutomatedReportsService.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsServiceTest
Run 'AutomatedReportsServiceTest'
Debug 'AutomatedReportsServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
102
3
34
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Kiosk\AutomatedReports;
use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Carbon\Exceptions\InvalidFormatException;
use DateTime;
use DateTimeInterface;
use DateTimeZone;
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcher;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Jiminny\Component\ActivitySearch\FilterDefinition\InputTypeEnum;
use Jiminny\Component\AskAnything\AskAnythingPromptService;
use Jiminny\Component\AskAnything\Dtos\AskAnythingPromptDto;
use Jiminny\Component\UrlGenerator\Webhook;
use Jiminny\Contracts\Repositories\PlaybookCategoryRepository;
use Jiminny\Contracts\Repositories\TeamRepository;
use Jiminny\Contracts\Repositories\UserRepository;
use Jiminny\Exceptions\ApplicationException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Exceptions\ModelNotFoundException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateReportJob;
use Jiminny\Models\Activity\Search;
use Jiminny\Models\AskAnything\AskAnythingPrompt;
use Jiminny\Models\AskAnything\AskAnythingPromptTarget;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Contracts\UserContract;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AskAnythingRepository;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Repositories\GroupRepository;
use Jiminny\Repositories\SearchRepository;
use Jiminny\Repositories\StageRepository;
use Throwable;
class AutomatedReportsService
{
public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';
public const string TYPE_ASK_JIMINNY = 'ask_jiminny';
/**
* Standard report types (used by kiosk for existing automated reports).
*/
// @TODO this will add filter, however if we need to control feature by FF we need conditional logic
public const array TYPES = [
['id' => 'exec_summary', 'name' => 'Exec Summary'],
['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],
['id' => 'product_feedback', 'name' => 'Product Feedback'],
['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],
// ['id' => 'questions', 'name' => 'Questions'],
// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],
];
public const array ALL_TYPES = [
...self::TYPES,
['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],
];
public const string FREQUENCY_DAILY = 'daily';
public const string FREQUENCY_WEEKLY = 'weekly';
public const string FREQUENCY_MONTHLY = 'monthly';
public const string FREQUENCY_QUARTERLY = 'quarterly';
public const string FREQUENCY_ONE_OFF = 'one_off';
/**
* Frequencies for standard (non-Ask Jiminny) reports.
*/
public const array FREQUENCIES = [
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
/**
* Frequencies for Ask Jiminny reports.
*/
public const array ASK_JIMINNY_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
];
public const string MEDIA_TYPE_PDF = 'pdf';
public const string MEDIA_TYPE_PODCAST = 'podcast';
public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];
public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];
public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];
public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];
public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];
public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];
public const int SENT_REPORT_AT_HOURS = 5;
public const string PDF_KEY = 'pdf';
public const string AUDIO_KEY = 'audio';
private const array ALL_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
private const string S3_DIR = 'reports';
private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];
private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];
public function __construct(
private readonly TeamRepository $teamRepository,
private readonly GroupRepository $groupRepository,
private readonly UserRepository $userRepository,
private readonly StageRepository $stageRepository,
private readonly DealStagesService $dealStagesService,
private readonly RecipientsService $recipientsService,
private readonly AutomatedReportsRepository $automatedReportsRepository,
private readonly Webhook $webhookService,
private readonly BusDispatcher $dispatcher,
private readonly ActivityTypeService $activityTypeService,
private readonly PlaybookCategoryRepository $playbookCategoryRepository,
private readonly AskAnythingPromptService $askAnythingPromptService,
private readonly SearchRepository $activitySearchRepository,
private readonly AskAnythingRepository $askAnythingRepository,
) {
}
public static function getTypes(): array
{
$types = self::TYPES;
return array_map(static function ($type) {
return $type['id'];
}, $types);
}
public static function getCallTypes(): array
{
return array_map(static function ($callType) {
return $callType['id'];
}, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);
}
public static function getFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::FREQUENCIES);
}
// front-facing structure
public function getReportEnabledFieldData(bool $value = false): array
{
return [
'id' => 'report_enabled',
'label' => '',
'inputType' => InputTypeEnum::TOGGLE,
'value' => $value,
];
}
// Organizations = Teams
public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array
{
$options = $this->getTeams();
if ($shortVersion) {
return [
'id' => 'organization',
'label' => 'Organization',
'options' => $options,
];
}
return [
'id' => 'organization',
'label' => 'Organization',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $options,
'value' => $value,
'dependencies' => [
'teams',
'deal_stage_at_call',
'current_deal_stage',
'recipients',
ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,
],
'dependsOn' => [],
];
}
// Teams = Groups
public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array
{
if ($shortVersion) {
return [
'id' => 'teams',
'label' => 'Team',
'options' => $options,
];
}
return [
'id' => 'teams',
'label' => 'Team',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => false,
'placeholder' => 'Select',
'options' => $options,
'value' => $value, // value should be an array of objects {id, name}
'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],
'dependsOn' => [],
];
}
public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array
{
$types = [];
if ($team instanceof Team) {
if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
$types = self::TYPES;
}
if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {
$types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];
}
} else {
$types = self::TYPES;
}
if ($shortVersion) {
return [
'id' => 'report_type',
'label' => 'Report Type',
'options' => $types,
];
}
return [
'id' => 'report_type',
'label' => 'Report Type',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $types,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getFrequencyFieldData(?string $value = null): array
{
return [
'id' => 'frequency',
'label' => 'Frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => self::FREQUENCIES,
'value' => $value,
'dependencies' => ['period'],
'dependsOn' => [],
];
}
public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array
{
return [
'id' => 'period',
'label' => 'Select one-off period',
'inputType' => InputTypeEnum::DATE_RANGE,
'required' => true,
'placeholder' => 'Select',
'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],
'queryParams' => [
'startDate' => 'start_date_period',
'endDate' => 'end_date_period',
],
'dependencies' => [],
'dependsOn' => ['frequency'],
];
}
public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array
{
return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);
}
public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);
}
public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);
}
public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'deal_value',
'label' => 'Deal Value',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_deal_value',
'max' => 'max_deal_value',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array
{
$value = [];
$conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;
$dialerOn && $value[] = self::CALL_TYPE_DIALER;
return [
'id' => 'call_type',
'label' => 'Call Type',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => [
self::CALL_TYPE_CONFERENCE,
self::CALL_TYPE_DIALER,
],
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getMediaTypeFieldData(?AutomatedReport $report = null): array
{
$value = [];
if ($report) {
$value = $this->transformMediaTypes($report);
}
return [
'id' => 'media_types',
'label' => 'Export as',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => self::MEDIA_TYPE_OBJECTS,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'call_duration',
'label' => 'Call Duration',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_call_duration',
'max' => 'max_call_duration',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getRecipientsFieldData(?Team $team = null, array $value = []): array
{
return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);
}
public function getJiminnyRecipientsFieldData(array $value = []): array
{
return $this->recipientsService->getJiminnyRecipientsFieldData($value);
}
public function getAdditionalPromptInputFieldData(?string $value = null): array
{
return [
'id' => 'additional_prompt_input',
'label' => 'Special requirements',
'inputType' => InputTypeEnum::TEXTAREA,
'required' => false,
'placeholder' => 'What should be the focus of the report?',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCustomReportNameFieldData(?string $value = null): array
{
return [
'id' => 'custom_name',
'label' => 'Custom report name',
'inputType' => InputTypeEnum::TEXT,
'required' => false,
'placeholder' => 'Enter custom name',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
// data providers
public function getTeams(): array
{
$teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);
$teamData = [];
foreach ($teams as $team) {
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
continue;
}
$teamData[] = $this->transformTeam($team);
}
return $teamData;
}
public function getTeamGroups(string $teamUuid): array
{
$data = [];
$team = $this->getTeam($teamUuid);
if ($team !== null) {
$groups = $team->groups()->get();
foreach ($groups as $group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
];
}
}
return $data;
}
public function getTeamsGroupsOptions(array $filterTeamUuids = []): array
{
$data = [];
$teams = $this->getTeams();
foreach ($teams as $team) {
if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {
continue;
}
$data[] = [
'label' => $team['name'],
'groups' => $this->getTeamGroups($team['id']),
];
}
return $data;
}
public function getTeam(string $teamUuid): ?Team
{
return $this->teamRepository->idOrUuid($teamUuid);
}
public function getTeamById(int $teamId): ?Team
{
return $this->teamRepository->find($teamId);
}
public function getGroupsUuids(AutomatedReport $report): array
{
$uuids = [];
$reportGroups = $report->getGroups();
foreach ($reportGroups as $groupId) {
if ($group = $this->groupRepository->find($groupId)) {
$uuids[] = $group->getUuid();
}
}
return $uuids;
}
public function getPlaybookCategoriesUuids(AutomatedReport $report): array
{
$uuids = [];
$playbookCategories = $report->getPlaybookCategories();
foreach ($playbookCategories as $id) {
if ($category = $this->playbookCategoryRepository->find($id)) {
$uuids[] = $category->getUuid();
}
}
return $uuids;
}
public function getDealAtCallStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getDealAtCallStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getCurrentDealStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getCurrentDealStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getRecipients());
}
public function getJiminnyUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function extractUserUuids(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => $user->getUuid())
->values()
->all();
}
// get mail data
public function getRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getRecipients());
}
/**
* @return array<UserContract>
*/
public function getRecipientUserObjects(AutomatedReport $report): array
{
$userIds = $report->getRecipients()['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->values()
->all();
}
private function getJiminnyRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function buildRecipientUsers(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => [
'email' => $user->getEmailAddress(),
'name' => $user->getName(),
'timezone' => $user->getTimezone()->getName(),
])
->values()
->all();
}
public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array
{
if ($report->isAskJiminnyReport()) {
$recipients = $this->resolveAskJiminnyRecipients($report);
} else {
$recipients = $this->getRecipientUsers($report);
if ($includeJiminny) {
$recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));
}
}
$emails = [];
return array_values(array_filter(
$recipients,
static function ($recipient) use (&$emails) {
if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {
return false;
}
$emails[] = $recipient['email'];
return true;
}
));
}
private function resolveAskJiminnyRecipients(AutomatedReport $report): array
{
$recipients = [];
$creator = $report->getCreator();
if ($creator !== null) {
$recipients[] = [
'email' => $creator->getEmailAddress(),
'name' => $creator->getName(),
'timezone' => $creator->getTimezone()->getName(),
];
}
return array_merge(
$recipients,
$this->buildRecipientUsers($report->getRecipients()),
$this->getGroupRecipientUsers($report),
);
}
private function getGroupRecipientUsers(AutomatedReport $report): array
{
$users = [];
foreach ($report->getGroups() as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group === null) {
continue;
}
foreach ($group->getMembers() as $member) {
$users[] = [
'email' => $member->getEmailAddress(),
'name' => $member->getName(),
'timezone' => $member->getTimezone()->getName(),
];
}
}
return $users;
}
public function getReportTypeName(AutomatedReportResult $report): string
{
$type = $report->getReport()->getType();
$getType = $this->transformReportType($type);
return $getType['name'];
}
public function getReportPeriodName(AutomatedReportResult $report): string
{
$from = $report->getFromDate();
$to = $report->getToDate();
$frequency = $report->getReport()->getFrequency();
if ($from === null || $to === null) {
if (! $report->getReport()->isAskJiminnyReport()) {
$invalidPeriod = $from === null ? 'from' : 'to';
throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);
}
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
}
return $this->formatReportPeriodName($frequency, $from, $to);
}
private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string
{
$fromYear = $from->format('Y');
$toYear = $to->format('Y');
$differentYears = $fromYear !== $toYear;
switch ($frequency) {
case self::FREQUENCY_DAILY:
return $from->format('j M Y');
case self::FREQUENCY_QUARTERLY:
// 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ
$startMonth = $from->format('M');
$endMonth = $to->copy()->subMonth();
$endMonthName = $endMonth->format('M');
$endMonthYear = $endMonth->format('Y');
if ($differentYears) {
return "{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}";
}
return "{$startMonth} - {$endMonthName} {$toYear}";
case self::FREQUENCY_MONTHLY:
// 'May 2025' - monthly reports are always within the same year
return $from->format('M Y');
case self::FREQUENCY_WEEKLY:
// '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ
$startDay = $from->format('j');
$endDay = $to->format('j');
$startMonth = $from->format('M');
$endMonth = $to->format('M');
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
if ($startMonth !== $endMonth) {
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
}
return "{$startDay} - {$endDay} {$endMonth} {$toYear}";
case self::FREQUENCY_ONE_OFF:
// '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ
$startDay = $from->format('j');
$startMonth = $from->format('M');
$endDay = $to->format('j');
$endMonth = $to->format('M');
// If same month and year, use a format like '2-31 May 2025'
if ($startMonth === $endMonth && ! $differentYears) {
return "{$startDay} - {$endDay} {$startMonth} {$toYear}";
}
// If different years, include both years
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
// Same year but different months
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
default:
// Default format for unknown frequencies
return $from->format('j M Y') . ' - ' . $to->format('j M Y');
}
}
public function getReportTeamsName(AutomatedReportResult $report): string
{
$groups = $report->getGroups();
if (empty($groups)) {
return 'All';
}
// Get group names from repository
$groupNames = [];
foreach ($groups as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group) {
$groupNames[] = $group->getName();
}
}
if (count($groupNames) === 1) {
// Single team format
$teamsName = $groupNames[0];
} else {
// Multiple teams format
$teamsName = implode(', ', $groupNames);
}
return $teamsName;
}
public function getReportFileName(AutomatedReportResult $report): string
{
$customName = $report->getReport()->getCustomName();
$periodName = $this->getReportPeriodName($report);
$filenameSuffix = $this->getFilenameSuffix($report);
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$customName} - {$periodName}");
}
$baseName = $this->getReportTypeName($report);
if ($filenameSuffix) {
$baseName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}");
}
public function getReportFileNameWithExtension(AutomatedReportResult $result): string
{
$extension = $this->getMediaTypeMetadata($result)['extension'];
return $this->getReportFileName($result) . '.' . $extension;
}
public function sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool
{
$recipients = array_map('intval', $report->getRecipients()['users'] ?? []);
return in_array($user->getId(), $recipients);
}
public function transformReportResults(Collection $automatedReportResults): array
{
$data = [];
foreach ($automatedReportResults as $automatedReportResult) {
/** @var AutomatedReportResult $automatedReportResult */
$report = $automatedReportResult->getReport();
$createdBy = $report->getCreator();
$creator = [
'id' => $createdBy?->getUuid(),
'name' => $createdBy?->getName(),
'email' => $createdBy?->getEmailAddress(),
'photoUrl' => $createdBy?->getPhotoUrl(),
];
$data[] = [
'id' => $automatedReportResult->getUuid(),
'name' => $automatedReportResult->getName(),
'frequency' => $this->transformFrequency($report->getFrequency()),
'recipients' => $this->buildRecipients($report),
'report_type' => $this->transformReportType($report->getType()),
'media_type' => $automatedReportResult->getMediaType(),
'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),
'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),
'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),
'creator' => $creator,
];
}
return $data;
}
private function buildRecipients(AutomatedReport $report): array
{
$creatorUuid = $report->getCreator()?->getUuid();
$recipients = array_values(array_filter(
$this->transformRecipients($report->getRecipients()),
static fn (array $recipient): bool => $recipient['id'] !== $creatorUuid,
));
if (! $report->isAskJiminnyReport()) {
return $recipients;
}
return [
...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),
...$recipients,
];
}
public function hasCallTypeConference(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);
}
public function hasCallTypeDialer(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);
}
// transformers
private function transformTeam(Team $team): array
{
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
return [];
}
return [
'id' => $team->getUuid(),
'name' => $team->getName(),
];
}
private function transformReportFullView(AutomatedReport $report): array
{
$base = $this->transformReportBase($report);
return $report->getType() === self::TYPE_ASK_JIMINNY
? $base + $this->transformAskJiminnyFields($report)
: $base + $this->transformStandardReportFields($report);
}
private function transformReportBase(AutomatedReport $report): array
{
return [
'id' => $report->getUuid(),
'organization' => $this->transformOrganization(team: $report->getTeam()),
'report_type' => $this->transformReportType($report->getType()),
'frequency' => $this->transformFrequency($report->getFrequency()),
];
}
private function transformStandardReportFields(AutomatedReport $report): array
{
$team = $report->getTeam();
return [
'report_enabled' => $report->getStatus(),
'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),
'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),
'deal_value_min' => $report->getDealValueMin(),
'deal_value_max' => $report->getDealValueMax(),
'call_types' => $this->transformCallType($report->getCallTypes()),
'media_types' => $this->transformMediaTypes($report),
'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),
'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),
'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),
'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),
'recipients' => $this->transformRecipients($report->getRecipients()),
'created_by' => $this->transformCreator($report->getCreator()),
'additional_prompt_input' => $report->getAdditionalPromptInput(),
'custom_name' => $report->getCustomName(),
'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),
'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),
'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),
];
}
private function transformAskJiminnyFields(AutomatedReport $report): array
{
$team = $report->getTeam();
$creatorId = $report->getAttribute('created_by');
$explicitUserIds = array_values(array_filter(
$report->getRecipients()['users'] ?? [],
static fn ($id) => $id !== $creatorId
));
return [
'report_name' => $report->getCustomName(),
'enabled' => $report->getStatus(),
'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),
'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),
'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),
'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),
];
}
private function transformOrganization(?Team $team): array
{
return [
'id' => $team?->getUuid(),
'name' => $team?->getName(),
];
}
private function transformReportType(string $type): array
{
foreach (self::ALL_TYPES as $typeItem) {
if ($typeItem['id'] === $type) {
return $typeItem;
}
}
return [];
}
private function transformCallType(array $types): array
{
$result = [];
$callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];
foreach ($types as $type) {
foreach ($callTypes as $callTypeItem) {
if ($callTypeItem['id'] === $type) {
$result[] = $callTypeItem;
break;
}
}
}
return $result;
}
private function transformMediaTypes(AutomatedReport $report): array
{
$values = [];
foreach ($report->getMediaTypes() as $mediaType) {
if (! in_array($mediaType, self::MEDIA_TYPES, true)) {
continue;
}
$values[] = match ($mediaType) {
self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,
self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,
};
}
return $values;
}
private function transformFrequency(string $frequency): array
{
foreach (self::ALL_FREQUENCIES as $frequencyItem) {
if ($frequencyItem['id'] === $frequency) {
return $frequencyItem;
}
}
return [];
}
public function transformDurationToMinutes(?int $duration): ?int
{
if (! $duration) {
return null;
}
return (int) ($duration / 60);
}
private function transformGroups(?Team $team, array $groupsIds): array
{
if (empty($groupsIds) || ! $team) {
return [];
}
$data = [];
foreach ($groupsIds as $groupId) {
$group = $team->groups()->where('id', $groupId)->first();
if ($group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
'photoUrl' => $group->getPhotoUrl(),
];
}
}
return $data;
}
private function transformStages(?Team $team, array $stagesIds): array
{
if (empty($stagesIds) || ! $team) {
return [];
}
$data = [];
foreach ($stagesIds as $stageId) {
$stage = $team->stages()->where('id', $stageId)->first();
if ($stage) {
$data[] = [
'id' => $stage->getUuid(),
'name' => $stage->getName(),
];
}
}
return $data;
}
private function transformRecipients(array $recipients): array
{
$users = [];
foreach ($recipients['users'] ?? [] as $userId) {
$users[] = $this->transformUser($userId);
}
return $users;
}
private function transformCreator(?User $user): ?array
{
if ($user === null) {
return null;
}
return $this->transformUser($user->getId());
}
private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array
{
if ($prompt === null) {
return null;
}
return [
'id' => $prompt->getUuid(),
'name' => $prompt->getTitle(),
];
}
private function transformSafeSearch(?Search $search): ?array
{
if ($search === null) {
return null;
}
return [
'id' => $search->getUuid(),
'name' => $search->getName(),
];
}
private function transformUser(int $userId): array
{
/* @var ?User $user */
$user = $this->userRepository->find($userId);
return [
'id' => $user?->getUuid(),
'name' => $user?->getName(),
'email' => $user?->getEmailAddress(),
'photoUrl' => $user?->getPhotoUrl(),
];
}
public function create(array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$validatedData['created_by'] = auth()->id();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
public function update(string $uuid, array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$report = $this->automatedReportsRepository->findByUuid($uuid);
if (! $report) {
throw new InvalidArgumentException('Report not found');
}
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
/**
* Create an Ask Jiminny report.
*/
public function createAskJiminnyReport(array $data, User $creator): array
{
$validatedData = $this->validateAskJiminnyReportData($data, $creator);
$validatedData['created_by'] = $creator->getId();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
return $this->transformReportFullView($automatedReport);
}
/**
* Update an Ask Jiminny report.
*/
public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array
{
if (! $report->isAskJiminnyReport()) {
throw new InvalidArgumentException('Report is not an Ask Jiminny report');
}
$validatedData = $this->validateAskJiminnyReportData($data, $user);
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
return $this->transformReportFullView($automatedReport);
}
public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array
{
$this->automatedReportsRepository->update($report, ['status' => $status]);
return $this->transformReportFullView($report->fresh());
}
/**
* Validate and transform data for Ask Jiminny reports.
*/
private function validateAskJiminnyReportData(array $data, User $user): array
{
// Validate name
$name = trim($data['report_name'] ?? '');
if (empty($name)) {
throw new InvalidArgumentException('Report name is required');
}
if (mb_strlen($name) > 50) {
throw new InvalidArgumentException('Report name must be 50 characters or less');
}
// Validate frequency (only daily, weekly, monthly for Ask Jiminny)
$frequency = $data['frequency'] ?? null;
$askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];
if (! in_array($frequency, $askJiminnyFrequencies, true)) {
throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');
}
// Validate expiration date
$expiresAt = $data['expires_on'] ?? null;
if (empty($expiresAt)) {
throw new InvalidArgumentException('Expiration date is required');
}
try {
$expiresAtDate = Carbon::parse($expiresAt);
} catch (InvalidFormatException $e) {
throw new InvalidArgumentException('Expiration date format is invalid');
}
$maxExpiration = Carbon::now()->addYear()->endOfDay();
if ($expiresAtDate->gt($maxExpiration)) {
throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');
}
if ($expiresAtDate->isPast()) {
throw new InvalidArgumentException('Expiration date cannot be in the past');
}
// Validate saved search
$activitySearchId = $data['saved_search'] ?? null;
if (empty($activitySearchId)) {
throw new InvalidArgumentException('Saved search is required');
}
$savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);
if (! $savedSearch) {
throw new InvalidArgumentException('Saved search not found or does not belong to you');
}
// Validate saved prompt
$askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;
if (empty($askAnythingPromptId)) {
throw new InvalidArgumentException('Ask Jiminny prompt is required');
}
$prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);
if (! $prompt) {
throw new InvalidArgumentException('Ask Jiminny prompt not found');
}
// Validate status
$status = $data['enabled'] ?? false;
$recipientUserIds = [$user->getId()];
if (! empty($data['share_users'])) {
$sharedUserIds = $this->validateAndGetUserIdsByTeam(
$user->team,
(array) $data['share_users']
);
$recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);
}
$sharedGroupIds = [];
if (! empty($data['share_teams'])) {
$sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);
}
$recipientUserIds = array_values(array_unique($recipientUserIds));
return [
'team_id' => $user->getTeamId(),
'type' => self::TYPE_ASK_JIMINNY,
'status' => (bool) $status,
'frequency' => $frequency,
'custom_name' => $name,
'activity_search_id' => $savedSearch->getId(),
'ask_anything_prompt_id' => $prompt->getId(),
'expires_at' => $expiresAtDate->toDateString(),
'media_types' => [self::MEDIA_TYPE_PDF],
'call_types' => [],
'recipients' => ['users' => $recipientUserIds],
'groups' => $sharedGroupIds,
];
}
public static function getAskJiminnyFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::ASK_JIMINNY_FREQUENCIES);
}
public function getAskJiminnyReportFilters(User $user): array
{
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
return [
[
'id' => 'prompt',
'label' => 'Prompt',
'options' => $prompts,
],
[
'id' => 'saved_search',
'label' => 'Saved Search',
'options' => $savedSearches,
],
];
}
public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array
{
$team = $user->getTeam();
$userTimezone = $user->getTimezone();
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
$teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [
'id' => $group->getUuid(),
'name' => $group->getName(),
])->values()->all();
$shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];
$sharedTeamsValue = [];
$sharedUsersValue = [];
if ($report) {
$sharedTeamsValue = $this->transformGroups($team, $report->getGroups());
$recipientUserIds = $report->getRecipients()['users'] ?? [];
$creatorId = $report->getAttribute('created_by');
$sharedUserIds = array_values(array_filter(
$recipientUserIds,
static fn ($id) => $id !== $creatorId
));
$sharedUsersValue = collect($sharedUserIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (User $u) => [
'id' => $u->getUuid(),
'name' => $u->getName(),
])
->values()
->all();
}
return [
'fields' => [
[
'id' => 'enabled',
'inputType' => InputTypeEnum::TOGGLE,
'label' => '',
'value' => $report?->getStatus() ?? false,
],
[
'id' => 'report_name',
'inputType' => InputTypeEnum::TEXT,
'label' => 'Name',
'placeholder' => 'Enter name',
'required' => true,
'validation' => ['maxLength' => 50],
'value' => $report?->getCustomName() ?? '',
],
[
'id' => 'frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'label' => 'Frequency',
'required' => true,
'placeholder' => 'Select',
'options' => self::ASK_JIMINNY_FREQUENCIES,
'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,
],
[
'id' => 'expires_on',
'inputType' => InputTypeEnum::DATE,
'label' => 'Expires on',
'required' => true,
'placeholder' => 'Select',
'validation' => [
'minDate' => now($userTimezone)->toDateString(),
'maxDate' => now($userT...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"#11894 on JY-18909-automated-reports-ask-jiminny, menu","depth":5,"help_text":"Pull request #11894 exists for current branch JY-18909-automated-reports-ask-jiminny","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AutomatedReportsServiceTest","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AutomatedReportsServiceTest'","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AutomatedReportsServiceTest'","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"102","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"3","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"34","depth":4,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Kiosk\\AutomatedReports;\n\nuse Carbon\\CarbonImmutable;\nuse Carbon\\CarbonInterface;\nuse Carbon\\Exceptions\\InvalidFormatException;\nuse DateTime;\nuse DateTimeInterface;\nuse DateTimeZone;\nuse Illuminate\\Contracts\\Bus\\Dispatcher as BusDispatcher;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Support\\Facades\\Log;\nuse Illuminate\\Support\\Facades\\Storage;\nuse Jiminny\\Component\\ActivitySearch\\FilterDefinition\\InputTypeEnum;\nuse Jiminny\\Component\\AskAnything\\AskAnythingPromptService;\nuse Jiminny\\Component\\AskAnything\\Dtos\\AskAnythingPromptDto;\nuse Jiminny\\Component\\UrlGenerator\\Webhook;\nuse Jiminny\\Contracts\\Repositories\\PlaybookCategoryRepository;\nuse Jiminny\\Contracts\\Repositories\\TeamRepository;\nuse Jiminny\\Contracts\\Repositories\\UserRepository;\nuse Jiminny\\Exceptions\\ApplicationException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Exceptions\\ModelNotFoundException;\nuse Jiminny\\Jobs\\AutomatedReports\\RequestGenerateReportJob;\nuse Jiminny\\Models\\Activity\\Search;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPrompt;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPromptTarget;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Contracts\\UserContract;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Repositories\\AskAnythingRepository;\nuse Jiminny\\Repositories\\AutomatedReportsRepository;\nuse Jiminny\\Repositories\\GroupRepository;\nuse Jiminny\\Repositories\\SearchRepository;\nuse Jiminny\\Repositories\\StageRepository;\nuse Throwable;\n\nclass AutomatedReportsService\n{\n public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';\n public const string TYPE_ASK_JIMINNY = 'ask_jiminny';\n\n /**\n * Standard report types (used by kiosk for existing automated reports).\n */\n // @TODO this will add filter, however if we need to control feature by FF we need conditional logic\n public const array TYPES = [\n ['id' => 'exec_summary', 'name' => 'Exec Summary'],\n ['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],\n ['id' => 'product_feedback', 'name' => 'Product Feedback'],\n ['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],\n// ['id' => 'questions', 'name' => 'Questions'],\n// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],\n ];\n\n public const array ALL_TYPES = [\n ...self::TYPES,\n ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],\n ];\n\n public const string FREQUENCY_DAILY = 'daily';\n public const string FREQUENCY_WEEKLY = 'weekly';\n public const string FREQUENCY_MONTHLY = 'monthly';\n public const string FREQUENCY_QUARTERLY = 'quarterly';\n public const string FREQUENCY_ONE_OFF = 'one_off';\n\n /**\n * Frequencies for standard (non-Ask Jiminny) reports.\n */\n public const array FREQUENCIES = [\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n\n /**\n * Frequencies for Ask Jiminny reports.\n */\n public const array ASK_JIMINNY_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ];\n\n public const string MEDIA_TYPE_PDF = 'pdf';\n public const string MEDIA_TYPE_PODCAST = 'podcast';\n public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];\n public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];\n public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];\n public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];\n\n public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];\n public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];\n public const int SENT_REPORT_AT_HOURS = 5;\n public const string PDF_KEY = 'pdf';\n public const string AUDIO_KEY = 'audio';\n\n private const array ALL_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n private const string S3_DIR = 'reports';\n private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];\n private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];\n\n public function __construct(\n private readonly TeamRepository $teamRepository,\n private readonly GroupRepository $groupRepository,\n private readonly UserRepository $userRepository,\n private readonly StageRepository $stageRepository,\n private readonly DealStagesService $dealStagesService,\n private readonly RecipientsService $recipientsService,\n private readonly AutomatedReportsRepository $automatedReportsRepository,\n private readonly Webhook $webhookService,\n private readonly BusDispatcher $dispatcher,\n private readonly ActivityTypeService $activityTypeService,\n private readonly PlaybookCategoryRepository $playbookCategoryRepository,\n private readonly AskAnythingPromptService $askAnythingPromptService,\n private readonly SearchRepository $activitySearchRepository,\n private readonly AskAnythingRepository $askAnythingRepository,\n ) {\n }\n\n public static function getTypes(): array\n {\n $types = self::TYPES;\n\n return array_map(static function ($type) {\n return $type['id'];\n }, $types);\n }\n\n public static function getCallTypes(): array\n {\n return array_map(static function ($callType) {\n return $callType['id'];\n }, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);\n }\n\n public static function getFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::FREQUENCIES);\n }\n\n // front-facing structure\n public function getReportEnabledFieldData(bool $value = false): array\n {\n return [\n 'id' => 'report_enabled',\n 'label' => '',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'value' => $value,\n ];\n }\n\n // Organizations = Teams\n public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array\n {\n $options = $this->getTeams();\n\n if ($shortVersion) {\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value,\n 'dependencies' => [\n 'teams',\n 'deal_stage_at_call',\n 'current_deal_stage',\n 'recipients',\n ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,\n ],\n 'dependsOn' => [],\n ];\n }\n\n // Teams = Groups\n public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array\n {\n if ($shortVersion) {\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value, // value should be an array of objects {id, name}\n 'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],\n 'dependsOn' => [],\n ];\n }\n\n public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array\n {\n $types = [];\n if ($team instanceof Team) {\n if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n $types = self::TYPES;\n }\n if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {\n $types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];\n }\n } else {\n $types = self::TYPES;\n }\n\n if ($shortVersion) {\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'options' => $types,\n ];\n }\n\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $types,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getFrequencyFieldData(?string $value = null): array\n {\n return [\n 'id' => 'frequency',\n 'label' => 'Frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::FREQUENCIES,\n 'value' => $value,\n 'dependencies' => ['period'],\n 'dependsOn' => [],\n ];\n }\n\n public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array\n {\n return [\n 'id' => 'period',\n 'label' => 'Select one-off period',\n 'inputType' => InputTypeEnum::DATE_RANGE,\n 'required' => true,\n 'placeholder' => 'Select',\n 'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],\n 'queryParams' => [\n 'startDate' => 'start_date_period',\n 'endDate' => 'end_date_period',\n ],\n 'dependencies' => [],\n 'dependsOn' => ['frequency'],\n ];\n }\n\n public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array\n {\n return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);\n }\n\n public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);\n }\n\n public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);\n }\n\n public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'deal_value',\n 'label' => 'Deal Value',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_deal_value',\n 'max' => 'max_deal_value',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array\n {\n $value = [];\n $conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;\n $dialerOn && $value[] = self::CALL_TYPE_DIALER;\n\n return [\n 'id' => 'call_type',\n 'label' => 'Call Type',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => [\n self::CALL_TYPE_CONFERENCE,\n self::CALL_TYPE_DIALER,\n ],\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getMediaTypeFieldData(?AutomatedReport $report = null): array\n {\n $value = [];\n\n if ($report) {\n $value = $this->transformMediaTypes($report);\n }\n\n return [\n 'id' => 'media_types',\n 'label' => 'Export as',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => self::MEDIA_TYPE_OBJECTS,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'call_duration',\n 'label' => 'Call Duration',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_call_duration',\n 'max' => 'max_call_duration',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getRecipientsFieldData(?Team $team = null, array $value = []): array\n {\n return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);\n }\n\n public function getJiminnyRecipientsFieldData(array $value = []): array\n {\n return $this->recipientsService->getJiminnyRecipientsFieldData($value);\n }\n\n public function getAdditionalPromptInputFieldData(?string $value = null): array\n {\n return [\n 'id' => 'additional_prompt_input',\n 'label' => 'Special requirements',\n 'inputType' => InputTypeEnum::TEXTAREA,\n 'required' => false,\n 'placeholder' => 'What should be the focus of the report?',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCustomReportNameFieldData(?string $value = null): array\n {\n return [\n 'id' => 'custom_name',\n 'label' => 'Custom report name',\n 'inputType' => InputTypeEnum::TEXT,\n 'required' => false,\n 'placeholder' => 'Enter custom name',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n // data providers\n public function getTeams(): array\n {\n $teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);\n\n $teamData = [];\n foreach ($teams as $team) {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n continue;\n }\n\n $teamData[] = $this->transformTeam($team);\n }\n\n return $teamData;\n }\n\n public function getTeamGroups(string $teamUuid): array\n {\n $data = [];\n $team = $this->getTeam($teamUuid);\n\n if ($team !== null) {\n $groups = $team->groups()->get();\n\n foreach ($groups as $group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n public function getTeamsGroupsOptions(array $filterTeamUuids = []): array\n {\n $data = [];\n $teams = $this->getTeams();\n\n foreach ($teams as $team) {\n if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {\n continue;\n }\n\n $data[] = [\n 'label' => $team['name'],\n 'groups' => $this->getTeamGroups($team['id']),\n ];\n }\n\n return $data;\n }\n\n public function getTeam(string $teamUuid): ?Team\n {\n return $this->teamRepository->idOrUuid($teamUuid);\n }\n\n public function getTeamById(int $teamId): ?Team\n {\n return $this->teamRepository->find($teamId);\n }\n\n public function getGroupsUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportGroups = $report->getGroups();\n foreach ($reportGroups as $groupId) {\n if ($group = $this->groupRepository->find($groupId)) {\n $uuids[] = $group->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getPlaybookCategoriesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $playbookCategories = $report->getPlaybookCategories();\n foreach ($playbookCategories as $id) {\n if ($category = $this->playbookCategoryRepository->find($id)) {\n $uuids[] = $category->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getDealAtCallStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getDealAtCallStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getCurrentDealStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getCurrentDealStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getRecipients());\n }\n\n public function getJiminnyUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function extractUserUuids(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => $user->getUuid())\n ->values()\n ->all();\n }\n\n // get mail data\n public function getRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getRecipients());\n }\n\n /**\n * @return array<UserContract>\n */\n public function getRecipientUserObjects(AutomatedReport $report): array\n {\n $userIds = $report->getRecipients()['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->values()\n ->all();\n }\n\n private function getJiminnyRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function buildRecipientUsers(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => [\n 'email' => $user->getEmailAddress(),\n 'name' => $user->getName(),\n 'timezone' => $user->getTimezone()->getName(),\n ])\n ->values()\n ->all();\n }\n\n public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array\n {\n if ($report->isAskJiminnyReport()) {\n $recipients = $this->resolveAskJiminnyRecipients($report);\n } else {\n $recipients = $this->getRecipientUsers($report);\n if ($includeJiminny) {\n $recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));\n }\n }\n\n $emails = [];\n\n return array_values(array_filter(\n $recipients,\n static function ($recipient) use (&$emails) {\n if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {\n return false;\n }\n $emails[] = $recipient['email'];\n\n return true;\n }\n ));\n }\n\n private function resolveAskJiminnyRecipients(AutomatedReport $report): array\n {\n $recipients = [];\n\n $creator = $report->getCreator();\n if ($creator !== null) {\n $recipients[] = [\n 'email' => $creator->getEmailAddress(),\n 'name' => $creator->getName(),\n 'timezone' => $creator->getTimezone()->getName(),\n ];\n }\n\n return array_merge(\n $recipients,\n $this->buildRecipientUsers($report->getRecipients()),\n $this->getGroupRecipientUsers($report),\n );\n }\n\n private function getGroupRecipientUsers(AutomatedReport $report): array\n {\n $users = [];\n foreach ($report->getGroups() as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group === null) {\n continue;\n }\n foreach ($group->getMembers() as $member) {\n $users[] = [\n 'email' => $member->getEmailAddress(),\n 'name' => $member->getName(),\n 'timezone' => $member->getTimezone()->getName(),\n ];\n }\n }\n\n return $users;\n }\n\n public function getReportTypeName(AutomatedReportResult $report): string\n {\n $type = $report->getReport()->getType();\n\n $getType = $this->transformReportType($type);\n\n return $getType['name'];\n }\n\n public function getReportPeriodName(AutomatedReportResult $report): string\n {\n $from = $report->getFromDate();\n $to = $report->getToDate();\n $frequency = $report->getReport()->getFrequency();\n\n if ($from === null || $to === null) {\n if (! $report->getReport()->isAskJiminnyReport()) {\n $invalidPeriod = $from === null ? 'from' : 'to';\n\n throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);\n }\n\n $period = $this->calculateFromAndToDatePeriod($frequency);\n $from = $period['fromDate'];\n $to = $period['toDate'];\n }\n\n return $this->formatReportPeriodName($frequency, $from, $to);\n }\n\n private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string\n {\n $fromYear = $from->format('Y');\n $toYear = $to->format('Y');\n $differentYears = $fromYear !== $toYear;\n\n switch ($frequency) {\n case self::FREQUENCY_DAILY:\n return $from->format('j M Y');\n\n case self::FREQUENCY_QUARTERLY:\n // 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ\n $startMonth = $from->format('M');\n $endMonth = $to->copy()->subMonth();\n $endMonthName = $endMonth->format('M');\n $endMonthYear = $endMonth->format('Y');\n\n if ($differentYears) {\n return \"{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}\";\n }\n\n return \"{$startMonth} - {$endMonthName} {$toYear}\";\n\n case self::FREQUENCY_MONTHLY:\n // 'May 2025' - monthly reports are always within the same year\n return $from->format('M Y');\n\n case self::FREQUENCY_WEEKLY:\n // '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ\n $startDay = $from->format('j');\n $endDay = $to->format('j');\n $startMonth = $from->format('M');\n $endMonth = $to->format('M');\n\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n if ($startMonth !== $endMonth) {\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n return \"{$startDay} - {$endDay} {$endMonth} {$toYear}\";\n\n case self::FREQUENCY_ONE_OFF:\n // '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ\n $startDay = $from->format('j');\n $startMonth = $from->format('M');\n $endDay = $to->format('j');\n $endMonth = $to->format('M');\n\n // If same month and year, use a format like '2-31 May 2025'\n if ($startMonth === $endMonth && ! $differentYears) {\n return \"{$startDay} - {$endDay} {$startMonth} {$toYear}\";\n }\n\n // If different years, include both years\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n // Same year but different months\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n\n default:\n // Default format for unknown frequencies\n return $from->format('j M Y') . ' - ' . $to->format('j M Y');\n }\n }\n\n public function getReportTeamsName(AutomatedReportResult $report): string\n {\n $groups = $report->getGroups();\n\n if (empty($groups)) {\n return 'All';\n }\n\n // Get group names from repository\n $groupNames = [];\n foreach ($groups as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group) {\n $groupNames[] = $group->getName();\n }\n }\n\n if (count($groupNames) === 1) {\n // Single team format\n $teamsName = $groupNames[0];\n } else {\n // Multiple teams format\n $teamsName = implode(', ', $groupNames);\n }\n\n return $teamsName;\n }\n\n public function getReportFileName(AutomatedReportResult $report): string\n {\n $customName = $report->getReport()->getCustomName();\n $periodName = $this->getReportPeriodName($report);\n $filenameSuffix = $this->getFilenameSuffix($report);\n\n if ($customName) {\n if ($filenameSuffix) {\n $customName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$customName} - {$periodName}\");\n }\n\n $baseName = $this->getReportTypeName($report);\n\n if ($filenameSuffix) {\n $baseName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}\");\n }\n\n public function getReportFileNameWithExtension(AutomatedReportResult $result): string\n {\n $extension = $this->getMediaTypeMetadata($result)['extension'];\n\n return $this->getReportFileName($result) . '.' . $extension;\n }\n\n public function sanitizeFileName(string $fileName): string\n {\n return str_replace(['/', '\\\\'], '-', $fileName);\n }\n\n public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool\n {\n $recipients = array_map('intval', $report->getRecipients()['users'] ?? []);\n\n return in_array($user->getId(), $recipients);\n }\n\n public function transformReportResults(Collection $automatedReportResults): array\n {\n $data = [];\n foreach ($automatedReportResults as $automatedReportResult) {\n /** @var AutomatedReportResult $automatedReportResult */\n\n $report = $automatedReportResult->getReport();\n\n $createdBy = $report->getCreator();\n $creator = [\n 'id' => $createdBy?->getUuid(),\n 'name' => $createdBy?->getName(),\n 'email' => $createdBy?->getEmailAddress(),\n 'photoUrl' => $createdBy?->getPhotoUrl(),\n ];\n\n $data[] = [\n 'id' => $automatedReportResult->getUuid(),\n 'name' => $automatedReportResult->getName(),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n 'recipients' => $this->buildRecipients($report),\n 'report_type' => $this->transformReportType($report->getType()),\n 'media_type' => $automatedReportResult->getMediaType(),\n 'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),\n 'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),\n 'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),\n 'creator' => $creator,\n ];\n }\n\n return $data;\n }\n\n private function buildRecipients(AutomatedReport $report): array\n {\n $creatorUuid = $report->getCreator()?->getUuid();\n\n $recipients = array_values(array_filter(\n $this->transformRecipients($report->getRecipients()),\n static fn (array $recipient): bool => $recipient['id'] !== $creatorUuid,\n ));\n\n if (! $report->isAskJiminnyReport()) {\n return $recipients;\n }\n\n return [\n ...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),\n ...$recipients,\n ];\n }\n\n public function hasCallTypeConference(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);\n }\n\n public function hasCallTypeDialer(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);\n }\n\n // transformers\n private function transformTeam(Team $team): array\n {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n return [];\n }\n\n return [\n 'id' => $team->getUuid(),\n 'name' => $team->getName(),\n ];\n }\n\n private function transformReportFullView(AutomatedReport $report): array\n {\n $base = $this->transformReportBase($report);\n\n return $report->getType() === self::TYPE_ASK_JIMINNY\n ? $base + $this->transformAskJiminnyFields($report)\n : $base + $this->transformStandardReportFields($report);\n }\n\n private function transformReportBase(AutomatedReport $report): array\n {\n return [\n 'id' => $report->getUuid(),\n 'organization' => $this->transformOrganization(team: $report->getTeam()),\n 'report_type' => $this->transformReportType($report->getType()),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n ];\n }\n\n private function transformStandardReportFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n\n return [\n 'report_enabled' => $report->getStatus(),\n 'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),\n 'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),\n 'deal_value_min' => $report->getDealValueMin(),\n 'deal_value_max' => $report->getDealValueMax(),\n 'call_types' => $this->transformCallType($report->getCallTypes()),\n 'media_types' => $this->transformMediaTypes($report),\n 'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),\n 'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),\n 'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),\n 'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),\n 'recipients' => $this->transformRecipients($report->getRecipients()),\n 'created_by' => $this->transformCreator($report->getCreator()),\n 'additional_prompt_input' => $report->getAdditionalPromptInput(),\n 'custom_name' => $report->getCustomName(),\n 'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),\n 'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),\n 'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),\n ];\n }\n\n private function transformAskJiminnyFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n $creatorId = $report->getAttribute('created_by');\n $explicitUserIds = array_values(array_filter(\n $report->getRecipients()['users'] ?? [],\n static fn ($id) => $id !== $creatorId\n ));\n\n return [\n 'report_name' => $report->getCustomName(),\n 'enabled' => $report->getStatus(),\n 'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),\n 'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),\n 'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),\n 'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),\n ];\n }\n\n private function transformOrganization(?Team $team): array\n {\n return [\n 'id' => $team?->getUuid(),\n 'name' => $team?->getName(),\n ];\n }\n\n private function transformReportType(string $type): array\n {\n foreach (self::ALL_TYPES as $typeItem) {\n if ($typeItem['id'] === $type) {\n return $typeItem;\n }\n }\n\n return [];\n }\n\n private function transformCallType(array $types): array\n {\n $result = [];\n $callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];\n\n foreach ($types as $type) {\n foreach ($callTypes as $callTypeItem) {\n if ($callTypeItem['id'] === $type) {\n $result[] = $callTypeItem;\n\n break;\n }\n }\n }\n\n return $result;\n }\n\n private function transformMediaTypes(AutomatedReport $report): array\n {\n $values = [];\n\n foreach ($report->getMediaTypes() as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n continue;\n }\n\n $values[] = match ($mediaType) {\n self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,\n self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,\n };\n }\n\n return $values;\n }\n\n private function transformFrequency(string $frequency): array\n {\n foreach (self::ALL_FREQUENCIES as $frequencyItem) {\n if ($frequencyItem['id'] === $frequency) {\n return $frequencyItem;\n }\n }\n\n return [];\n }\n\n public function transformDurationToMinutes(?int $duration): ?int\n {\n if (! $duration) {\n return null;\n }\n\n return (int) ($duration / 60);\n }\n\n private function transformGroups(?Team $team, array $groupsIds): array\n {\n if (empty($groupsIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($groupsIds as $groupId) {\n $group = $team->groups()->where('id', $groupId)->first();\n\n if ($group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n 'photoUrl' => $group->getPhotoUrl(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformStages(?Team $team, array $stagesIds): array\n {\n if (empty($stagesIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($stagesIds as $stageId) {\n $stage = $team->stages()->where('id', $stageId)->first();\n\n if ($stage) {\n $data[] = [\n 'id' => $stage->getUuid(),\n 'name' => $stage->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformRecipients(array $recipients): array\n {\n $users = [];\n foreach ($recipients['users'] ?? [] as $userId) {\n $users[] = $this->transformUser($userId);\n }\n\n return $users;\n }\n\n private function transformCreator(?User $user): ?array\n {\n if ($user === null) {\n return null;\n }\n\n return $this->transformUser($user->getId());\n }\n\n private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array\n {\n if ($prompt === null) {\n return null;\n }\n\n return [\n 'id' => $prompt->getUuid(),\n 'name' => $prompt->getTitle(),\n ];\n }\n\n private function transformSafeSearch(?Search $search): ?array\n {\n if ($search === null) {\n return null;\n }\n\n return [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ];\n }\n\n private function transformUser(int $userId): array\n {\n /* @var ?User $user */\n $user = $this->userRepository->find($userId);\n\n return [\n 'id' => $user?->getUuid(),\n 'name' => $user?->getName(),\n 'email' => $user?->getEmailAddress(),\n 'photoUrl' => $user?->getPhotoUrl(),\n ];\n }\n\n public function create(array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $validatedData['created_by'] = auth()->id();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function update(string $uuid, array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $report = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $report) {\n throw new InvalidArgumentException('Report not found');\n }\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Create an Ask Jiminny report.\n */\n public function createAskJiminnyReport(array $data, User $creator): array\n {\n $validatedData = $this->validateAskJiminnyReportData($data, $creator);\n $validatedData['created_by'] = $creator->getId();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Update an Ask Jiminny report.\n */\n public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array\n {\n if (! $report->isAskJiminnyReport()) {\n throw new InvalidArgumentException('Report is not an Ask Jiminny report');\n }\n\n $validatedData = $this->validateAskJiminnyReportData($data, $user);\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array\n {\n $this->automatedReportsRepository->update($report, ['status' => $status]);\n\n return $this->transformReportFullView($report->fresh());\n }\n\n /**\n * Validate and transform data for Ask Jiminny reports.\n */\n private function validateAskJiminnyReportData(array $data, User $user): array\n {\n // Validate name\n $name = trim($data['report_name'] ?? '');\n if (empty($name)) {\n throw new InvalidArgumentException('Report name is required');\n }\n if (mb_strlen($name) > 50) {\n throw new InvalidArgumentException('Report name must be 50 characters or less');\n }\n\n // Validate frequency (only daily, weekly, monthly for Ask Jiminny)\n $frequency = $data['frequency'] ?? null;\n $askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];\n if (! in_array($frequency, $askJiminnyFrequencies, true)) {\n throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');\n }\n\n // Validate expiration date\n $expiresAt = $data['expires_on'] ?? null;\n if (empty($expiresAt)) {\n throw new InvalidArgumentException('Expiration date is required');\n }\n\n try {\n $expiresAtDate = Carbon::parse($expiresAt);\n } catch (InvalidFormatException $e) {\n throw new InvalidArgumentException('Expiration date format is invalid');\n }\n $maxExpiration = Carbon::now()->addYear()->endOfDay();\n if ($expiresAtDate->gt($maxExpiration)) {\n throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');\n }\n if ($expiresAtDate->isPast()) {\n throw new InvalidArgumentException('Expiration date cannot be in the past');\n }\n\n // Validate saved search\n $activitySearchId = $data['saved_search'] ?? null;\n if (empty($activitySearchId)) {\n throw new InvalidArgumentException('Saved search is required');\n }\n $savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);\n if (! $savedSearch) {\n throw new InvalidArgumentException('Saved search not found or does not belong to you');\n }\n\n // Validate saved prompt\n $askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;\n if (empty($askAnythingPromptId)) {\n throw new InvalidArgumentException('Ask Jiminny prompt is required');\n }\n $prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);\n if (! $prompt) {\n throw new InvalidArgumentException('Ask Jiminny prompt not found');\n }\n\n // Validate status\n $status = $data['enabled'] ?? false;\n\n $recipientUserIds = [$user->getId()];\n\n if (! empty($data['share_users'])) {\n $sharedUserIds = $this->validateAndGetUserIdsByTeam(\n $user->team,\n (array) $data['share_users']\n );\n $recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);\n }\n\n $sharedGroupIds = [];\n if (! empty($data['share_teams'])) {\n $sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);\n }\n\n $recipientUserIds = array_values(array_unique($recipientUserIds));\n\n return [\n 'team_id' => $user->getTeamId(),\n 'type' => self::TYPE_ASK_JIMINNY,\n 'status' => (bool) $status,\n 'frequency' => $frequency,\n 'custom_name' => $name,\n 'activity_search_id' => $savedSearch->getId(),\n 'ask_anything_prompt_id' => $prompt->getId(),\n 'expires_at' => $expiresAtDate->toDateString(),\n 'media_types' => [self::MEDIA_TYPE_PDF],\n 'call_types' => [],\n 'recipients' => ['users' => $recipientUserIds],\n 'groups' => $sharedGroupIds,\n ];\n }\n\n public static function getAskJiminnyFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::ASK_JIMINNY_FREQUENCIES);\n }\n\n public function getAskJiminnyReportFilters(User $user): array\n {\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n return [\n [\n 'id' => 'prompt',\n 'label' => 'Prompt',\n 'options' => $prompts,\n ],\n [\n 'id' => 'saved_search',\n 'label' => 'Saved Search',\n 'options' => $savedSearches,\n ],\n ];\n }\n\n public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array\n {\n $team = $user->getTeam();\n $userTimezone = $user->getTimezone();\n\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n $teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ])->values()->all();\n\n $shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];\n\n $sharedTeamsValue = [];\n $sharedUsersValue = [];\n if ($report) {\n $sharedTeamsValue = $this->transformGroups($team, $report->getGroups());\n\n $recipientUserIds = $report->getRecipients()['users'] ?? [];\n $creatorId = $report->getAttribute('created_by');\n $sharedUserIds = array_values(array_filter(\n $recipientUserIds,\n static fn ($id) => $id !== $creatorId\n ));\n $sharedUsersValue = collect($sharedUserIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (User $u) => [\n 'id' => $u->getUuid(),\n 'name' => $u->getName(),\n ])\n ->values()\n ->all();\n }\n\n return [\n 'fields' => [\n [\n 'id' => 'enabled',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'label' => '',\n 'value' => $report?->getStatus() ?? false,\n ],\n [\n 'id' => 'report_name',\n 'inputType' => InputTypeEnum::TEXT,\n 'label' => 'Name',\n 'placeholder' => 'Enter name',\n 'required' => true,\n 'validation' => ['maxLength' => 50],\n 'value' => $report?->getCustomName() ?? '',\n ],\n [\n 'id' => 'frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Frequency',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::ASK_JIMINNY_FREQUENCIES,\n 'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,\n ],\n [\n 'id' => 'expires_on',\n 'inputType' => InputTypeEnum::DATE,\n 'label' => 'Expires on',\n 'required' => true,\n 'placeholder' => 'Select',\n 'validation' => [\n 'minDate' => now($userTimezone)->toDateString(),\n 'maxDate' => now($userTimezone)->addYear()->toDateString(),\n ],\n 'value' => $report?->getExpiresAt()?->toDateString(),\n ],\n [\n 'id' => 'share_teams',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team',\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $teamGroups,\n 'value' => $sharedTeamsValue,\n ],\n [\n 'id' => 'share_users',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team member',\n 'required' => false,\n 'placeholder' => 'Select',\n 'groupLabelKey' => 'label',\n 'groupValuesKey' => 'users',\n 'optionLabelKey' => 'name',\n 'optionValueKey' => 'id',\n 'options' => $shareUsers,\n 'value' => $sharedUsersValue,\n ],\n [\n 'id' => 'saved_search',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Saved search',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $savedSearches,\n 'value' => $report && $report->getSavedSearch() ? [\n 'id' => $report->getSavedSearch()->getUuid(),\n 'name' => $report->getSavedSearch()->getName(),\n ] : null,\n ],\n [\n 'id' => 'ask_jiminny_prompt',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Ask Jiminny prompt',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $prompts,\n 'value' => $report && $report->getAskAnythingPrompt() ? [\n 'id' => $report->getAskAnythingPrompt()->getUuid(),\n 'name' => $report->getAskAnythingPrompt()->getTitle(),\n ] : null,\n ],\n ],\n ];\n }\n\n private function updateResultNames(AutomatedReport $automatedReport): void\n {\n $results = $this->automatedReportsRepository->getResultsByReport($automatedReport);\n\n foreach ($results as $result) {\n $result->update(['name' => $this->getReportFileName($result)]);\n }\n }\n\n public function updateStatus(string $uuid, array $data): array\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $automatedReport->update([\n 'status' => $status,\n ]);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n private function generateOneOffReport(AutomatedReport $automatedReport): void\n {\n // the scheduler handles all the other frequency types\n if ($automatedReport->getStatus() === false || $automatedReport->getFrequency() !== self::FREQUENCY_ONE_OFF) {\n return;\n }\n\n $this->dispatcher->dispatch(new RequestGenerateReportJob($automatedReport->getUuid()));\n }\n\n public function getReport(string $uuid): AutomatedReport\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n return $automatedReport;\n }\n\n public function get(string $uuid): array\n {\n $automatedReport = $this->getReport($uuid);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function list(string $sortColumn = 'created_at', string $sortDirection = 'desc'): array\n {\n $results = [];\n $collection = $this->automatedReportsRepository->getAllStandardReports($sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function listAskJiminnyReports(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): array {\n $results = [];\n $collection = $this->automatedReportsRepository->getAskJiminnyReportsByUser($user, $sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function delete(string $uuid): void\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $automatedReport->delete();\n }\n\n public function createReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n return $this->automatedReportsRepository->createResult(\n array_merge(\n [\n 'report_id' => $automatedReport->getId(),\n 'status' => AutomatedReportResult::STATUS_DEFAULT,\n ],\n $data\n )\n );\n }\n\n public function getOrCreateReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n $existing = $this->automatedReportsRepository->findLatestDefaultOrFailedResult($automatedReport);\n\n if ($existing !== null) {\n $existing->update(['status' => AutomatedReportResult::STATUS_DEFAULT]);\n\n return $existing;\n }\n\n return $this->createReportResult($automatedReport, $data);\n }\n\n public function getReportResult(string $resultUuid): AutomatedReportResult\n {\n $report = $this->automatedReportsRepository->findResultByUuid($resultUuid);\n\n if (! $report) {\n throw new ModelNotFoundException('Report Result not found');\n }\n\n return $report;\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return $this->automatedReportsRepository->findChildResult($result, $type);\n }\n\n // prophet API calls\n /**\n * @throws ApplicationException\n */\n public function getGenerateReportPayload(AutomatedReport $automatedReport, string $reportResultUuid): array\n {\n $period = $this->calculateFromAndToDate($automatedReport);\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n return [\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResultUuid,\n 'report_type' => $automatedReport->getType(),\n 'media_types' => $automatedReport->getMediaTypes(),\n 'from_date' => $fromDate->startOfDay()->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->endOfDay()->format(DateTimeInterface::RFC3339),\n 'group_ids' => $automatedReport->getGroups(),\n 'call_deal_stage' => $automatedReport->getDealAtCallStages(),\n 'current_deal_stage' => $automatedReport->getCurrentDealStages(),\n 'deal_min_value' => $automatedReport->getDealValueMin(),\n 'deal_max_value' => $automatedReport->getDealValueMax(),\n 'call_types' => $automatedReport->getCallTypes(),\n 'call_duration_min_seconds' => $automatedReport->getCallDurationMin(),\n 'call_duration_max_seconds' => $automatedReport->getCallDurationMax(),\n 'special_requirements' => $automatedReport->getAdditionalPromptInput(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->formatReportPeriodName(\n $automatedReport->getFrequency(),\n $fromDate,\n $toDate,\n ),\n 'playbook_categories' => $automatedReport->getPlaybookCategories(),\n 'custom_name' => $automatedReport->getCustomName(),\n ];\n }\n\n // $inputPayload - FE payload structure\n public function getActivitiesCountPayload(array $inputPayload): array\n {\n // Use validateAndTransformData to validate and normalize input\n $validatedData = $this->validateAndTransformData($inputPayload);\n $period = $this->calculateFromAndToDatePeriod(\n $validatedData['frequency'],\n Carbon::parse($validatedData['from']),\n Carbon::parse($validatedData['to']),\n );\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n // Create payload similar to getGenerateReportPayload\n return [\n 'team_id' => $validatedData['team_id'],\n 'group_ids' => $validatedData['groups'] ?? [],\n 'report_type' => $validatedData['type'],\n 'from_date' => $fromDate->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->format(DateTimeInterface::RFC3339),\n 'call_deal_stage' => $validatedData['deal_at_call_stages'] ?? [],\n 'current_deal_stage' => $validatedData['current_deal_stages'] ?? [],\n 'deal_min_value' => $validatedData['deal_value_min'] ?? null,\n 'deal_max_value' => $validatedData['deal_value_max'] ?? null,\n 'call_types' => $validatedData['call_types'],\n 'call_duration_min_seconds' => $validatedData['call_duration_min'] ?? null,\n 'call_duration_max_seconds' => $validatedData['call_duration_max'] ?? null,\n 'special_requirements' => $validatedData['additional_prompt_input'] ?? null,\n 'playbook_categories' => $validatedData['playbook_categories'] ?? [],\n 'request_id' => null,\n 'callback_url' => null,\n ];\n }\n\n public function shouldSendReport(array $users, ?CarbonInterface $generatedAt = null): bool\n {\n if (empty($users)) {\n return false;\n }\n\n $earliestTz = collect($users)\n ->mapWithKeys(function (array $user) {\n $tz = new DateTimeZone($user['timezone']);\n $nowUtc = new DateTime('now', new DateTimeZone('UTC'));\n $offset = $tz->getOffset($nowUtc);\n\n return [$user['timezone'] => $offset];\n })\n ->sortDesc()\n ->keys()\n ->first();\n\n $now = Carbon::now($earliestTz);\n $isScheduledTime = (int) $now->format('H') === self::SENT_REPORT_AT_HOURS;\n\n if ($isScheduledTime) {\n return true;\n }\n\n return $this->hasPassedScheduledTime($generatedAt, $earliestTz);\n }\n\n public function hasPassedScheduledTime(?CarbonInterface $generatedAt, string $timezone): bool\n {\n if ($generatedAt === null) {\n return false;\n }\n\n $now = Carbon::now($timezone);\n $scheduledTime = $now->copy()->setTime(self::SENT_REPORT_AT_HOURS, 0, 0);\n\n if ($now->hour < self::SENT_REPORT_AT_HOURS) {\n $scheduledTime = $scheduledTime->subDay();\n }\n\n $scheduledTimeUtc = $scheduledTime->copy()->utc();\n $generatedAtUtc = $generatedAt->copy()->utc();\n $nowUtc = $now->copy()->utc();\n\n return $generatedAtUtc->lt($scheduledTimeUtc) && $nowUtc->gt($scheduledTimeUtc);\n }\n\n public function calculateFromAndToDatePeriod(\n string $frequency,\n ?Carbon $fromDate = null,\n ?Carbon $toDate = null\n ): array {\n if ($frequency === self::FREQUENCY_ONE_OFF) {\n return [\n 'fromDate' => $fromDate,\n 'toDate' => $toDate,\n ];\n }\n\n $now = Carbon::now();\n\n return match ($frequency) {\n self::FREQUENCY_DAILY => [\n 'fromDate' => $now->copy()->subDay()->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_WEEKLY => [\n 'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_MONTHLY => [\n 'fromDate' => $now->copy()->subMonths(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_QUARTERLY => [\n 'fromDate' => $now->copy()->subMonths(3)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n default => throw new InvalidArgumentException(\"Unsupported frequency: {$frequency}\"),\n };\n }\n\n private function calculateFromAndToDate(AutomatedReport $automatedReport): array\n {\n return $this->calculateFromAndToDatePeriod(\n $automatedReport->getFrequency(),\n $automatedReport->getFrom(),\n $automatedReport->getTo()\n );\n }\n\n public function getAskJiminnyGenerateReportPayload(\n AutomatedReport $automatedReport,\n AutomatedReportResult $reportResult,\n array $activityIds,\n ): array {\n return [\n 'user_question' => $automatedReport->getAskAnythingPrompt()?->getContent(),\n 'call_ids' => array_map('strval', $activityIds),\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResult->getUuid(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->getReportPeriodName($reportResult),\n 'report_name' => $automatedReport->getCustomName(),\n ];\n }\n\n private function getCallbackUrl(): string\n {\n return $this->webhookService->route('jiminny.webhook.reports.ready');\n }\n\n /**\n * Validate and transform payload data for automated reports\n *\n * @param array $data\n *\n * @throws InvalidArgumentException\n *\n * @return array\n */\n private function validateAndTransformData(array $data): array\n {\n // Validate organization (team) and check feature\n $team = $this->validateOrganization($data['organization'] ?? null);\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $type = $this->validateReportType($data['report_type'] ?? null);\n $frequency = $this->validateFrequency($data['frequency'] ?? null);\n $additionalPromptInput = $this->validateAdditionalPromptInput(\n $data['additional_prompt_input'] ?? null\n );\n $customReportName = $this->validateCustomReportName($data['custom_name'] ?? null);\n\n // Prepare data for the database\n $reportData = [\n 'team_id' => $team->getId(),\n 'type' => $type,\n 'status' => $status,\n 'frequency' => $frequency,\n 'additional_prompt_input' => $additionalPromptInput,\n 'custom_name' => $customReportName,\n ];\n\n // Validate deal values\n $reportData = $this->validateDealValues($data, $reportData);\n\n // Validate date range\n $reportData = $this->validateDateRange($data, $reportData, $frequency);\n\n // Validate call durations\n $reportData = $this->validateCallDurations($data, $reportData);\n\n // Validate call types\n $reportData = $this->validateCallTypes($data, $reportData);\n\n // Validate media types\n $reportData = $this->validateMediaTypes($data, $reportData);\n\n // Validate groups\n if (isset($data['teams'])) {\n $reportData['groups'] = $this->validateAndGetGroupIds($team, $data['teams']);\n }\n\n // Validate deal stages\n $reportData = $this->validateDealStages($data, $reportData, $team, $type);\n\n // Validate playbook categories\n $reportData = $this->validatePlaybookCategories($data, $reportData, $team);\n\n // Validate recipients\n $reportData['recipients'] = [\n 'users' => $this->validateAndGetUserIdsByTeam($team, $data['recipients'] ?? []),\n ];\n\n if (isset($data['jiminny_recipients'])) {\n // Validate Jiminny recipients\n $reportData['jiminny_recipients'] = [\n 'users' => $this->validateAndGetJiminnyUserIds((array) $data['jiminny_recipients']),\n ];\n }\n\n return $reportData;\n }\n\n private function validateDealValues(array $data, array $reportData): array\n {\n if (isset($data['min_deal_value'])) {\n $reportData['deal_value_min'] = (int) $data['min_deal_value'];\n\n if ($reportData['deal_value_min'] > 4294967295 || $reportData['deal_value_min'] < 0) {\n throw new InvalidArgumentException('Min deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_deal_value'])) {\n $reportData['deal_value_max'] = (int) $data['max_deal_value'];\n\n if ($reportData['deal_value_max'] > 4294967295 || $reportData['deal_value_max'] < 0) {\n throw new InvalidArgumentException('Max deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['min_deal_value'], $data['max_deal_value'])\n && $data['min_deal_value'] > $data['max_deal_value']\n ) {\n throw new InvalidArgumentException('Min deal value cannot be greater than max deal value');\n }\n\n return $reportData;\n }\n\n private function validateDateRange(array $data, array $reportData, string $frequency): array\n {\n // Set date range only for one_off frequency\n if ($frequency === 'one_off') {\n if (isset($data['start_date_period'])) {\n $reportData['from'] = $this->parseDate($data['start_date_period']);\n }\n\n if (isset($data['end_date_period'])) {\n $reportData['to'] = $this->parseDate($data['end_date_period']);\n }\n\n if (empty($reportData['from']) || empty($reportData['to'])) {\n throw new InvalidArgumentException(\n 'Start date and end date are required for one_off frequency'\n );\n }\n } else {\n $reportData['from'] = null;\n $reportData['to'] = null;\n }\n\n return $reportData;\n }\n\n private function validateCallDurations(array $data, array $reportData): array\n {\n // Convert call durations from minutes to seconds\n if (isset($data['min_call_duration'])) {\n $reportData['call_duration_min'] = (int) $data['min_call_duration'] * 60;\n\n if ($reportData['call_duration_min'] > 4294967295 || $reportData['call_duration_min'] < 0) {\n throw new InvalidArgumentException('Min call duration should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_call_duration'])) {\n $reportData['call_duration_max'] = (int) $data['max_call_duration'] * 60;\n\n if ($reportData['call_duration_max'] > 4294967295 || $reportData['call_duration_max'] < 0) {\n throw new InvalidArgumentException('Max call duration should be between 0 and 4294967295');\n }\n }\n\n return $reportData;\n }\n\n private function validateCallTypes(array $data, array $reportData): array\n {\n // Set call types\n $reportData['call_types'] = $data['call_type'] ?? [];\n if (empty($reportData['call_types'])) {\n $reportData['call_types'] = self::getCallTypes();\n }\n\n foreach ($reportData['call_types'] as $callType) {\n if (! in_array($callType, self::getCallTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Call type %s is invalid', $callType));\n }\n }\n\n return $reportData;\n }\n\n private function validateMediaTypes(array $data, array $reportData): array\n {\n // Set media types from input data\n $reportData['media_types'] = $data['media_types'] ?? [];\n\n if (empty($reportData['media_types'])) {\n throw new InvalidArgumentException('Media types are required');\n }\n\n foreach ($reportData['media_types'] as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n throw new InvalidArgumentException(sprintf('Media type %s is invalid', $mediaType));\n }\n }\n\n return $reportData;\n }\n\n private function validateDealStages(array $data, array $reportData, Team $team, string $reportType): array\n {\n // Validate and set deal stages\n if (isset($data['deal_stage_at_call'])) {\n $reportData['deal_at_call_stages'] =\n $this->validateAndGetDealStageIds($team, $data['deal_stage_at_call'], 'Deal stage at call');\n }\n\n if (isset($data['current_deal_stage'])) {\n $reportData['current_deal_stages'] =\n $this->validateAndGetDealStageIds($team, $data['current_deal_stage'], 'Current deal stage');\n }\n\n // Ensure current_deal_stage is not provided for loss_analysis report type\n if ($reportType === self::TYPE_LOSS_ANALYSIS && ! empty($data['current_deal_stage'])) {\n throw new InvalidArgumentException('Current deal stage is not applicable for Loss Analysis reports');\n }\n\n return $reportData;\n }\n\n // transform uuid to id\n private function validatePlaybookCategories(array $data, array $reportData, Team $team): array\n {\n $key = 'playbook_categories';\n\n if (isset($data[$key])) {\n $payloadIds = $data[$key];\n $ids = [];\n\n foreach ($payloadIds as $uuid) {\n $uuid = (string) $uuid;\n\n try {\n $playbookCategory = $this->playbookCategoryRepository->findByUuid($uuid);\n } catch (Throwable $throwable) {\n Log::error(__METHOD__ . ' ' . $throwable->getMessage());\n\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory) {\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory->hasPlaybook()) {\n throw new InvalidArgumentException(sprintf('Playbook category %s has no playbook', $uuid));\n }\n\n if ($playbookCategory->getPlaybook()->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Playbook category %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $ids[] = $playbookCategory->getId();\n }\n\n $reportData[$key] = $ids;\n }\n\n return $reportData;\n }\n\n private function validateReportStatus($status): bool\n {\n if (! in_array($status, [true, false], true)) {\n throw new InvalidArgumentException('Report status is invalid');\n }\n\n return $status;\n }\n\n private function validateReportType($type): string\n {\n if (! in_array($type, self::getTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Report type is invalid: %s', $type));\n }\n\n return $type;\n }\n\n private function validateFrequency($frequency): string\n {\n if (! in_array($frequency, self::getFrequencies(), true)) {\n throw new InvalidArgumentException('Frequency is invalid');\n }\n\n return $frequency;\n }\n\n private function validateAdditionalPromptInput(?string $additionalPromptInput): ?string\n {\n if ($additionalPromptInput && strlen($additionalPromptInput) > 5000) {\n throw new InvalidArgumentException('Additional Prompt Input should be less than 5000 characters');\n }\n\n return $additionalPromptInput;\n }\n\n private function validateCustomReportName(?string $customReportName): ?string\n {\n if ($customReportName === null || $customReportName === '') {\n return null;\n }\n\n if (strlen($customReportName) > 70) {\n throw new InvalidArgumentException('Custom report name should be less than 70 characters');\n }\n\n return $customReportName;\n }\n\n private function validateOrganization(?string $organizationUuid): Team\n {\n if (! $organizationUuid) {\n throw new InvalidArgumentException('Organization is required');\n }\n\n $team = $this->teamRepository->idOrUuid($organizationUuid);\n\n if (! $team) {\n throw new InvalidArgumentException('Organization not found');\n }\n\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n throw new InvalidArgumentException('Organization does not have the Automated Reports feature');\n }\n\n return $team;\n }\n\n private function validateAndGetGroupIds(Team $team, array $teamUuids): array\n {\n $groupIds = [];\n\n foreach ($teamUuids as $uuid) {\n $group = $this->groupRepository->findByUuid($uuid);\n\n if ($group === null || $group->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Group %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $groupIds[] = $group->getId();\n\n }\n\n return $groupIds;\n }\n\n private function validateAndGetDealStageIds(Team $team, array $stageUuids, string $propertyLabel): array\n {\n $stageIds = [];\n\n foreach ($stageUuids as $uuid) {\n $stage = $this->stageRepository->findByUuid($uuid);\n\n if ($stage === null || $stage->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Stage %s not found for team %s for %s', $uuid, $team->getUuid(), $propertyLabel)\n );\n }\n\n $stageIds[] = $stage->getId();\n }\n\n return $stageIds;\n }\n\n private function validateAndGetUserIds(array $userUuids, callable $teamCheck): array\n {\n if (empty($userUuids)) {\n return [];\n }\n\n $userIds = [];\n\n foreach ($userUuids as $uuid) {\n $user = $this->userRepository->findByUuid($uuid);\n\n if (! $user || ! $user->isStatusActive()) {\n throw new InvalidArgumentException(\n sprintf('User %s not found or is not active', $uuid)\n );\n }\n\n if (! $teamCheck($user)) {\n throw new InvalidArgumentException(\n sprintf('User %s does not belong to the allowed team(s)', $uuid)\n );\n }\n\n $userIds[] = $user->getId();\n }\n\n return $userIds;\n }\n\n private function validateAndGetUserIdsByTeam(Team $team, array $userUuids): array\n {\n return $this->validateAndGetUserIds($userUuids, fn ($user) => $user->getTeamId() === $team->getId());\n }\n\n private function validateAndGetJiminnyUserIds(array $userUuids): array\n {\n $allowedTeamIds = config('kiosk.teamIds', []);\n\n return $this->validateAndGetUserIds($userUuids, fn ($user) => in_array($user->getTeamId(), $allowedTeamIds, true));\n }\n\n private function parseDate(string $dateString): string\n {\n return date('Y-m-d H:i:s', strtotime($dateString));\n }\n\n private function generateReportResultViewUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.view', ['uuid' => $result->getUuid()]);\n }\n\n private function generateReportResultDownloadUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.download', ['uuid' => $result->getUuid()]);\n }\n\n private function getReportMediaRouteResource(AutomatedReportResult $result): string\n {\n if ($result->getMediaType() === self::MEDIA_TYPE_PDF) {\n return self::PDF_KEY;\n } elseif ($result->getMediaType() === self::MEDIA_TYPE_PODCAST) {\n return self::AUDIO_KEY;\n }\n\n throw new \\InvalidArgumentException('Unknown media type.');\n }\n\n public function getMediaPath(AutomatedReportResult $result): ?string\n {\n $url = match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => $result->getPdfUrl(),\n self::MEDIA_TYPE_PODCAST => $result->getPodcastAudioUrl(),\n default => null,\n };\n\n if ($url === null) {\n return null;\n }\n\n $path = parse_url(trim($url, '\"\\''), PHP_URL_PATH);\n\n return $path ?: null;\n }\n\n public function getFilenameSuffix(AutomatedReportResult $result): ?string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => 'Podcast',\n default => null,\n };\n }\n\n public function getMailSubjectSuffix(AutomatedReportResult $result): string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => 'report',\n self::MEDIA_TYPE_PODCAST => 'podcast',\n default => '',\n };\n }\n\n public function getMediaTypeMetadata(AutomatedReportResult $result): array\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => ['extension' => 'mp3', 'mime' => 'audio/mpeg'],\n self::MEDIA_TYPE_PDF => ['extension' => 'pdf', 'mime' => 'application/pdf'],\n default => ['extension' => null, 'mime' => null],\n };\n }\n\n public function deleteS3Files(AutomatedReportResult $result): void\n {\n $teamUuid = $result->getReport()->getTeam()->getUuid();\n $reportUuid = $result->getUuid();\n\n // delete all files for a report uuid no mather of pdf, podcast, or both\n // in case of both - the podcast files are linked to the pdf (parent) uuid\n // pdf and podcast date times should be close\n $path = sprintf('%s/%s/%s', $teamUuid, self::S3_DIR, $reportUuid);\n\n foreach (self::FILE_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted S3 file', [\n 'path' => $file,\n ]);\n }\n }\n\n foreach (self::FILE_PODCAST_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '_podcast.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted Podcast S3 file', [\n 'path' => $file,\n ]);\n }\n }\n }\n\n /**\n *\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): Collection\n {\n return $this->automatedReportsRepository->getTeamIdsWithReportsResults($teamId);\n }\n\n /**\n * Core delete logic for report results using a query\n *\n * @param Builder $query\n * @param array $logContext\n *\n * @return int\n */\n private function deleteReportResultsByQuery(Builder $query, array $logContext = []): int\n {\n $deletedCount = 0;\n\n if ($query->exists()) {\n Log::info(\n 'Run delete report results',\n array_merge(\n $logContext,\n [\n 'service' => 'AutomatedReportsService',\n ]\n )\n );\n\n $query->chunkById(50, function ($results) use (&$deletedCount, $logContext) {\n foreach ($results as $result) {\n $this->deleteReportResult($result);\n $deletedCount++;\n\n Log::info(\n 'Deleted a report result',\n array_merge(\n $logContext,\n [\n 'result_id' => $result->getId(),\n 'report_id' => $result->getReportId(),\n ]\n )\n );\n }\n });\n }\n\n return $deletedCount;\n }\n\n /**\n * Delete report results for a team by retention period\n *\n * @param Team $team\n * @param CarbonImmutable $retentionDate\n *\n * @return int Number of deleted report results\n */\n public function deleteReportsResultsInRetentionPeriod(Team $team, CarbonImmutable $retentionDate): int\n {\n $reportIds = $this->automatedReportsRepository->getReportIdsByTeam($team);\n\n if ($reportIds->isEmpty()) {\n return 0;\n }\n\n $query = $this->automatedReportsRepository\n ->getReportResultsQueryForRetention($team, $retentionDate);\n\n return $this->deleteReportResultsByQuery($query, [\n 'team_id' => $team->getId(),\n 'retention_date' => $retentionDate->toDateTimeString(),\n ]);\n }\n\n /**\n * Delete ALL report results for a specific automated report\n *\n * @param string $uuid\n *\n * @return int\n */\n public function deleteReportResults(string $uuid): int\n {\n $report = $this->getReport($uuid);\n\n $query = $this->automatedReportsRepository->getResultsByReportQuery($report);\n\n return $this->deleteReportResultsByQuery($query, [\n 'report_uuid' => $uuid,\n 'report_id' => $report->getId(),\n ]);\n }\n\n public function deleteReportResult(AutomatedReportResult $result): void\n {\n $this->deleteS3Files($result);\n\n $result->delete();\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getTeamReports(Team $team): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getReportsByTeam($team);\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getReportResults(AutomatedReport $report): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getResultsByReport($report);\n }\n\n public function deleteAllReportResults(AutomatedReport $report): void\n {\n $results = $this->getReportResults($report);\n\n /** @var AutomatedReportResult $result */\n foreach ($results as $result) {\n Log::info('Deleting result', [\n 'report' => $report->getId(),\n 'result' => $result->getId(),\n ]);\n\n $this->deleteReportResult($result);\n }\n }\n\n public function deleteAllData(Team $team): void\n {\n Log::info('Deleting automated report and results for team', [\n 'team' => $team->getId(),\n ]);\n\n $reports = $this->getTeamReports($team);\n\n /** @var AutomatedReport $report */\n foreach ($reports as $report) {\n Log::info('Deleting report', [\n 'team' => $team->getId(),\n 'report' => $report->getId(),\n ]);\n\n $this->deleteAllReportResults($report);\n\n $report->delete();\n }\n }\n}","depth":4,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Services\\Kiosk\\AutomatedReports;\n\nuse Carbon\\CarbonImmutable;\nuse Carbon\\CarbonInterface;\nuse Carbon\\Exceptions\\InvalidFormatException;\nuse DateTime;\nuse DateTimeInterface;\nuse DateTimeZone;\nuse Illuminate\\Contracts\\Bus\\Dispatcher as BusDispatcher;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Support\\Collection;\nuse Illuminate\\Support\\Facades\\Log;\nuse Illuminate\\Support\\Facades\\Storage;\nuse Jiminny\\Component\\ActivitySearch\\FilterDefinition\\InputTypeEnum;\nuse Jiminny\\Component\\AskAnything\\AskAnythingPromptService;\nuse Jiminny\\Component\\AskAnything\\Dtos\\AskAnythingPromptDto;\nuse Jiminny\\Component\\UrlGenerator\\Webhook;\nuse Jiminny\\Contracts\\Repositories\\PlaybookCategoryRepository;\nuse Jiminny\\Contracts\\Repositories\\TeamRepository;\nuse Jiminny\\Contracts\\Repositories\\UserRepository;\nuse Jiminny\\Exceptions\\ApplicationException;\nuse Jiminny\\Exceptions\\InvalidArgumentException;\nuse Jiminny\\Exceptions\\ModelNotFoundException;\nuse Jiminny\\Jobs\\AutomatedReports\\RequestGenerateReportJob;\nuse Jiminny\\Models\\Activity\\Search;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPrompt;\nuse Jiminny\\Models\\AskAnything\\AskAnythingPromptTarget;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Contracts\\UserContract;\nuse Jiminny\\Models\\Feature\\FeatureEnum;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Repositories\\AskAnythingRepository;\nuse Jiminny\\Repositories\\AutomatedReportsRepository;\nuse Jiminny\\Repositories\\GroupRepository;\nuse Jiminny\\Repositories\\SearchRepository;\nuse Jiminny\\Repositories\\StageRepository;\nuse Throwable;\n\nclass AutomatedReportsService\n{\n public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';\n public const string TYPE_ASK_JIMINNY = 'ask_jiminny';\n\n /**\n * Standard report types (used by kiosk for existing automated reports).\n */\n // @TODO this will add filter, however if we need to control feature by FF we need conditional logic\n public const array TYPES = [\n ['id' => 'exec_summary', 'name' => 'Exec Summary'],\n ['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],\n ['id' => 'product_feedback', 'name' => 'Product Feedback'],\n ['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],\n// ['id' => 'questions', 'name' => 'Questions'],\n// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],\n ];\n\n public const array ALL_TYPES = [\n ...self::TYPES,\n ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],\n ];\n\n public const string FREQUENCY_DAILY = 'daily';\n public const string FREQUENCY_WEEKLY = 'weekly';\n public const string FREQUENCY_MONTHLY = 'monthly';\n public const string FREQUENCY_QUARTERLY = 'quarterly';\n public const string FREQUENCY_ONE_OFF = 'one_off';\n\n /**\n * Frequencies for standard (non-Ask Jiminny) reports.\n */\n public const array FREQUENCIES = [\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n\n /**\n * Frequencies for Ask Jiminny reports.\n */\n public const array ASK_JIMINNY_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ];\n\n public const string MEDIA_TYPE_PDF = 'pdf';\n public const string MEDIA_TYPE_PODCAST = 'podcast';\n public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];\n public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];\n public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];\n public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];\n\n public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];\n public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];\n public const int SENT_REPORT_AT_HOURS = 5;\n public const string PDF_KEY = 'pdf';\n public const string AUDIO_KEY = 'audio';\n\n private const array ALL_FREQUENCIES = [\n ['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],\n ['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],\n ['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],\n ['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],\n ['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],\n ];\n private const string S3_DIR = 'reports';\n private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];\n private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];\n\n public function __construct(\n private readonly TeamRepository $teamRepository,\n private readonly GroupRepository $groupRepository,\n private readonly UserRepository $userRepository,\n private readonly StageRepository $stageRepository,\n private readonly DealStagesService $dealStagesService,\n private readonly RecipientsService $recipientsService,\n private readonly AutomatedReportsRepository $automatedReportsRepository,\n private readonly Webhook $webhookService,\n private readonly BusDispatcher $dispatcher,\n private readonly ActivityTypeService $activityTypeService,\n private readonly PlaybookCategoryRepository $playbookCategoryRepository,\n private readonly AskAnythingPromptService $askAnythingPromptService,\n private readonly SearchRepository $activitySearchRepository,\n private readonly AskAnythingRepository $askAnythingRepository,\n ) {\n }\n\n public static function getTypes(): array\n {\n $types = self::TYPES;\n\n return array_map(static function ($type) {\n return $type['id'];\n }, $types);\n }\n\n public static function getCallTypes(): array\n {\n return array_map(static function ($callType) {\n return $callType['id'];\n }, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);\n }\n\n public static function getFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::FREQUENCIES);\n }\n\n // front-facing structure\n public function getReportEnabledFieldData(bool $value = false): array\n {\n return [\n 'id' => 'report_enabled',\n 'label' => '',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'value' => $value,\n ];\n }\n\n // Organizations = Teams\n public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array\n {\n $options = $this->getTeams();\n\n if ($shortVersion) {\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'organization',\n 'label' => 'Organization',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value,\n 'dependencies' => [\n 'teams',\n 'deal_stage_at_call',\n 'current_deal_stage',\n 'recipients',\n ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,\n ],\n 'dependsOn' => [],\n ];\n }\n\n // Teams = Groups\n public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array\n {\n if ($shortVersion) {\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'options' => $options,\n ];\n }\n\n return [\n 'id' => 'teams',\n 'label' => 'Team',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $options,\n 'value' => $value, // value should be an array of objects {id, name}\n 'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],\n 'dependsOn' => [],\n ];\n }\n\n public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array\n {\n $types = [];\n if ($team instanceof Team) {\n if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n $types = self::TYPES;\n }\n if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {\n $types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];\n }\n } else {\n $types = self::TYPES;\n }\n\n if ($shortVersion) {\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'options' => $types,\n ];\n }\n\n return [\n 'id' => 'report_type',\n 'label' => 'Report Type',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $types,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getFrequencyFieldData(?string $value = null): array\n {\n return [\n 'id' => 'frequency',\n 'label' => 'Frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::FREQUENCIES,\n 'value' => $value,\n 'dependencies' => ['period'],\n 'dependsOn' => [],\n ];\n }\n\n public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array\n {\n return [\n 'id' => 'period',\n 'label' => 'Select one-off period',\n 'inputType' => InputTypeEnum::DATE_RANGE,\n 'required' => true,\n 'placeholder' => 'Select',\n 'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],\n 'queryParams' => [\n 'startDate' => 'start_date_period',\n 'endDate' => 'end_date_period',\n ],\n 'dependencies' => [],\n 'dependsOn' => ['frequency'],\n ];\n }\n\n public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array\n {\n return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);\n }\n\n public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);\n }\n\n public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array\n {\n return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);\n }\n\n public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'deal_value',\n 'label' => 'Deal Value',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_deal_value',\n 'max' => 'max_deal_value',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array\n {\n $value = [];\n $conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;\n $dialerOn && $value[] = self::CALL_TYPE_DIALER;\n\n return [\n 'id' => 'call_type',\n 'label' => 'Call Type',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => [\n self::CALL_TYPE_CONFERENCE,\n self::CALL_TYPE_DIALER,\n ],\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getMediaTypeFieldData(?AutomatedReport $report = null): array\n {\n $value = [];\n\n if ($report) {\n $value = $this->transformMediaTypes($report);\n }\n\n return [\n 'id' => 'media_types',\n 'label' => 'Export as',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'required' => true,\n 'options' => self::MEDIA_TYPE_OBJECTS,\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array\n {\n return [\n 'id' => 'call_duration',\n 'label' => 'Call Duration',\n 'inputType' => InputTypeEnum::INTEGER_RANGE,\n 'required' => false,\n 'value' => ['min' => $valueMin, 'max' => $valueMax],\n 'queryParams' => [\n 'min' => 'min_call_duration',\n 'max' => 'max_call_duration',\n ],\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getRecipientsFieldData(?Team $team = null, array $value = []): array\n {\n return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);\n }\n\n public function getJiminnyRecipientsFieldData(array $value = []): array\n {\n return $this->recipientsService->getJiminnyRecipientsFieldData($value);\n }\n\n public function getAdditionalPromptInputFieldData(?string $value = null): array\n {\n return [\n 'id' => 'additional_prompt_input',\n 'label' => 'Special requirements',\n 'inputType' => InputTypeEnum::TEXTAREA,\n 'required' => false,\n 'placeholder' => 'What should be the focus of the report?',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n public function getCustomReportNameFieldData(?string $value = null): array\n {\n return [\n 'id' => 'custom_name',\n 'label' => 'Custom report name',\n 'inputType' => InputTypeEnum::TEXT,\n 'required' => false,\n 'placeholder' => 'Enter custom name',\n 'value' => $value,\n 'dependencies' => [],\n 'dependsOn' => [],\n ];\n }\n\n // data providers\n public function getTeams(): array\n {\n $teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);\n\n $teamData = [];\n foreach ($teams as $team) {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n continue;\n }\n\n $teamData[] = $this->transformTeam($team);\n }\n\n return $teamData;\n }\n\n public function getTeamGroups(string $teamUuid): array\n {\n $data = [];\n $team = $this->getTeam($teamUuid);\n\n if ($team !== null) {\n $groups = $team->groups()->get();\n\n foreach ($groups as $group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n public function getTeamsGroupsOptions(array $filterTeamUuids = []): array\n {\n $data = [];\n $teams = $this->getTeams();\n\n foreach ($teams as $team) {\n if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {\n continue;\n }\n\n $data[] = [\n 'label' => $team['name'],\n 'groups' => $this->getTeamGroups($team['id']),\n ];\n }\n\n return $data;\n }\n\n public function getTeam(string $teamUuid): ?Team\n {\n return $this->teamRepository->idOrUuid($teamUuid);\n }\n\n public function getTeamById(int $teamId): ?Team\n {\n return $this->teamRepository->find($teamId);\n }\n\n public function getGroupsUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportGroups = $report->getGroups();\n foreach ($reportGroups as $groupId) {\n if ($group = $this->groupRepository->find($groupId)) {\n $uuids[] = $group->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getPlaybookCategoriesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $playbookCategories = $report->getPlaybookCategories();\n foreach ($playbookCategories as $id) {\n if ($category = $this->playbookCategoryRepository->find($id)) {\n $uuids[] = $category->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getDealAtCallStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getDealAtCallStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getCurrentDealStagesUuids(AutomatedReport $report): array\n {\n $uuids = [];\n $reportStages = $report->getCurrentDealStages();\n foreach ($reportStages as $id) {\n if ($stage = $this->stageRepository->find($id)) {\n $uuids[] = $stage->getUuid();\n }\n }\n\n return $uuids;\n }\n\n public function getUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getRecipients());\n }\n\n public function getJiminnyUsersUuids(AutomatedReport $report): array\n {\n return $this->extractUserUuids($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function extractUserUuids(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => $user->getUuid())\n ->values()\n ->all();\n }\n\n // get mail data\n public function getRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getRecipients());\n }\n\n /**\n * @return array<UserContract>\n */\n public function getRecipientUserObjects(AutomatedReport $report): array\n {\n $userIds = $report->getRecipients()['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->values()\n ->all();\n }\n\n private function getJiminnyRecipientUsers(AutomatedReport $report): array\n {\n return $this->buildRecipientUsers($report->getJiminnyRecipients());\n }\n\n /**\n * @param array<string, mixed> $recipients\n */\n private function buildRecipientUsers(array $recipients): array\n {\n $userIds = $recipients['users'] ?? [];\n\n return collect($userIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (UserContract $user) => [\n 'email' => $user->getEmailAddress(),\n 'name' => $user->getName(),\n 'timezone' => $user->getTimezone()->getName(),\n ])\n ->values()\n ->all();\n }\n\n public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array\n {\n if ($report->isAskJiminnyReport()) {\n $recipients = $this->resolveAskJiminnyRecipients($report);\n } else {\n $recipients = $this->getRecipientUsers($report);\n if ($includeJiminny) {\n $recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));\n }\n }\n\n $emails = [];\n\n return array_values(array_filter(\n $recipients,\n static function ($recipient) use (&$emails) {\n if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {\n return false;\n }\n $emails[] = $recipient['email'];\n\n return true;\n }\n ));\n }\n\n private function resolveAskJiminnyRecipients(AutomatedReport $report): array\n {\n $recipients = [];\n\n $creator = $report->getCreator();\n if ($creator !== null) {\n $recipients[] = [\n 'email' => $creator->getEmailAddress(),\n 'name' => $creator->getName(),\n 'timezone' => $creator->getTimezone()->getName(),\n ];\n }\n\n return array_merge(\n $recipients,\n $this->buildRecipientUsers($report->getRecipients()),\n $this->getGroupRecipientUsers($report),\n );\n }\n\n private function getGroupRecipientUsers(AutomatedReport $report): array\n {\n $users = [];\n foreach ($report->getGroups() as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group === null) {\n continue;\n }\n foreach ($group->getMembers() as $member) {\n $users[] = [\n 'email' => $member->getEmailAddress(),\n 'name' => $member->getName(),\n 'timezone' => $member->getTimezone()->getName(),\n ];\n }\n }\n\n return $users;\n }\n\n public function getReportTypeName(AutomatedReportResult $report): string\n {\n $type = $report->getReport()->getType();\n\n $getType = $this->transformReportType($type);\n\n return $getType['name'];\n }\n\n public function getReportPeriodName(AutomatedReportResult $report): string\n {\n $from = $report->getFromDate();\n $to = $report->getToDate();\n $frequency = $report->getReport()->getFrequency();\n\n if ($from === null || $to === null) {\n if (! $report->getReport()->isAskJiminnyReport()) {\n $invalidPeriod = $from === null ? 'from' : 'to';\n\n throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);\n }\n\n $period = $this->calculateFromAndToDatePeriod($frequency);\n $from = $period['fromDate'];\n $to = $period['toDate'];\n }\n\n return $this->formatReportPeriodName($frequency, $from, $to);\n }\n\n private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string\n {\n $fromYear = $from->format('Y');\n $toYear = $to->format('Y');\n $differentYears = $fromYear !== $toYear;\n\n switch ($frequency) {\n case self::FREQUENCY_DAILY:\n return $from->format('j M Y');\n\n case self::FREQUENCY_QUARTERLY:\n // 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ\n $startMonth = $from->format('M');\n $endMonth = $to->copy()->subMonth();\n $endMonthName = $endMonth->format('M');\n $endMonthYear = $endMonth->format('Y');\n\n if ($differentYears) {\n return \"{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}\";\n }\n\n return \"{$startMonth} - {$endMonthName} {$toYear}\";\n\n case self::FREQUENCY_MONTHLY:\n // 'May 2025' - monthly reports are always within the same year\n return $from->format('M Y');\n\n case self::FREQUENCY_WEEKLY:\n // '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ\n $startDay = $from->format('j');\n $endDay = $to->format('j');\n $startMonth = $from->format('M');\n $endMonth = $to->format('M');\n\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n if ($startMonth !== $endMonth) {\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n return \"{$startDay} - {$endDay} {$endMonth} {$toYear}\";\n\n case self::FREQUENCY_ONE_OFF:\n // '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ\n $startDay = $from->format('j');\n $startMonth = $from->format('M');\n $endDay = $to->format('j');\n $endMonth = $to->format('M');\n\n // If same month and year, use a format like '2-31 May 2025'\n if ($startMonth === $endMonth && ! $differentYears) {\n return \"{$startDay} - {$endDay} {$startMonth} {$toYear}\";\n }\n\n // If different years, include both years\n if ($differentYears) {\n return \"{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}\";\n }\n\n // Same year but different months\n return \"{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}\";\n\n default:\n // Default format for unknown frequencies\n return $from->format('j M Y') . ' - ' . $to->format('j M Y');\n }\n }\n\n public function getReportTeamsName(AutomatedReportResult $report): string\n {\n $groups = $report->getGroups();\n\n if (empty($groups)) {\n return 'All';\n }\n\n // Get group names from repository\n $groupNames = [];\n foreach ($groups as $groupId) {\n $group = $this->groupRepository->find($groupId);\n if ($group) {\n $groupNames[] = $group->getName();\n }\n }\n\n if (count($groupNames) === 1) {\n // Single team format\n $teamsName = $groupNames[0];\n } else {\n // Multiple teams format\n $teamsName = implode(', ', $groupNames);\n }\n\n return $teamsName;\n }\n\n public function getReportFileName(AutomatedReportResult $report): string\n {\n $customName = $report->getReport()->getCustomName();\n $periodName = $this->getReportPeriodName($report);\n $filenameSuffix = $this->getFilenameSuffix($report);\n\n if ($customName) {\n if ($filenameSuffix) {\n $customName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$customName} - {$periodName}\");\n }\n\n $baseName = $this->getReportTypeName($report);\n\n if ($filenameSuffix) {\n $baseName .= \" {$filenameSuffix}\";\n }\n\n return $this->sanitizeFileName(\"{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}\");\n }\n\n public function getReportFileNameWithExtension(AutomatedReportResult $result): string\n {\n $extension = $this->getMediaTypeMetadata($result)['extension'];\n\n return $this->getReportFileName($result) . '.' . $extension;\n }\n\n public function sanitizeFileName(string $fileName): string\n {\n return str_replace(['/', '\\\\'], '-', $fileName);\n }\n\n public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool\n {\n $recipients = array_map('intval', $report->getRecipients()['users'] ?? []);\n\n return in_array($user->getId(), $recipients);\n }\n\n public function transformReportResults(Collection $automatedReportResults): array\n {\n $data = [];\n foreach ($automatedReportResults as $automatedReportResult) {\n /** @var AutomatedReportResult $automatedReportResult */\n\n $report = $automatedReportResult->getReport();\n\n $createdBy = $report->getCreator();\n $creator = [\n 'id' => $createdBy?->getUuid(),\n 'name' => $createdBy?->getName(),\n 'email' => $createdBy?->getEmailAddress(),\n 'photoUrl' => $createdBy?->getPhotoUrl(),\n ];\n\n $data[] = [\n 'id' => $automatedReportResult->getUuid(),\n 'name' => $automatedReportResult->getName(),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n 'recipients' => $this->buildRecipients($report),\n 'report_type' => $this->transformReportType($report->getType()),\n 'media_type' => $automatedReportResult->getMediaType(),\n 'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),\n 'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),\n 'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),\n 'creator' => $creator,\n ];\n }\n\n return $data;\n }\n\n private function buildRecipients(AutomatedReport $report): array\n {\n $creatorUuid = $report->getCreator()?->getUuid();\n\n $recipients = array_values(array_filter(\n $this->transformRecipients($report->getRecipients()),\n static fn (array $recipient): bool => $recipient['id'] !== $creatorUuid,\n ));\n\n if (! $report->isAskJiminnyReport()) {\n return $recipients;\n }\n\n return [\n ...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),\n ...$recipients,\n ];\n }\n\n public function hasCallTypeConference(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);\n }\n\n public function hasCallTypeDialer(AutomatedReport $report): bool\n {\n return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);\n }\n\n // transformers\n private function transformTeam(Team $team): array\n {\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n return [];\n }\n\n return [\n 'id' => $team->getUuid(),\n 'name' => $team->getName(),\n ];\n }\n\n private function transformReportFullView(AutomatedReport $report): array\n {\n $base = $this->transformReportBase($report);\n\n return $report->getType() === self::TYPE_ASK_JIMINNY\n ? $base + $this->transformAskJiminnyFields($report)\n : $base + $this->transformStandardReportFields($report);\n }\n\n private function transformReportBase(AutomatedReport $report): array\n {\n return [\n 'id' => $report->getUuid(),\n 'organization' => $this->transformOrganization(team: $report->getTeam()),\n 'report_type' => $this->transformReportType($report->getType()),\n 'frequency' => $this->transformFrequency($report->getFrequency()),\n ];\n }\n\n private function transformStandardReportFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n\n return [\n 'report_enabled' => $report->getStatus(),\n 'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),\n 'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),\n 'deal_value_min' => $report->getDealValueMin(),\n 'deal_value_max' => $report->getDealValueMax(),\n 'call_types' => $this->transformCallType($report->getCallTypes()),\n 'media_types' => $this->transformMediaTypes($report),\n 'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),\n 'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),\n 'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),\n 'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),\n 'recipients' => $this->transformRecipients($report->getRecipients()),\n 'created_by' => $this->transformCreator($report->getCreator()),\n 'additional_prompt_input' => $report->getAdditionalPromptInput(),\n 'custom_name' => $report->getCustomName(),\n 'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),\n 'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),\n 'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),\n ];\n }\n\n private function transformAskJiminnyFields(AutomatedReport $report): array\n {\n $team = $report->getTeam();\n $creatorId = $report->getAttribute('created_by');\n $explicitUserIds = array_values(array_filter(\n $report->getRecipients()['users'] ?? [],\n static fn ($id) => $id !== $creatorId\n ));\n\n return [\n 'report_name' => $report->getCustomName(),\n 'enabled' => $report->getStatus(),\n 'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),\n 'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),\n 'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),\n 'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),\n 'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),\n ];\n }\n\n private function transformOrganization(?Team $team): array\n {\n return [\n 'id' => $team?->getUuid(),\n 'name' => $team?->getName(),\n ];\n }\n\n private function transformReportType(string $type): array\n {\n foreach (self::ALL_TYPES as $typeItem) {\n if ($typeItem['id'] === $type) {\n return $typeItem;\n }\n }\n\n return [];\n }\n\n private function transformCallType(array $types): array\n {\n $result = [];\n $callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];\n\n foreach ($types as $type) {\n foreach ($callTypes as $callTypeItem) {\n if ($callTypeItem['id'] === $type) {\n $result[] = $callTypeItem;\n\n break;\n }\n }\n }\n\n return $result;\n }\n\n private function transformMediaTypes(AutomatedReport $report): array\n {\n $values = [];\n\n foreach ($report->getMediaTypes() as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n continue;\n }\n\n $values[] = match ($mediaType) {\n self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,\n self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,\n };\n }\n\n return $values;\n }\n\n private function transformFrequency(string $frequency): array\n {\n foreach (self::ALL_FREQUENCIES as $frequencyItem) {\n if ($frequencyItem['id'] === $frequency) {\n return $frequencyItem;\n }\n }\n\n return [];\n }\n\n public function transformDurationToMinutes(?int $duration): ?int\n {\n if (! $duration) {\n return null;\n }\n\n return (int) ($duration / 60);\n }\n\n private function transformGroups(?Team $team, array $groupsIds): array\n {\n if (empty($groupsIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($groupsIds as $groupId) {\n $group = $team->groups()->where('id', $groupId)->first();\n\n if ($group) {\n $data[] = [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n 'photoUrl' => $group->getPhotoUrl(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformStages(?Team $team, array $stagesIds): array\n {\n if (empty($stagesIds) || ! $team) {\n return [];\n }\n\n $data = [];\n foreach ($stagesIds as $stageId) {\n $stage = $team->stages()->where('id', $stageId)->first();\n\n if ($stage) {\n $data[] = [\n 'id' => $stage->getUuid(),\n 'name' => $stage->getName(),\n ];\n }\n }\n\n return $data;\n }\n\n private function transformRecipients(array $recipients): array\n {\n $users = [];\n foreach ($recipients['users'] ?? [] as $userId) {\n $users[] = $this->transformUser($userId);\n }\n\n return $users;\n }\n\n private function transformCreator(?User $user): ?array\n {\n if ($user === null) {\n return null;\n }\n\n return $this->transformUser($user->getId());\n }\n\n private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array\n {\n if ($prompt === null) {\n return null;\n }\n\n return [\n 'id' => $prompt->getUuid(),\n 'name' => $prompt->getTitle(),\n ];\n }\n\n private function transformSafeSearch(?Search $search): ?array\n {\n if ($search === null) {\n return null;\n }\n\n return [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ];\n }\n\n private function transformUser(int $userId): array\n {\n /* @var ?User $user */\n $user = $this->userRepository->find($userId);\n\n return [\n 'id' => $user?->getUuid(),\n 'name' => $user?->getName(),\n 'email' => $user?->getEmailAddress(),\n 'photoUrl' => $user?->getPhotoUrl(),\n ];\n }\n\n public function create(array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $validatedData['created_by'] = auth()->id();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function update(string $uuid, array $data): array\n {\n $validatedData = $this->validateAndTransformData($data);\n $report = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $report) {\n throw new InvalidArgumentException('Report not found');\n }\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Create an Ask Jiminny report.\n */\n public function createAskJiminnyReport(array $data, User $creator): array\n {\n $validatedData = $this->validateAskJiminnyReportData($data, $creator);\n $validatedData['created_by'] = $creator->getId();\n\n $automatedReport = $this->automatedReportsRepository->create($validatedData);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n /**\n * Update an Ask Jiminny report.\n */\n public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array\n {\n if (! $report->isAskJiminnyReport()) {\n throw new InvalidArgumentException('Report is not an Ask Jiminny report');\n }\n\n $validatedData = $this->validateAskJiminnyReportData($data, $user);\n\n $oldCustomName = $report->getCustomName();\n\n $automatedReport = $this->automatedReportsRepository->update($report, $validatedData);\n\n if ($oldCustomName !== $automatedReport->getCustomName()) {\n $this->updateResultNames($automatedReport);\n }\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array\n {\n $this->automatedReportsRepository->update($report, ['status' => $status]);\n\n return $this->transformReportFullView($report->fresh());\n }\n\n /**\n * Validate and transform data for Ask Jiminny reports.\n */\n private function validateAskJiminnyReportData(array $data, User $user): array\n {\n // Validate name\n $name = trim($data['report_name'] ?? '');\n if (empty($name)) {\n throw new InvalidArgumentException('Report name is required');\n }\n if (mb_strlen($name) > 50) {\n throw new InvalidArgumentException('Report name must be 50 characters or less');\n }\n\n // Validate frequency (only daily, weekly, monthly for Ask Jiminny)\n $frequency = $data['frequency'] ?? null;\n $askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];\n if (! in_array($frequency, $askJiminnyFrequencies, true)) {\n throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');\n }\n\n // Validate expiration date\n $expiresAt = $data['expires_on'] ?? null;\n if (empty($expiresAt)) {\n throw new InvalidArgumentException('Expiration date is required');\n }\n\n try {\n $expiresAtDate = Carbon::parse($expiresAt);\n } catch (InvalidFormatException $e) {\n throw new InvalidArgumentException('Expiration date format is invalid');\n }\n $maxExpiration = Carbon::now()->addYear()->endOfDay();\n if ($expiresAtDate->gt($maxExpiration)) {\n throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');\n }\n if ($expiresAtDate->isPast()) {\n throw new InvalidArgumentException('Expiration date cannot be in the past');\n }\n\n // Validate saved search\n $activitySearchId = $data['saved_search'] ?? null;\n if (empty($activitySearchId)) {\n throw new InvalidArgumentException('Saved search is required');\n }\n $savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);\n if (! $savedSearch) {\n throw new InvalidArgumentException('Saved search not found or does not belong to you');\n }\n\n // Validate saved prompt\n $askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;\n if (empty($askAnythingPromptId)) {\n throw new InvalidArgumentException('Ask Jiminny prompt is required');\n }\n $prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);\n if (! $prompt) {\n throw new InvalidArgumentException('Ask Jiminny prompt not found');\n }\n\n // Validate status\n $status = $data['enabled'] ?? false;\n\n $recipientUserIds = [$user->getId()];\n\n if (! empty($data['share_users'])) {\n $sharedUserIds = $this->validateAndGetUserIdsByTeam(\n $user->team,\n (array) $data['share_users']\n );\n $recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);\n }\n\n $sharedGroupIds = [];\n if (! empty($data['share_teams'])) {\n $sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);\n }\n\n $recipientUserIds = array_values(array_unique($recipientUserIds));\n\n return [\n 'team_id' => $user->getTeamId(),\n 'type' => self::TYPE_ASK_JIMINNY,\n 'status' => (bool) $status,\n 'frequency' => $frequency,\n 'custom_name' => $name,\n 'activity_search_id' => $savedSearch->getId(),\n 'ask_anything_prompt_id' => $prompt->getId(),\n 'expires_at' => $expiresAtDate->toDateString(),\n 'media_types' => [self::MEDIA_TYPE_PDF],\n 'call_types' => [],\n 'recipients' => ['users' => $recipientUserIds],\n 'groups' => $sharedGroupIds,\n ];\n }\n\n public static function getAskJiminnyFrequencies(): array\n {\n return array_map(static function ($frequency) {\n return $frequency['id'];\n }, self::ASK_JIMINNY_FREQUENCIES);\n }\n\n public function getAskJiminnyReportFilters(User $user): array\n {\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n return [\n [\n 'id' => 'prompt',\n 'label' => 'Prompt',\n 'options' => $prompts,\n ],\n [\n 'id' => 'saved_search',\n 'label' => 'Saved Search',\n 'options' => $savedSearches,\n ],\n ];\n }\n\n public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array\n {\n $team = $user->getTeam();\n $userTimezone = $user->getTimezone();\n\n $savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)\n ->map(fn (Search $search) => [\n 'id' => $search->getUuid(),\n 'name' => $search->getName(),\n ])\n ->values()->all();\n\n $prompts = collect(\n $this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)\n )->map(fn (AskAnythingPromptDto $prompt) => [\n 'id' => $prompt->id,\n 'name' => $prompt->title,\n ])->values()->all();\n\n $teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [\n 'id' => $group->getUuid(),\n 'name' => $group->getName(),\n ])->values()->all();\n\n $shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];\n\n $sharedTeamsValue = [];\n $sharedUsersValue = [];\n if ($report) {\n $sharedTeamsValue = $this->transformGroups($team, $report->getGroups());\n\n $recipientUserIds = $report->getRecipients()['users'] ?? [];\n $creatorId = $report->getAttribute('created_by');\n $sharedUserIds = array_values(array_filter(\n $recipientUserIds,\n static fn ($id) => $id !== $creatorId\n ));\n $sharedUsersValue = collect($sharedUserIds)\n ->map(fn ($id) => $this->userRepository->find((int) $id))\n ->filter()\n ->map(fn (User $u) => [\n 'id' => $u->getUuid(),\n 'name' => $u->getName(),\n ])\n ->values()\n ->all();\n }\n\n return [\n 'fields' => [\n [\n 'id' => 'enabled',\n 'inputType' => InputTypeEnum::TOGGLE,\n 'label' => '',\n 'value' => $report?->getStatus() ?? false,\n ],\n [\n 'id' => 'report_name',\n 'inputType' => InputTypeEnum::TEXT,\n 'label' => 'Name',\n 'placeholder' => 'Enter name',\n 'required' => true,\n 'validation' => ['maxLength' => 50],\n 'value' => $report?->getCustomName() ?? '',\n ],\n [\n 'id' => 'frequency',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Frequency',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => self::ASK_JIMINNY_FREQUENCIES,\n 'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,\n ],\n [\n 'id' => 'expires_on',\n 'inputType' => InputTypeEnum::DATE,\n 'label' => 'Expires on',\n 'required' => true,\n 'placeholder' => 'Select',\n 'validation' => [\n 'minDate' => now($userTimezone)->toDateString(),\n 'maxDate' => now($userTimezone)->addYear()->toDateString(),\n ],\n 'value' => $report?->getExpiresAt()?->toDateString(),\n ],\n [\n 'id' => 'share_teams',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team',\n 'required' => false,\n 'placeholder' => 'Select',\n 'options' => $teamGroups,\n 'value' => $sharedTeamsValue,\n ],\n [\n 'id' => 'share_users',\n 'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,\n 'label' => 'Team member',\n 'required' => false,\n 'placeholder' => 'Select',\n 'groupLabelKey' => 'label',\n 'groupValuesKey' => 'users',\n 'optionLabelKey' => 'name',\n 'optionValueKey' => 'id',\n 'options' => $shareUsers,\n 'value' => $sharedUsersValue,\n ],\n [\n 'id' => 'saved_search',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Saved search',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $savedSearches,\n 'value' => $report && $report->getSavedSearch() ? [\n 'id' => $report->getSavedSearch()->getUuid(),\n 'name' => $report->getSavedSearch()->getName(),\n ] : null,\n ],\n [\n 'id' => 'ask_jiminny_prompt',\n 'inputType' => InputTypeEnum::DROPDOWN,\n 'label' => 'Ask Jiminny prompt',\n 'required' => true,\n 'placeholder' => 'Select',\n 'options' => $prompts,\n 'value' => $report && $report->getAskAnythingPrompt() ? [\n 'id' => $report->getAskAnythingPrompt()->getUuid(),\n 'name' => $report->getAskAnythingPrompt()->getTitle(),\n ] : null,\n ],\n ],\n ];\n }\n\n private function updateResultNames(AutomatedReport $automatedReport): void\n {\n $results = $this->automatedReportsRepository->getResultsByReport($automatedReport);\n\n foreach ($results as $result) {\n $result->update(['name' => $this->getReportFileName($result)]);\n }\n }\n\n public function updateStatus(string $uuid, array $data): array\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $automatedReport->update([\n 'status' => $status,\n ]);\n\n $this->generateOneOffReport($automatedReport);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n private function generateOneOffReport(AutomatedReport $automatedReport): void\n {\n // the scheduler handles all the other frequency types\n if ($automatedReport->getStatus() === false || $automatedReport->getFrequency() !== self::FREQUENCY_ONE_OFF) {\n return;\n }\n\n $this->dispatcher->dispatch(new RequestGenerateReportJob($automatedReport->getUuid()));\n }\n\n public function getReport(string $uuid): AutomatedReport\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n return $automatedReport;\n }\n\n public function get(string $uuid): array\n {\n $automatedReport = $this->getReport($uuid);\n\n return $this->transformReportFullView($automatedReport);\n }\n\n public function list(string $sortColumn = 'created_at', string $sortDirection = 'desc'): array\n {\n $results = [];\n $collection = $this->automatedReportsRepository->getAllStandardReports($sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function listAskJiminnyReports(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): array {\n $results = [];\n $collection = $this->automatedReportsRepository->getAskJiminnyReportsByUser($user, $sortColumn, $sortDirection);\n\n /** @var AutomatedReport $report */\n foreach ($collection as $report) {\n $results[] = $this->transformReportFullView($report);\n }\n\n return ['data' => $results];\n }\n\n public function delete(string $uuid): void\n {\n $automatedReport = $this->automatedReportsRepository->findByUuid($uuid);\n\n if (! $automatedReport) {\n throw new ModelNotFoundException('Report not found');\n }\n\n $automatedReport->delete();\n }\n\n public function createReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n return $this->automatedReportsRepository->createResult(\n array_merge(\n [\n 'report_id' => $automatedReport->getId(),\n 'status' => AutomatedReportResult::STATUS_DEFAULT,\n ],\n $data\n )\n );\n }\n\n public function getOrCreateReportResult(AutomatedReport $automatedReport, array $data = []): AutomatedReportResult\n {\n $existing = $this->automatedReportsRepository->findLatestDefaultOrFailedResult($automatedReport);\n\n if ($existing !== null) {\n $existing->update(['status' => AutomatedReportResult::STATUS_DEFAULT]);\n\n return $existing;\n }\n\n return $this->createReportResult($automatedReport, $data);\n }\n\n public function getReportResult(string $resultUuid): AutomatedReportResult\n {\n $report = $this->automatedReportsRepository->findResultByUuid($resultUuid);\n\n if (! $report) {\n throw new ModelNotFoundException('Report Result not found');\n }\n\n return $report;\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return $this->automatedReportsRepository->findChildResult($result, $type);\n }\n\n // prophet API calls\n /**\n * @throws ApplicationException\n */\n public function getGenerateReportPayload(AutomatedReport $automatedReport, string $reportResultUuid): array\n {\n $period = $this->calculateFromAndToDate($automatedReport);\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n return [\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResultUuid,\n 'report_type' => $automatedReport->getType(),\n 'media_types' => $automatedReport->getMediaTypes(),\n 'from_date' => $fromDate->startOfDay()->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->endOfDay()->format(DateTimeInterface::RFC3339),\n 'group_ids' => $automatedReport->getGroups(),\n 'call_deal_stage' => $automatedReport->getDealAtCallStages(),\n 'current_deal_stage' => $automatedReport->getCurrentDealStages(),\n 'deal_min_value' => $automatedReport->getDealValueMin(),\n 'deal_max_value' => $automatedReport->getDealValueMax(),\n 'call_types' => $automatedReport->getCallTypes(),\n 'call_duration_min_seconds' => $automatedReport->getCallDurationMin(),\n 'call_duration_max_seconds' => $automatedReport->getCallDurationMax(),\n 'special_requirements' => $automatedReport->getAdditionalPromptInput(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->formatReportPeriodName(\n $automatedReport->getFrequency(),\n $fromDate,\n $toDate,\n ),\n 'playbook_categories' => $automatedReport->getPlaybookCategories(),\n 'custom_name' => $automatedReport->getCustomName(),\n ];\n }\n\n // $inputPayload - FE payload structure\n public function getActivitiesCountPayload(array $inputPayload): array\n {\n // Use validateAndTransformData to validate and normalize input\n $validatedData = $this->validateAndTransformData($inputPayload);\n $period = $this->calculateFromAndToDatePeriod(\n $validatedData['frequency'],\n Carbon::parse($validatedData['from']),\n Carbon::parse($validatedData['to']),\n );\n $fromDate = $period['fromDate'];\n $toDate = $period['toDate'];\n\n // Create payload similar to getGenerateReportPayload\n return [\n 'team_id' => $validatedData['team_id'],\n 'group_ids' => $validatedData['groups'] ?? [],\n 'report_type' => $validatedData['type'],\n 'from_date' => $fromDate->format(DateTimeInterface::RFC3339),\n 'to_date' => $toDate->format(DateTimeInterface::RFC3339),\n 'call_deal_stage' => $validatedData['deal_at_call_stages'] ?? [],\n 'current_deal_stage' => $validatedData['current_deal_stages'] ?? [],\n 'deal_min_value' => $validatedData['deal_value_min'] ?? null,\n 'deal_max_value' => $validatedData['deal_value_max'] ?? null,\n 'call_types' => $validatedData['call_types'],\n 'call_duration_min_seconds' => $validatedData['call_duration_min'] ?? null,\n 'call_duration_max_seconds' => $validatedData['call_duration_max'] ?? null,\n 'special_requirements' => $validatedData['additional_prompt_input'] ?? null,\n 'playbook_categories' => $validatedData['playbook_categories'] ?? [],\n 'request_id' => null,\n 'callback_url' => null,\n ];\n }\n\n public function shouldSendReport(array $users, ?CarbonInterface $generatedAt = null): bool\n {\n if (empty($users)) {\n return false;\n }\n\n $earliestTz = collect($users)\n ->mapWithKeys(function (array $user) {\n $tz = new DateTimeZone($user['timezone']);\n $nowUtc = new DateTime('now', new DateTimeZone('UTC'));\n $offset = $tz->getOffset($nowUtc);\n\n return [$user['timezone'] => $offset];\n })\n ->sortDesc()\n ->keys()\n ->first();\n\n $now = Carbon::now($earliestTz);\n $isScheduledTime = (int) $now->format('H') === self::SENT_REPORT_AT_HOURS;\n\n if ($isScheduledTime) {\n return true;\n }\n\n return $this->hasPassedScheduledTime($generatedAt, $earliestTz);\n }\n\n public function hasPassedScheduledTime(?CarbonInterface $generatedAt, string $timezone): bool\n {\n if ($generatedAt === null) {\n return false;\n }\n\n $now = Carbon::now($timezone);\n $scheduledTime = $now->copy()->setTime(self::SENT_REPORT_AT_HOURS, 0, 0);\n\n if ($now->hour < self::SENT_REPORT_AT_HOURS) {\n $scheduledTime = $scheduledTime->subDay();\n }\n\n $scheduledTimeUtc = $scheduledTime->copy()->utc();\n $generatedAtUtc = $generatedAt->copy()->utc();\n $nowUtc = $now->copy()->utc();\n\n return $generatedAtUtc->lt($scheduledTimeUtc) && $nowUtc->gt($scheduledTimeUtc);\n }\n\n public function calculateFromAndToDatePeriod(\n string $frequency,\n ?Carbon $fromDate = null,\n ?Carbon $toDate = null\n ): array {\n if ($frequency === self::FREQUENCY_ONE_OFF) {\n return [\n 'fromDate' => $fromDate,\n 'toDate' => $toDate,\n ];\n }\n\n $now = Carbon::now();\n\n return match ($frequency) {\n self::FREQUENCY_DAILY => [\n 'fromDate' => $now->copy()->subDay()->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_WEEKLY => [\n 'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_MONTHLY => [\n 'fromDate' => $now->copy()->subMonths(1)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n self::FREQUENCY_QUARTERLY => [\n 'fromDate' => $now->copy()->subMonths(3)->startOfDay(),\n 'toDate' => $now->copy()->subDay()->endOfDay(),\n ],\n default => throw new InvalidArgumentException(\"Unsupported frequency: {$frequency}\"),\n };\n }\n\n private function calculateFromAndToDate(AutomatedReport $automatedReport): array\n {\n return $this->calculateFromAndToDatePeriod(\n $automatedReport->getFrequency(),\n $automatedReport->getFrom(),\n $automatedReport->getTo()\n );\n }\n\n public function getAskJiminnyGenerateReportPayload(\n AutomatedReport $automatedReport,\n AutomatedReportResult $reportResult,\n array $activityIds,\n ): array {\n return [\n 'user_question' => $automatedReport->getAskAnythingPrompt()?->getContent(),\n 'call_ids' => array_map('strval', $activityIds),\n 'team_id' => $automatedReport->getTeamId(),\n 'request_id' => $reportResult->getUuid(),\n 'callback_url' => $this->getCallbackUrl(),\n 'report_period' => $this->getReportPeriodName($reportResult),\n 'report_name' => $automatedReport->getCustomName(),\n ];\n }\n\n private function getCallbackUrl(): string\n {\n return $this->webhookService->route('jiminny.webhook.reports.ready');\n }\n\n /**\n * Validate and transform payload data for automated reports\n *\n * @param array $data\n *\n * @throws InvalidArgumentException\n *\n * @return array\n */\n private function validateAndTransformData(array $data): array\n {\n // Validate organization (team) and check feature\n $team = $this->validateOrganization($data['organization'] ?? null);\n\n $status = $this->validateReportStatus($data['report_enabled'] ?? null);\n $type = $this->validateReportType($data['report_type'] ?? null);\n $frequency = $this->validateFrequency($data['frequency'] ?? null);\n $additionalPromptInput = $this->validateAdditionalPromptInput(\n $data['additional_prompt_input'] ?? null\n );\n $customReportName = $this->validateCustomReportName($data['custom_name'] ?? null);\n\n // Prepare data for the database\n $reportData = [\n 'team_id' => $team->getId(),\n 'type' => $type,\n 'status' => $status,\n 'frequency' => $frequency,\n 'additional_prompt_input' => $additionalPromptInput,\n 'custom_name' => $customReportName,\n ];\n\n // Validate deal values\n $reportData = $this->validateDealValues($data, $reportData);\n\n // Validate date range\n $reportData = $this->validateDateRange($data, $reportData, $frequency);\n\n // Validate call durations\n $reportData = $this->validateCallDurations($data, $reportData);\n\n // Validate call types\n $reportData = $this->validateCallTypes($data, $reportData);\n\n // Validate media types\n $reportData = $this->validateMediaTypes($data, $reportData);\n\n // Validate groups\n if (isset($data['teams'])) {\n $reportData['groups'] = $this->validateAndGetGroupIds($team, $data['teams']);\n }\n\n // Validate deal stages\n $reportData = $this->validateDealStages($data, $reportData, $team, $type);\n\n // Validate playbook categories\n $reportData = $this->validatePlaybookCategories($data, $reportData, $team);\n\n // Validate recipients\n $reportData['recipients'] = [\n 'users' => $this->validateAndGetUserIdsByTeam($team, $data['recipients'] ?? []),\n ];\n\n if (isset($data['jiminny_recipients'])) {\n // Validate Jiminny recipients\n $reportData['jiminny_recipients'] = [\n 'users' => $this->validateAndGetJiminnyUserIds((array) $data['jiminny_recipients']),\n ];\n }\n\n return $reportData;\n }\n\n private function validateDealValues(array $data, array $reportData): array\n {\n if (isset($data['min_deal_value'])) {\n $reportData['deal_value_min'] = (int) $data['min_deal_value'];\n\n if ($reportData['deal_value_min'] > 4294967295 || $reportData['deal_value_min'] < 0) {\n throw new InvalidArgumentException('Min deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_deal_value'])) {\n $reportData['deal_value_max'] = (int) $data['max_deal_value'];\n\n if ($reportData['deal_value_max'] > 4294967295 || $reportData['deal_value_max'] < 0) {\n throw new InvalidArgumentException('Max deal value should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['min_deal_value'], $data['max_deal_value'])\n && $data['min_deal_value'] > $data['max_deal_value']\n ) {\n throw new InvalidArgumentException('Min deal value cannot be greater than max deal value');\n }\n\n return $reportData;\n }\n\n private function validateDateRange(array $data, array $reportData, string $frequency): array\n {\n // Set date range only for one_off frequency\n if ($frequency === 'one_off') {\n if (isset($data['start_date_period'])) {\n $reportData['from'] = $this->parseDate($data['start_date_period']);\n }\n\n if (isset($data['end_date_period'])) {\n $reportData['to'] = $this->parseDate($data['end_date_period']);\n }\n\n if (empty($reportData['from']) || empty($reportData['to'])) {\n throw new InvalidArgumentException(\n 'Start date and end date are required for one_off frequency'\n );\n }\n } else {\n $reportData['from'] = null;\n $reportData['to'] = null;\n }\n\n return $reportData;\n }\n\n private function validateCallDurations(array $data, array $reportData): array\n {\n // Convert call durations from minutes to seconds\n if (isset($data['min_call_duration'])) {\n $reportData['call_duration_min'] = (int) $data['min_call_duration'] * 60;\n\n if ($reportData['call_duration_min'] > 4294967295 || $reportData['call_duration_min'] < 0) {\n throw new InvalidArgumentException('Min call duration should be between 0 and 4294967295');\n }\n }\n\n if (isset($data['max_call_duration'])) {\n $reportData['call_duration_max'] = (int) $data['max_call_duration'] * 60;\n\n if ($reportData['call_duration_max'] > 4294967295 || $reportData['call_duration_max'] < 0) {\n throw new InvalidArgumentException('Max call duration should be between 0 and 4294967295');\n }\n }\n\n return $reportData;\n }\n\n private function validateCallTypes(array $data, array $reportData): array\n {\n // Set call types\n $reportData['call_types'] = $data['call_type'] ?? [];\n if (empty($reportData['call_types'])) {\n $reportData['call_types'] = self::getCallTypes();\n }\n\n foreach ($reportData['call_types'] as $callType) {\n if (! in_array($callType, self::getCallTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Call type %s is invalid', $callType));\n }\n }\n\n return $reportData;\n }\n\n private function validateMediaTypes(array $data, array $reportData): array\n {\n // Set media types from input data\n $reportData['media_types'] = $data['media_types'] ?? [];\n\n if (empty($reportData['media_types'])) {\n throw new InvalidArgumentException('Media types are required');\n }\n\n foreach ($reportData['media_types'] as $mediaType) {\n if (! in_array($mediaType, self::MEDIA_TYPES, true)) {\n throw new InvalidArgumentException(sprintf('Media type %s is invalid', $mediaType));\n }\n }\n\n return $reportData;\n }\n\n private function validateDealStages(array $data, array $reportData, Team $team, string $reportType): array\n {\n // Validate and set deal stages\n if (isset($data['deal_stage_at_call'])) {\n $reportData['deal_at_call_stages'] =\n $this->validateAndGetDealStageIds($team, $data['deal_stage_at_call'], 'Deal stage at call');\n }\n\n if (isset($data['current_deal_stage'])) {\n $reportData['current_deal_stages'] =\n $this->validateAndGetDealStageIds($team, $data['current_deal_stage'], 'Current deal stage');\n }\n\n // Ensure current_deal_stage is not provided for loss_analysis report type\n if ($reportType === self::TYPE_LOSS_ANALYSIS && ! empty($data['current_deal_stage'])) {\n throw new InvalidArgumentException('Current deal stage is not applicable for Loss Analysis reports');\n }\n\n return $reportData;\n }\n\n // transform uuid to id\n private function validatePlaybookCategories(array $data, array $reportData, Team $team): array\n {\n $key = 'playbook_categories';\n\n if (isset($data[$key])) {\n $payloadIds = $data[$key];\n $ids = [];\n\n foreach ($payloadIds as $uuid) {\n $uuid = (string) $uuid;\n\n try {\n $playbookCategory = $this->playbookCategoryRepository->findByUuid($uuid);\n } catch (Throwable $throwable) {\n Log::error(__METHOD__ . ' ' . $throwable->getMessage());\n\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory) {\n throw new InvalidArgumentException(sprintf('Playbook category %s not found', $uuid));\n }\n\n if (! $playbookCategory->hasPlaybook()) {\n throw new InvalidArgumentException(sprintf('Playbook category %s has no playbook', $uuid));\n }\n\n if ($playbookCategory->getPlaybook()->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Playbook category %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $ids[] = $playbookCategory->getId();\n }\n\n $reportData[$key] = $ids;\n }\n\n return $reportData;\n }\n\n private function validateReportStatus($status): bool\n {\n if (! in_array($status, [true, false], true)) {\n throw new InvalidArgumentException('Report status is invalid');\n }\n\n return $status;\n }\n\n private function validateReportType($type): string\n {\n if (! in_array($type, self::getTypes(), true)) {\n throw new InvalidArgumentException(sprintf('Report type is invalid: %s', $type));\n }\n\n return $type;\n }\n\n private function validateFrequency($frequency): string\n {\n if (! in_array($frequency, self::getFrequencies(), true)) {\n throw new InvalidArgumentException('Frequency is invalid');\n }\n\n return $frequency;\n }\n\n private function validateAdditionalPromptInput(?string $additionalPromptInput): ?string\n {\n if ($additionalPromptInput && strlen($additionalPromptInput) > 5000) {\n throw new InvalidArgumentException('Additional Prompt Input should be less than 5000 characters');\n }\n\n return $additionalPromptInput;\n }\n\n private function validateCustomReportName(?string $customReportName): ?string\n {\n if ($customReportName === null || $customReportName === '') {\n return null;\n }\n\n if (strlen($customReportName) > 70) {\n throw new InvalidArgumentException('Custom report name should be less than 70 characters');\n }\n\n return $customReportName;\n }\n\n private function validateOrganization(?string $organizationUuid): Team\n {\n if (! $organizationUuid) {\n throw new InvalidArgumentException('Organization is required');\n }\n\n $team = $this->teamRepository->idOrUuid($organizationUuid);\n\n if (! $team) {\n throw new InvalidArgumentException('Organization not found');\n }\n\n if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {\n throw new InvalidArgumentException('Organization does not have the Automated Reports feature');\n }\n\n return $team;\n }\n\n private function validateAndGetGroupIds(Team $team, array $teamUuids): array\n {\n $groupIds = [];\n\n foreach ($teamUuids as $uuid) {\n $group = $this->groupRepository->findByUuid($uuid);\n\n if ($group === null || $group->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Group %s not found for team %s', $uuid, $team->getUuid())\n );\n }\n\n $groupIds[] = $group->getId();\n\n }\n\n return $groupIds;\n }\n\n private function validateAndGetDealStageIds(Team $team, array $stageUuids, string $propertyLabel): array\n {\n $stageIds = [];\n\n foreach ($stageUuids as $uuid) {\n $stage = $this->stageRepository->findByUuid($uuid);\n\n if ($stage === null || $stage->getTeamId() !== $team->getId()) {\n throw new InvalidArgumentException(\n sprintf('Stage %s not found for team %s for %s', $uuid, $team->getUuid(), $propertyLabel)\n );\n }\n\n $stageIds[] = $stage->getId();\n }\n\n return $stageIds;\n }\n\n private function validateAndGetUserIds(array $userUuids, callable $teamCheck): array\n {\n if (empty($userUuids)) {\n return [];\n }\n\n $userIds = [];\n\n foreach ($userUuids as $uuid) {\n $user = $this->userRepository->findByUuid($uuid);\n\n if (! $user || ! $user->isStatusActive()) {\n throw new InvalidArgumentException(\n sprintf('User %s not found or is not active', $uuid)\n );\n }\n\n if (! $teamCheck($user)) {\n throw new InvalidArgumentException(\n sprintf('User %s does not belong to the allowed team(s)', $uuid)\n );\n }\n\n $userIds[] = $user->getId();\n }\n\n return $userIds;\n }\n\n private function validateAndGetUserIdsByTeam(Team $team, array $userUuids): array\n {\n return $this->validateAndGetUserIds($userUuids, fn ($user) => $user->getTeamId() === $team->getId());\n }\n\n private function validateAndGetJiminnyUserIds(array $userUuids): array\n {\n $allowedTeamIds = config('kiosk.teamIds', []);\n\n return $this->validateAndGetUserIds($userUuids, fn ($user) => in_array($user->getTeamId(), $allowedTeamIds, true));\n }\n\n private function parseDate(string $dateString): string\n {\n return date('Y-m-d H:i:s', strtotime($dateString));\n }\n\n private function generateReportResultViewUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.view', ['uuid' => $result->getUuid()]);\n }\n\n private function generateReportResultDownloadUrl(AutomatedReportResult $result): string\n {\n $mediaResource = $this->getReportMediaRouteResource($result);\n\n return route('ai-reports.' . $mediaResource . '.download', ['uuid' => $result->getUuid()]);\n }\n\n private function getReportMediaRouteResource(AutomatedReportResult $result): string\n {\n if ($result->getMediaType() === self::MEDIA_TYPE_PDF) {\n return self::PDF_KEY;\n } elseif ($result->getMediaType() === self::MEDIA_TYPE_PODCAST) {\n return self::AUDIO_KEY;\n }\n\n throw new \\InvalidArgumentException('Unknown media type.');\n }\n\n public function getMediaPath(AutomatedReportResult $result): ?string\n {\n $url = match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => $result->getPdfUrl(),\n self::MEDIA_TYPE_PODCAST => $result->getPodcastAudioUrl(),\n default => null,\n };\n\n if ($url === null) {\n return null;\n }\n\n $path = parse_url(trim($url, '\"\\''), PHP_URL_PATH);\n\n return $path ?: null;\n }\n\n public function getFilenameSuffix(AutomatedReportResult $result): ?string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => 'Podcast',\n default => null,\n };\n }\n\n public function getMailSubjectSuffix(AutomatedReportResult $result): string\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PDF => 'report',\n self::MEDIA_TYPE_PODCAST => 'podcast',\n default => '',\n };\n }\n\n public function getMediaTypeMetadata(AutomatedReportResult $result): array\n {\n return match ($result->getMediaType()) {\n self::MEDIA_TYPE_PODCAST => ['extension' => 'mp3', 'mime' => 'audio/mpeg'],\n self::MEDIA_TYPE_PDF => ['extension' => 'pdf', 'mime' => 'application/pdf'],\n default => ['extension' => null, 'mime' => null],\n };\n }\n\n public function deleteS3Files(AutomatedReportResult $result): void\n {\n $teamUuid = $result->getReport()->getTeam()->getUuid();\n $reportUuid = $result->getUuid();\n\n // delete all files for a report uuid no mather of pdf, podcast, or both\n // in case of both - the podcast files are linked to the pdf (parent) uuid\n // pdf and podcast date times should be close\n $path = sprintf('%s/%s/%s', $teamUuid, self::S3_DIR, $reportUuid);\n\n foreach (self::FILE_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted S3 file', [\n 'path' => $file,\n ]);\n }\n }\n\n foreach (self::FILE_PODCAST_EXTENSIONS_VARIANTS as $extension) {\n $file = $path . '_podcast.' . $extension;\n\n if (Storage::exists($file)) {\n Storage::delete($file);\n Log::info('[Reports] Deleted Podcast S3 file', [\n 'path' => $file,\n ]);\n }\n }\n }\n\n /**\n *\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): Collection\n {\n return $this->automatedReportsRepository->getTeamIdsWithReportsResults($teamId);\n }\n\n /**\n * Core delete logic for report results using a query\n *\n * @param Builder $query\n * @param array $logContext\n *\n * @return int\n */\n private function deleteReportResultsByQuery(Builder $query, array $logContext = []): int\n {\n $deletedCount = 0;\n\n if ($query->exists()) {\n Log::info(\n 'Run delete report results',\n array_merge(\n $logContext,\n [\n 'service' => 'AutomatedReportsService',\n ]\n )\n );\n\n $query->chunkById(50, function ($results) use (&$deletedCount, $logContext) {\n foreach ($results as $result) {\n $this->deleteReportResult($result);\n $deletedCount++;\n\n Log::info(\n 'Deleted a report result',\n array_merge(\n $logContext,\n [\n 'result_id' => $result->getId(),\n 'report_id' => $result->getReportId(),\n ]\n )\n );\n }\n });\n }\n\n return $deletedCount;\n }\n\n /**\n * Delete report results for a team by retention period\n *\n * @param Team $team\n * @param CarbonImmutable $retentionDate\n *\n * @return int Number of deleted report results\n */\n public function deleteReportsResultsInRetentionPeriod(Team $team, CarbonImmutable $retentionDate): int\n {\n $reportIds = $this->automatedReportsRepository->getReportIdsByTeam($team);\n\n if ($reportIds->isEmpty()) {\n return 0;\n }\n\n $query = $this->automatedReportsRepository\n ->getReportResultsQueryForRetention($team, $retentionDate);\n\n return $this->deleteReportResultsByQuery($query, [\n 'team_id' => $team->getId(),\n 'retention_date' => $retentionDate->toDateTimeString(),\n ]);\n }\n\n /**\n * Delete ALL report results for a specific automated report\n *\n * @param string $uuid\n *\n * @return int\n */\n public function deleteReportResults(string $uuid): int\n {\n $report = $this->getReport($uuid);\n\n $query = $this->automatedReportsRepository->getResultsByReportQuery($report);\n\n return $this->deleteReportResultsByQuery($query, [\n 'report_uuid' => $uuid,\n 'report_id' => $report->getId(),\n ]);\n }\n\n public function deleteReportResult(AutomatedReportResult $result): void\n {\n $this->deleteS3Files($result);\n\n $result->delete();\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getTeamReports(Team $team): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getReportsByTeam($team);\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return \\Illuminate\\Database\\Eloquent\\Collection\n */\n public function getReportResults(AutomatedReport $report): \\Illuminate\\Database\\Eloquent\\Collection\n {\n return $this->automatedReportsRepository->getResultsByReport($report);\n }\n\n public function deleteAllReportResults(AutomatedReport $report): void\n {\n $results = $this->getReportResults($report);\n\n /** @var AutomatedReportResult $result */\n foreach ($results as $result) {\n Log::info('Deleting result', [\n 'report' => $report->getId(),\n 'result' => $result->getId(),\n ]);\n\n $this->deleteReportResult($result);\n }\n }\n\n public function deleteAllData(Team $team): void\n {\n Log::info('Deleting automated report and results for team', [\n 'team' => $team->getId(),\n ]);\n\n $reports = $this->getTeamReports($team);\n\n /** @var AutomatedReport $report */\n foreach ($reports as $report) {\n Log::info('Deleting report', [\n 'team' => $team->getId(),\n 'report' => $report->getId(),\n ]);\n\n $this->deleteAllReportResults($report);\n\n $report->delete();\n }\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
-5439226101732026402
|
1126710648141684156
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsServiceTest
Run 'AutomatedReportsServiceTest'
Debug 'AutomatedReportsServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
102
3
34
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Kiosk\AutomatedReports;
use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Carbon\Exceptions\InvalidFormatException;
use DateTime;
use DateTimeInterface;
use DateTimeZone;
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcher;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Jiminny\Component\ActivitySearch\FilterDefinition\InputTypeEnum;
use Jiminny\Component\AskAnything\AskAnythingPromptService;
use Jiminny\Component\AskAnything\Dtos\AskAnythingPromptDto;
use Jiminny\Component\UrlGenerator\Webhook;
use Jiminny\Contracts\Repositories\PlaybookCategoryRepository;
use Jiminny\Contracts\Repositories\TeamRepository;
use Jiminny\Contracts\Repositories\UserRepository;
use Jiminny\Exceptions\ApplicationException;
use Jiminny\Exceptions\InvalidArgumentException;
use Jiminny\Exceptions\ModelNotFoundException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateReportJob;
use Jiminny\Models\Activity\Search;
use Jiminny\Models\AskAnything\AskAnythingPrompt;
use Jiminny\Models\AskAnything\AskAnythingPromptTarget;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Contracts\UserContract;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AskAnythingRepository;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Repositories\GroupRepository;
use Jiminny\Repositories\SearchRepository;
use Jiminny\Repositories\StageRepository;
use Throwable;
class AutomatedReportsService
{
public const string TYPE_LOSS_ANALYSIS = 'loss_analysis';
public const string TYPE_ASK_JIMINNY = 'ask_jiminny';
/**
* Standard report types (used by kiosk for existing automated reports).
*/
// @TODO this will add filter, however if we need to control feature by FF we need conditional logic
public const array TYPES = [
['id' => 'exec_summary', 'name' => 'Exec Summary'],
['id' => 'coaching_profiles', 'name' => 'Coaching Profiles'],
['id' => 'product_feedback', 'name' => 'Product Feedback'],
['id' => self::TYPE_LOSS_ANALYSIS, 'name' => 'Loss Analysis'],
// ['id' => 'questions', 'name' => 'Questions'],
// ['id' => 'statistical_quant', 'name' => 'Statistical Quantitative'],
];
public const array ALL_TYPES = [
...self::TYPES,
['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'],
];
public const string FREQUENCY_DAILY = 'daily';
public const string FREQUENCY_WEEKLY = 'weekly';
public const string FREQUENCY_MONTHLY = 'monthly';
public const string FREQUENCY_QUARTERLY = 'quarterly';
public const string FREQUENCY_ONE_OFF = 'one_off';
/**
* Frequencies for standard (non-Ask Jiminny) reports.
*/
public const array FREQUENCIES = [
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
/**
* Frequencies for Ask Jiminny reports.
*/
public const array ASK_JIMINNY_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
];
public const string MEDIA_TYPE_PDF = 'pdf';
public const string MEDIA_TYPE_PODCAST = 'podcast';
public const array MEDIA_TYPES = [self::MEDIA_TYPE_PDF, self::MEDIA_TYPE_PODCAST];
public const array MEDIA_TYPE_OBJECT_PDF = ['id' => self::MEDIA_TYPE_PDF, 'name' => 'PDF'];
public const array MEDIA_TYPE_OBJECT_PODCAST = ['id' => self::MEDIA_TYPE_PODCAST, 'name' => 'Podcast'];
public const array MEDIA_TYPE_OBJECTS = [self::MEDIA_TYPE_OBJECT_PDF, self::MEDIA_TYPE_OBJECT_PODCAST];
public const array CALL_TYPE_CONFERENCE = ['id' => 'conference', 'name' => 'Conference'];
public const array CALL_TYPE_DIALER = ['id' => 'dialer', 'name' => 'Dialer'];
public const int SENT_REPORT_AT_HOURS = 5;
public const string PDF_KEY = 'pdf';
public const string AUDIO_KEY = 'audio';
private const array ALL_FREQUENCIES = [
['id' => self::FREQUENCY_DAILY, 'name' => 'Daily'],
['id' => self::FREQUENCY_WEEKLY, 'name' => 'Weekly'],
['id' => self::FREQUENCY_MONTHLY, 'name' => 'Monthly'],
['id' => self::FREQUENCY_QUARTERLY, 'name' => 'Quarterly'],
['id' => self::FREQUENCY_ONE_OFF, 'name' => 'One-off'],
];
private const string S3_DIR = 'reports';
private const array FILE_EXTENSIONS_VARIANTS = ['html', 'MD', 'pdf'];
private const array FILE_PODCAST_EXTENSIONS_VARIANTS = ['json', 'mp3', 'ssml'];
public function __construct(
private readonly TeamRepository $teamRepository,
private readonly GroupRepository $groupRepository,
private readonly UserRepository $userRepository,
private readonly StageRepository $stageRepository,
private readonly DealStagesService $dealStagesService,
private readonly RecipientsService $recipientsService,
private readonly AutomatedReportsRepository $automatedReportsRepository,
private readonly Webhook $webhookService,
private readonly BusDispatcher $dispatcher,
private readonly ActivityTypeService $activityTypeService,
private readonly PlaybookCategoryRepository $playbookCategoryRepository,
private readonly AskAnythingPromptService $askAnythingPromptService,
private readonly SearchRepository $activitySearchRepository,
private readonly AskAnythingRepository $askAnythingRepository,
) {
}
public static function getTypes(): array
{
$types = self::TYPES;
return array_map(static function ($type) {
return $type['id'];
}, $types);
}
public static function getCallTypes(): array
{
return array_map(static function ($callType) {
return $callType['id'];
}, [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER]);
}
public static function getFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::FREQUENCIES);
}
// front-facing structure
public function getReportEnabledFieldData(bool $value = false): array
{
return [
'id' => 'report_enabled',
'label' => '',
'inputType' => InputTypeEnum::TOGGLE,
'value' => $value,
];
}
// Organizations = Teams
public function getOrganizationFieldData(?string $value = null, bool $shortVersion = false): array
{
$options = $this->getTeams();
if ($shortVersion) {
return [
'id' => 'organization',
'label' => 'Organization',
'options' => $options,
];
}
return [
'id' => 'organization',
'label' => 'Organization',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $options,
'value' => $value,
'dependencies' => [
'teams',
'deal_stage_at_call',
'current_deal_stage',
'recipients',
ActivityTypeService::PLAYBOOK_CATEGORIES_KEY,
],
'dependsOn' => [],
];
}
// Teams = Groups
public function getTeamFieldData(array $options = [], array $value = [], bool $shortVersion = false): array
{
if ($shortVersion) {
return [
'id' => 'teams',
'label' => 'Team',
'options' => $options,
];
}
return [
'id' => 'teams',
'label' => 'Team',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => false,
'placeholder' => 'Select',
'options' => $options,
'value' => $value, // value should be an array of objects {id, name}
'dependencies' => [ActivityTypeService::PLAYBOOK_CATEGORIES_KEY],
'dependsOn' => [],
];
}
public function getReportTypeFieldData(?string $value = null, bool $shortVersion = false, ?Team $team = null): array
{
$types = [];
if ($team instanceof Team) {
if ($team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
$types = self::TYPES;
}
if ($team->hasFeature(FeatureEnum::ASK_JIMINNY_REPORTS)) {
$types[] = ['id' => self::TYPE_ASK_JIMINNY, 'name' => 'Ask Jiminny'];
}
} else {
$types = self::TYPES;
}
if ($shortVersion) {
return [
'id' => 'report_type',
'label' => 'Report Type',
'options' => $types,
];
}
return [
'id' => 'report_type',
'label' => 'Report Type',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => $types,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getFrequencyFieldData(?string $value = null): array
{
return [
'id' => 'frequency',
'label' => 'Frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'required' => true,
'placeholder' => 'Select',
'options' => self::FREQUENCIES,
'value' => $value,
'dependencies' => ['period'],
'dependsOn' => [],
];
}
public function getPeriodFieldData(?string $valueStartDate = null, ?string $valueEndDate = null): array
{
return [
'id' => 'period',
'label' => 'Select one-off period',
'inputType' => InputTypeEnum::DATE_RANGE,
'required' => true,
'placeholder' => 'Select',
'value' => ['startDate' => $valueStartDate, 'endDate' => $valueEndDate],
'queryParams' => [
'startDate' => 'start_date_period',
'endDate' => 'end_date_period',
],
'dependencies' => [],
'dependsOn' => ['frequency'],
];
}
public function getActivityTypesFieldData(?Team $team = null, array $value = [], array $teamsFilter = []): array
{
return $this->activityTypeService->getActivityTypeFieldData(team: $team, value: $value, groupIds: $teamsFilter);
}
public function getDealStageAtCallFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getDealStageAtCallFieldData(team: $team, value: $value);
}
public function getCurrentDealStageFieldData(?Team $team = null, array $value = []): array
{
return $this->dealStagesService->getCurrentDealStageFieldData(team: $team, value: $value);
}
public function getDealValueFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'deal_value',
'label' => 'Deal Value',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_deal_value',
'max' => 'max_deal_value',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallTypeFieldData(bool $conferenceOn = false, bool $dialerOn = false): array
{
$value = [];
$conferenceOn && $value[] = self::CALL_TYPE_CONFERENCE;
$dialerOn && $value[] = self::CALL_TYPE_DIALER;
return [
'id' => 'call_type',
'label' => 'Call Type',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => [
self::CALL_TYPE_CONFERENCE,
self::CALL_TYPE_DIALER,
],
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getMediaTypeFieldData(?AutomatedReport $report = null): array
{
$value = [];
if ($report) {
$value = $this->transformMediaTypes($report);
}
return [
'id' => 'media_types',
'label' => 'Export as',
'inputType' => InputTypeEnum::DROPDOWN_MULTIPLE,
'required' => true,
'options' => self::MEDIA_TYPE_OBJECTS,
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCallDurationFieldData(?int $valueMin = null, ?int $valueMax = null): array
{
return [
'id' => 'call_duration',
'label' => 'Call Duration',
'inputType' => InputTypeEnum::INTEGER_RANGE,
'required' => false,
'value' => ['min' => $valueMin, 'max' => $valueMax],
'queryParams' => [
'min' => 'min_call_duration',
'max' => 'max_call_duration',
],
'dependencies' => [],
'dependsOn' => [],
];
}
public function getRecipientsFieldData(?Team $team = null, array $value = []): array
{
return $this->recipientsService->getRecipientsFieldData(team: $team, value: $value);
}
public function getJiminnyRecipientsFieldData(array $value = []): array
{
return $this->recipientsService->getJiminnyRecipientsFieldData($value);
}
public function getAdditionalPromptInputFieldData(?string $value = null): array
{
return [
'id' => 'additional_prompt_input',
'label' => 'Special requirements',
'inputType' => InputTypeEnum::TEXTAREA,
'required' => false,
'placeholder' => 'What should be the focus of the report?',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
public function getCustomReportNameFieldData(?string $value = null): array
{
return [
'id' => 'custom_name',
'label' => 'Custom report name',
'inputType' => InputTypeEnum::TEXT,
'required' => false,
'placeholder' => 'Enter custom name',
'value' => $value,
'dependencies' => [],
'dependsOn' => [],
];
}
// data providers
public function getTeams(): array
{
$teams = $this->teamRepository->getTeamsForKiosk(status: Team::STATUS_ACTIVE);
$teamData = [];
foreach ($teams as $team) {
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
continue;
}
$teamData[] = $this->transformTeam($team);
}
return $teamData;
}
public function getTeamGroups(string $teamUuid): array
{
$data = [];
$team = $this->getTeam($teamUuid);
if ($team !== null) {
$groups = $team->groups()->get();
foreach ($groups as $group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
];
}
}
return $data;
}
public function getTeamsGroupsOptions(array $filterTeamUuids = []): array
{
$data = [];
$teams = $this->getTeams();
foreach ($teams as $team) {
if (! empty($filterTeamUuids) && ! in_array($team['id'], $filterTeamUuids, true)) {
continue;
}
$data[] = [
'label' => $team['name'],
'groups' => $this->getTeamGroups($team['id']),
];
}
return $data;
}
public function getTeam(string $teamUuid): ?Team
{
return $this->teamRepository->idOrUuid($teamUuid);
}
public function getTeamById(int $teamId): ?Team
{
return $this->teamRepository->find($teamId);
}
public function getGroupsUuids(AutomatedReport $report): array
{
$uuids = [];
$reportGroups = $report->getGroups();
foreach ($reportGroups as $groupId) {
if ($group = $this->groupRepository->find($groupId)) {
$uuids[] = $group->getUuid();
}
}
return $uuids;
}
public function getPlaybookCategoriesUuids(AutomatedReport $report): array
{
$uuids = [];
$playbookCategories = $report->getPlaybookCategories();
foreach ($playbookCategories as $id) {
if ($category = $this->playbookCategoryRepository->find($id)) {
$uuids[] = $category->getUuid();
}
}
return $uuids;
}
public function getDealAtCallStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getDealAtCallStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getCurrentDealStagesUuids(AutomatedReport $report): array
{
$uuids = [];
$reportStages = $report->getCurrentDealStages();
foreach ($reportStages as $id) {
if ($stage = $this->stageRepository->find($id)) {
$uuids[] = $stage->getUuid();
}
}
return $uuids;
}
public function getUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getRecipients());
}
public function getJiminnyUsersUuids(AutomatedReport $report): array
{
return $this->extractUserUuids($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function extractUserUuids(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => $user->getUuid())
->values()
->all();
}
// get mail data
public function getRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getRecipients());
}
/**
* @return array<UserContract>
*/
public function getRecipientUserObjects(AutomatedReport $report): array
{
$userIds = $report->getRecipients()['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->values()
->all();
}
private function getJiminnyRecipientUsers(AutomatedReport $report): array
{
return $this->buildRecipientUsers($report->getJiminnyRecipients());
}
/**
* @param array<string, mixed> $recipients
*/
private function buildRecipientUsers(array $recipients): array
{
$userIds = $recipients['users'] ?? [];
return collect($userIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (UserContract $user) => [
'email' => $user->getEmailAddress(),
'name' => $user->getName(),
'timezone' => $user->getTimezone()->getName(),
])
->values()
->all();
}
public function getValidRecipientUsers(AutomatedReport $report, bool $includeJiminny = false): array
{
if ($report->isAskJiminnyReport()) {
$recipients = $this->resolveAskJiminnyRecipients($report);
} else {
$recipients = $this->getRecipientUsers($report);
if ($includeJiminny) {
$recipients = array_merge($recipients, $this->getJiminnyRecipientUsers($report));
}
}
$emails = [];
return array_values(array_filter(
$recipients,
static function ($recipient) use (&$emails) {
if (empty($recipient['email']) || in_array($recipient['email'], $emails, true)) {
return false;
}
$emails[] = $recipient['email'];
return true;
}
));
}
private function resolveAskJiminnyRecipients(AutomatedReport $report): array
{
$recipients = [];
$creator = $report->getCreator();
if ($creator !== null) {
$recipients[] = [
'email' => $creator->getEmailAddress(),
'name' => $creator->getName(),
'timezone' => $creator->getTimezone()->getName(),
];
}
return array_merge(
$recipients,
$this->buildRecipientUsers($report->getRecipients()),
$this->getGroupRecipientUsers($report),
);
}
private function getGroupRecipientUsers(AutomatedReport $report): array
{
$users = [];
foreach ($report->getGroups() as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group === null) {
continue;
}
foreach ($group->getMembers() as $member) {
$users[] = [
'email' => $member->getEmailAddress(),
'name' => $member->getName(),
'timezone' => $member->getTimezone()->getName(),
];
}
}
return $users;
}
public function getReportTypeName(AutomatedReportResult $report): string
{
$type = $report->getReport()->getType();
$getType = $this->transformReportType($type);
return $getType['name'];
}
public function getReportPeriodName(AutomatedReportResult $report): string
{
$from = $report->getFromDate();
$to = $report->getToDate();
$frequency = $report->getReport()->getFrequency();
if ($from === null || $to === null) {
if (! $report->getReport()->isAskJiminnyReport()) {
$invalidPeriod = $from === null ? 'from' : 'to';
throw new ApplicationException('Report period is invalid: ' . $invalidPeriod);
}
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
}
return $this->formatReportPeriodName($frequency, $from, $to);
}
private function formatReportPeriodName(string $frequency, Carbon $from, Carbon $to): string
{
$fromYear = $from->format('Y');
$toYear = $to->format('Y');
$differentYears = $fromYear !== $toYear;
switch ($frequency) {
case self::FREQUENCY_DAILY:
return $from->format('j M Y');
case self::FREQUENCY_QUARTERLY:
// 'Jan-Mar 2025' or 'Nov 2024-Jan 2025' if years differ
$startMonth = $from->format('M');
$endMonth = $to->copy()->subMonth();
$endMonthName = $endMonth->format('M');
$endMonthYear = $endMonth->format('Y');
if ($differentYears) {
return "{$startMonth} {$fromYear} - {$endMonthName} {$endMonthYear}";
}
return "{$startMonth} - {$endMonthName} {$toYear}";
case self::FREQUENCY_MONTHLY:
// 'May 2025' - monthly reports are always within the same year
return $from->format('M Y');
case self::FREQUENCY_WEEKLY:
// '4 - 8 Aug 2025', '27 Oct - 3 Nov 2025', or '28 Dec 2024 - 3 Jan 2025' if years differ
$startDay = $from->format('j');
$endDay = $to->format('j');
$startMonth = $from->format('M');
$endMonth = $to->format('M');
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
if ($startMonth !== $endMonth) {
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
}
return "{$startDay} - {$endDay} {$endMonth} {$toYear}";
case self::FREQUENCY_ONE_OFF:
// '2 May-31 May 2025' or '15 Dec 2024-15 Jan 2025' if years differ
$startDay = $from->format('j');
$startMonth = $from->format('M');
$endDay = $to->format('j');
$endMonth = $to->format('M');
// If same month and year, use a format like '2-31 May 2025'
if ($startMonth === $endMonth && ! $differentYears) {
return "{$startDay} - {$endDay} {$startMonth} {$toYear}";
}
// If different years, include both years
if ($differentYears) {
return "{$startDay} {$startMonth} {$fromYear} - {$endDay} {$endMonth} {$toYear}";
}
// Same year but different months
return "{$startDay} {$startMonth} - {$endDay} {$endMonth} {$toYear}";
default:
// Default format for unknown frequencies
return $from->format('j M Y') . ' - ' . $to->format('j M Y');
}
}
public function getReportTeamsName(AutomatedReportResult $report): string
{
$groups = $report->getGroups();
if (empty($groups)) {
return 'All';
}
// Get group names from repository
$groupNames = [];
foreach ($groups as $groupId) {
$group = $this->groupRepository->find($groupId);
if ($group) {
$groupNames[] = $group->getName();
}
}
if (count($groupNames) === 1) {
// Single team format
$teamsName = $groupNames[0];
} else {
// Multiple teams format
$teamsName = implode(', ', $groupNames);
}
return $teamsName;
}
public function getReportFileName(AutomatedReportResult $report): string
{
$customName = $report->getReport()->getCustomName();
$periodName = $this->getReportPeriodName($report);
$filenameSuffix = $this->getFilenameSuffix($report);
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$customName} - {$periodName}");
}
$baseName = $this->getReportTypeName($report);
if ($filenameSuffix) {
$baseName .= " {$filenameSuffix}";
}
return $this->sanitizeFileName("{$baseName} - {$periodName} - {$this->getReportTeamsName($report)}");
}
public function getReportFileNameWithExtension(AutomatedReportResult $result): string
{
$extension = $this->getMediaTypeMetadata($result)['extension'];
return $this->getReportFileName($result) . '.' . $extension;
}
public function sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
public function isUserRecipientOfReport(User $user, AutomatedReport $report): bool
{
$recipients = array_map('intval', $report->getRecipients()['users'] ?? []);
return in_array($user->getId(), $recipients);
}
public function transformReportResults(Collection $automatedReportResults): array
{
$data = [];
foreach ($automatedReportResults as $automatedReportResult) {
/** @var AutomatedReportResult $automatedReportResult */
$report = $automatedReportResult->getReport();
$createdBy = $report->getCreator();
$creator = [
'id' => $createdBy?->getUuid(),
'name' => $createdBy?->getName(),
'email' => $createdBy?->getEmailAddress(),
'photoUrl' => $createdBy?->getPhotoUrl(),
];
$data[] = [
'id' => $automatedReportResult->getUuid(),
'name' => $automatedReportResult->getName(),
'frequency' => $this->transformFrequency($report->getFrequency()),
'recipients' => $this->buildRecipients($report),
'report_type' => $this->transformReportType($report->getType()),
'media_type' => $automatedReportResult->getMediaType(),
'downloadUrl' => $this->generateReportResultDownloadUrl($automatedReportResult),
'viewUrl' => $this->generateReportResultViewUrl($automatedReportResult),
'generated_at' => $automatedReportResult->getGeneratedAt()?->toIso8601String(),
'creator' => $creator,
];
}
return $data;
}
private function buildRecipients(AutomatedReport $report): array
{
$creatorUuid = $report->getCreator()?->getUuid();
$recipients = array_values(array_filter(
$this->transformRecipients($report->getRecipients()),
static fn (array $recipient): bool => $recipient['id'] !== $creatorUuid,
));
if (! $report->isAskJiminnyReport()) {
return $recipients;
}
return [
...array_values($this->transformGroups(team: $report->getTeam(), groupsIds: $report->getGroups())),
...$recipients,
];
}
public function hasCallTypeConference(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_CONFERENCE['id'], $report->getCallTypes(), true);
}
public function hasCallTypeDialer(AutomatedReport $report): bool
{
return in_array(self::CALL_TYPE_DIALER['id'], $report->getCallTypes(), true);
}
// transformers
private function transformTeam(Team $team): array
{
if (! $team->hasFeature(FeatureEnum::AUTOMATED_REPORTS)) {
return [];
}
return [
'id' => $team->getUuid(),
'name' => $team->getName(),
];
}
private function transformReportFullView(AutomatedReport $report): array
{
$base = $this->transformReportBase($report);
return $report->getType() === self::TYPE_ASK_JIMINNY
? $base + $this->transformAskJiminnyFields($report)
: $base + $this->transformStandardReportFields($report);
}
private function transformReportBase(AutomatedReport $report): array
{
return [
'id' => $report->getUuid(),
'organization' => $this->transformOrganization(team: $report->getTeam()),
'report_type' => $this->transformReportType($report->getType()),
'frequency' => $this->transformFrequency($report->getFrequency()),
];
}
private function transformStandardReportFields(AutomatedReport $report): array
{
$team = $report->getTeam();
return [
'report_enabled' => $report->getStatus(),
'start_date_period' => $report->getFrom()?->format('Y-m-d H:i:s'),
'end_date_period' => $report->getTo()?->format('Y-m-d H:i:s'),
'deal_value_min' => $report->getDealValueMin(),
'deal_value_max' => $report->getDealValueMax(),
'call_types' => $this->transformCallType($report->getCallTypes()),
'media_types' => $this->transformMediaTypes($report),
'call_duration_min' => $this->transformDurationToMinutes($report->getCallDurationMin()),
'call_duration_max' => $this->transformDurationToMinutes($report->getCallDurationMax()),
'teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'deal_at_call_stages' => $this->transformStages(team: $team, stagesIds: $report->getDealAtCallStages()),
'current_deal_stages' => $this->transformStages(team: $team, stagesIds: $report->getCurrentDealStages()),
'recipients' => $this->transformRecipients($report->getRecipients()),
'created_by' => $this->transformCreator($report->getCreator()),
'additional_prompt_input' => $report->getAdditionalPromptInput(),
'custom_name' => $report->getCustomName(),
'created_at' => $report->getCreatedAt()->format('Y-m-d H:i:s'),
'updated_at' => $report->getUpdatedAt()->format('Y-m-d H:i:s'),
'deleted_at' => $report->getDeletedAt()?->format('Y-m-d H:i:s'),
];
}
private function transformAskJiminnyFields(AutomatedReport $report): array
{
$team = $report->getTeam();
$creatorId = $report->getAttribute('created_by');
$explicitUserIds = array_values(array_filter(
$report->getRecipients()['users'] ?? [],
static fn ($id) => $id !== $creatorId
));
return [
'report_name' => $report->getCustomName(),
'enabled' => $report->getStatus(),
'share_teams' => $this->transformGroups(team: $team, groupsIds: $report->getGroups()),
'share_users' => $this->transformRecipients(['users' => $explicitUserIds]),
'saved_search' => $this->transformSafeSearch($report->getSavedSearch()),
'ask_jiminny_prompt' => $this->transformAskJiminnyPrompt($report->getAskAnythingPrompt()),
'expires_on' => $report->getExpiresAt()?->format('Y-m-d'),
];
}
private function transformOrganization(?Team $team): array
{
return [
'id' => $team?->getUuid(),
'name' => $team?->getName(),
];
}
private function transformReportType(string $type): array
{
foreach (self::ALL_TYPES as $typeItem) {
if ($typeItem['id'] === $type) {
return $typeItem;
}
}
return [];
}
private function transformCallType(array $types): array
{
$result = [];
$callTypes = [self::CALL_TYPE_CONFERENCE, self::CALL_TYPE_DIALER];
foreach ($types as $type) {
foreach ($callTypes as $callTypeItem) {
if ($callTypeItem['id'] === $type) {
$result[] = $callTypeItem;
break;
}
}
}
return $result;
}
private function transformMediaTypes(AutomatedReport $report): array
{
$values = [];
foreach ($report->getMediaTypes() as $mediaType) {
if (! in_array($mediaType, self::MEDIA_TYPES, true)) {
continue;
}
$values[] = match ($mediaType) {
self::MEDIA_TYPE_PDF => self::MEDIA_TYPE_OBJECT_PDF,
self::MEDIA_TYPE_PODCAST => self::MEDIA_TYPE_OBJECT_PODCAST,
};
}
return $values;
}
private function transformFrequency(string $frequency): array
{
foreach (self::ALL_FREQUENCIES as $frequencyItem) {
if ($frequencyItem['id'] === $frequency) {
return $frequencyItem;
}
}
return [];
}
public function transformDurationToMinutes(?int $duration): ?int
{
if (! $duration) {
return null;
}
return (int) ($duration / 60);
}
private function transformGroups(?Team $team, array $groupsIds): array
{
if (empty($groupsIds) || ! $team) {
return [];
}
$data = [];
foreach ($groupsIds as $groupId) {
$group = $team->groups()->where('id', $groupId)->first();
if ($group) {
$data[] = [
'id' => $group->getUuid(),
'name' => $group->getName(),
'photoUrl' => $group->getPhotoUrl(),
];
}
}
return $data;
}
private function transformStages(?Team $team, array $stagesIds): array
{
if (empty($stagesIds) || ! $team) {
return [];
}
$data = [];
foreach ($stagesIds as $stageId) {
$stage = $team->stages()->where('id', $stageId)->first();
if ($stage) {
$data[] = [
'id' => $stage->getUuid(),
'name' => $stage->getName(),
];
}
}
return $data;
}
private function transformRecipients(array $recipients): array
{
$users = [];
foreach ($recipients['users'] ?? [] as $userId) {
$users[] = $this->transformUser($userId);
}
return $users;
}
private function transformCreator(?User $user): ?array
{
if ($user === null) {
return null;
}
return $this->transformUser($user->getId());
}
private function transformAskJiminnyPrompt(?AskAnythingPrompt $prompt): ?array
{
if ($prompt === null) {
return null;
}
return [
'id' => $prompt->getUuid(),
'name' => $prompt->getTitle(),
];
}
private function transformSafeSearch(?Search $search): ?array
{
if ($search === null) {
return null;
}
return [
'id' => $search->getUuid(),
'name' => $search->getName(),
];
}
private function transformUser(int $userId): array
{
/* @var ?User $user */
$user = $this->userRepository->find($userId);
return [
'id' => $user?->getUuid(),
'name' => $user?->getName(),
'email' => $user?->getEmailAddress(),
'photoUrl' => $user?->getPhotoUrl(),
];
}
public function create(array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$validatedData['created_by'] = auth()->id();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
public function update(string $uuid, array $data): array
{
$validatedData = $this->validateAndTransformData($data);
$report = $this->automatedReportsRepository->findByUuid($uuid);
if (! $report) {
throw new InvalidArgumentException('Report not found');
}
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
$this->generateOneOffReport($automatedReport);
return $this->transformReportFullView($automatedReport);
}
/**
* Create an Ask Jiminny report.
*/
public function createAskJiminnyReport(array $data, User $creator): array
{
$validatedData = $this->validateAskJiminnyReportData($data, $creator);
$validatedData['created_by'] = $creator->getId();
$automatedReport = $this->automatedReportsRepository->create($validatedData);
return $this->transformReportFullView($automatedReport);
}
/**
* Update an Ask Jiminny report.
*/
public function updateAskJiminnyReport(AutomatedReport $report, array $data, User $user): array
{
if (! $report->isAskJiminnyReport()) {
throw new InvalidArgumentException('Report is not an Ask Jiminny report');
}
$validatedData = $this->validateAskJiminnyReportData($data, $user);
$oldCustomName = $report->getCustomName();
$automatedReport = $this->automatedReportsRepository->update($report, $validatedData);
if ($oldCustomName !== $automatedReport->getCustomName()) {
$this->updateResultNames($automatedReport);
}
return $this->transformReportFullView($automatedReport);
}
public function updateAskJiminnyReportStatus(AutomatedReport $report, bool $status): array
{
$this->automatedReportsRepository->update($report, ['status' => $status]);
return $this->transformReportFullView($report->fresh());
}
/**
* Validate and transform data for Ask Jiminny reports.
*/
private function validateAskJiminnyReportData(array $data, User $user): array
{
// Validate name
$name = trim($data['report_name'] ?? '');
if (empty($name)) {
throw new InvalidArgumentException('Report name is required');
}
if (mb_strlen($name) > 50) {
throw new InvalidArgumentException('Report name must be 50 characters or less');
}
// Validate frequency (only daily, weekly, monthly for Ask Jiminny)
$frequency = $data['frequency'] ?? null;
$askJiminnyFrequencies = [self::FREQUENCY_DAILY, self::FREQUENCY_WEEKLY, self::FREQUENCY_MONTHLY];
if (! in_array($frequency, $askJiminnyFrequencies, true)) {
throw new InvalidArgumentException('Frequency must be daily, weekly, or monthly');
}
// Validate expiration date
$expiresAt = $data['expires_on'] ?? null;
if (empty($expiresAt)) {
throw new InvalidArgumentException('Expiration date is required');
}
try {
$expiresAtDate = Carbon::parse($expiresAt);
} catch (InvalidFormatException $e) {
throw new InvalidArgumentException('Expiration date format is invalid');
}
$maxExpiration = Carbon::now()->addYear()->endOfDay();
if ($expiresAtDate->gt($maxExpiration)) {
throw new InvalidArgumentException('Expiration date cannot be more than 1 year from now');
}
if ($expiresAtDate->isPast()) {
throw new InvalidArgumentException('Expiration date cannot be in the past');
}
// Validate saved search
$activitySearchId = $data['saved_search'] ?? null;
if (empty($activitySearchId)) {
throw new InvalidArgumentException('Saved search is required');
}
$savedSearch = $this->activitySearchRepository->findByUuidAndUser($activitySearchId, $user);
if (! $savedSearch) {
throw new InvalidArgumentException('Saved search not found or does not belong to you');
}
// Validate saved prompt
$askAnythingPromptId = $data['ask_jiminny_prompt'] ?? null;
if (empty($askAnythingPromptId)) {
throw new InvalidArgumentException('Ask Jiminny prompt is required');
}
$prompt = $this->askAnythingRepository->getPromptByUuid($askAnythingPromptId);
if (! $prompt) {
throw new InvalidArgumentException('Ask Jiminny prompt not found');
}
// Validate status
$status = $data['enabled'] ?? false;
$recipientUserIds = [$user->getId()];
if (! empty($data['share_users'])) {
$sharedUserIds = $this->validateAndGetUserIdsByTeam(
$user->team,
(array) $data['share_users']
);
$recipientUserIds = array_merge($recipientUserIds, $sharedUserIds);
}
$sharedGroupIds = [];
if (! empty($data['share_teams'])) {
$sharedGroupIds = $this->validateAndGetGroupIds($user->team, (array) $data['share_teams']);
}
$recipientUserIds = array_values(array_unique($recipientUserIds));
return [
'team_id' => $user->getTeamId(),
'type' => self::TYPE_ASK_JIMINNY,
'status' => (bool) $status,
'frequency' => $frequency,
'custom_name' => $name,
'activity_search_id' => $savedSearch->getId(),
'ask_anything_prompt_id' => $prompt->getId(),
'expires_at' => $expiresAtDate->toDateString(),
'media_types' => [self::MEDIA_TYPE_PDF],
'call_types' => [],
'recipients' => ['users' => $recipientUserIds],
'groups' => $sharedGroupIds,
];
}
public static function getAskJiminnyFrequencies(): array
{
return array_map(static function ($frequency) {
return $frequency['id'];
}, self::ASK_JIMINNY_FREQUENCIES);
}
public function getAskJiminnyReportFilters(User $user): array
{
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
return [
[
'id' => 'prompt',
'label' => 'Prompt',
'options' => $prompts,
],
[
'id' => 'saved_search',
'label' => 'Saved Search',
'options' => $savedSearches,
],
];
}
public function getAskJiminnyReportFormData(User $user, ?AutomatedReport $report = null): array
{
$team = $user->getTeam();
$userTimezone = $user->getTimezone();
$savedSearches = $this->activitySearchRepository->findByUserOrderedByName($user)
->map(fn (Search $search) => [
'id' => $search->getUuid(),
'name' => $search->getName(),
])
->values()->all();
$prompts = collect(
$this->askAnythingPromptService->get($user, AskAnythingPromptTarget::on_demand)
)->map(fn (AskAnythingPromptDto $prompt) => [
'id' => $prompt->id,
'name' => $prompt->title,
])->values()->all();
$teamGroups = $this->groupRepository->getAllByTeam($team)->map(fn ($group) => [
'id' => $group->getUuid(),
'name' => $group->getName(),
])->values()->all();
$shareUsers = $this->recipientsService->getRecipientsFieldData(team: $team)['options'] ?? [];
$sharedTeamsValue = [];
$sharedUsersValue = [];
if ($report) {
$sharedTeamsValue = $this->transformGroups($team, $report->getGroups());
$recipientUserIds = $report->getRecipients()['users'] ?? [];
$creatorId = $report->getAttribute('created_by');
$sharedUserIds = array_values(array_filter(
$recipientUserIds,
static fn ($id) => $id !== $creatorId
));
$sharedUsersValue = collect($sharedUserIds)
->map(fn ($id) => $this->userRepository->find((int) $id))
->filter()
->map(fn (User $u) => [
'id' => $u->getUuid(),
'name' => $u->getName(),
])
->values()
->all();
}
return [
'fields' => [
[
'id' => 'enabled',
'inputType' => InputTypeEnum::TOGGLE,
'label' => '',
'value' => $report?->getStatus() ?? false,
],
[
'id' => 'report_name',
'inputType' => InputTypeEnum::TEXT,
'label' => 'Name',
'placeholder' => 'Enter name',
'required' => true,
'validation' => ['maxLength' => 50],
'value' => $report?->getCustomName() ?? '',
],
[
'id' => 'frequency',
'inputType' => InputTypeEnum::DROPDOWN,
'label' => 'Frequency',
'required' => true,
'placeholder' => 'Select',
'options' => self::ASK_JIMINNY_FREQUENCIES,
'value' => $report ? $this->transformFrequency($report->getFrequency()) : null,
],
[
'id' => 'expires_on',
'inputType' => InputTypeEnum::DATE,
'label' => 'Expires on',
'required' => true,
'placeholder' => 'Select',
'validation' => [
'minDate' => now($userTimezone)->toDateString(),
'maxDate' => now($userT...
|
NULL
|
|
67049
|
NULL
|
0
|
2026-04-21T15:25:27.134599+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776785127134_m2.jpg...
|
PhpStorm
|
faVsco.js – AutomatedReportsRepository.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
PhostormcodeFV faVsco.js( #11894 on JY-18909-autom PhostormcodeFV faVsco.js( #11894 on JY-18909-automated-reports-aslProledey(C) Track.pn*© TranscriptionModel.php© TranscriptionModelLocale.php© TranscriptionProvider.php(C User.pnp© UserSettings.php© Vocabulary.php© VocabularyPronunciation.php© VoiceAccess.phpc Voiceconsentrrerix.ong› C Notifications• _ Ooserversa Policiesu ProvidersC QueueRevositoriesD AiAutoScoringC) AccountRenositorv.oho© ContactRepository.php(C) ContactRoleRevositorv.oho© CrmConfigurationRepository.p© CrmEntityRepository.php© FieldDataRepository.php© FieldRepository.php© LayoutEntityRepository.php© LayoutRepository.phpC) LeadRepositony.pnp© OpportunityRepository.phpc Promllekepository.ono© RecordTypeFieldValuesReposistagerepository.onp© SyncBatchRepositorv.php> C GeoaraphyC) ActiveStreamsRepositorv.php© ActivityCommentRepository.php) ActivityLoaRepositorv.phpC) ActivitvMessageRepositorv.ohp(c) ActivitvMomentReoositorv.onv@ ActivitvProviderRepositorv.ohp(C) ActivitvRenositor.oho(C) ActivitvSearch-ilterRenositorv.onC) ActivitvShareRenositorv.oho(C) ActivitvUoloadSettinaReoositorv.nC) A PromotRenositorv.oho(c) AckAnvthinaRenositorv nho(C) CallimnortRenositorv nhn© CoachingFeedbackRepository.ph| 21.C) Service.php© Field.phpC) AutomatedReportsSendcommand.ongC) AutomatedReportResult.phoC) AutomatedReport.phpQ- whereHasXP Cc W .*class Aucomaceakeporcskepos1corypubtze tunctzon counerserunvoresansesuserwust->counto:* Restrict a query on the automated_reports table to reports the given user is allowed to see.* Matches the customer-facing audience:explicit user recipients (recipients.users)members ofanyof the report's groups (Ask Jiminny reports)private function applyUserAccessScope(Builder Squery, User $user): voidSuserId = $user->getId):SqroupId = Suser->getGroupIdO:->where( column: 'automated_reports.team_id'. Suser->qetTeamIdo)->where(function (Builder Sq) use (SuserId, SqroupId): void {ints->users'. SuserId):Cascade 28Command 28lif (SaroupTd |== null) {sa->orWhere(function Builder Ssub) use (Saroupid): voidSsub->where('automated_reports.tvpe'. AutomatedReportsService::TYPE_ASK JIMINNY)>whereJsoncontains('automated_reports.groups', $groupid);/*** Get report IDs for a specific team* Ananam Toam Ctoam« Anotunn |T1luminatol Sunnont|Colloction5 usagespublic function getReportIdsByTeam(Team Steam): Illuminate\ Support\Collection{...}A18X7A1A VO16S— 166=169\ 173175— 1/0177•179=181-1831841901-192192200201— 202= custom.log4 SF [jiminny@localhost] XA HS_local [iminny@localhost)# concole [ppon1A console (EU]report-not-generated.blade.phgC) sendreportNotGenerateamallJob.phpA console [STAGING]Tys Autoe jiminnyFELECT * FROM activity_searches whereELECT * FROM activity search filters WiEKe aLLvi SEN-D18 A14 22 24 ME"ELECT * FROM automated_reports where 1d = 68)IPDATE automated_reports set playbook categories = NULL where id¡ELECT * FROM automated_report_results where id = 275;¡ELECT * FROM automated_reports order by id desc;ELECT * FROM automated_report_results order by id desc;¡elect * from activity_searches where user_id = 143;elect * From ask anvthina nromnts.¡ELECT * FROM groups WHERE id = 1439;ELECT * FROM users WHERE group_id = 1439;ielect * from permissions; # 158elect x tron roleselect * from permission_roleielect * from teams where id = 1:ielect * from groups q JOIN playbooks p 1..n<->1: on g.playbook idielect * from groups where id = 28:ielect * from playbooks where team id = 1:elect * trom playbooks where 10 = 1791ielect * from playbook categories where id = 1391:elect * trom users where 10 = 1451ielect * from crm profiles where user 1d = 145%elect * from activities where crm_configuration_id = 39 and typend crm orovider id IS NOT NULL ORDER by id desc:elect * from activities where id = 422003: # 00U04000000B6foMAC¡ELECT ar.id, ar.uuid, ar.media type, ar.status, a.typeROM automated renont results anOIN automated_reports a ON a.id = ar.report.idTHERE a.type ='ask_jiminnyITMTT 10•HELECTautomated_report_results.* FROMNNEP IOTM 'automatod nonontelMHEpsautomated_report_results'.'report_id' = automated_reports"automatod nonont noculte' 'aononatod atlTC MOT NILIautomated reports'.'team_id' = 1AND JSON_CONTAINS('automated_reports'.'recipients'. 1635. '$."|100% S2Tue 21 Apr 18:25:27AutomatedReportsServiceTest ~CascadeReview Planhat IntearAutomated Reports RCalendar Multi-Domal+0..run tests and tix it not oassingo docte ai docset le /A bia ertero ftevoposto yief eoye oe telt /no dsev/en diese /lireo e e ri 2062 1PHPUnit 11.5.55 by Sebastian Beramann and contrilbutors.PhP 0.3:30Configuration: /home/jaminny/phpunit.xml05 4 495 15439 / 453 ( 419A| 453 tests pass (6 ore-existina skiooed. 5 unrelated PHPUnit deprecation notices). No fixes needed.Teal aeets additional loaic where+ « CodelClaude Qnus 17 MediumW Windsurf Toams 205-20/247 charc 5 line hroake)UTF.8io 4 spaces...
|
NULL
|
8103009563643625673
|
NULL
|
visual_change
|
ocr
|
NULL
|
PhostormcodeFV faVsco.js( #11894 on JY-18909-autom PhostormcodeFV faVsco.js( #11894 on JY-18909-automated-reports-aslProledey(C) Track.pn*© TranscriptionModel.php© TranscriptionModelLocale.php© TranscriptionProvider.php(C User.pnp© UserSettings.php© Vocabulary.php© VocabularyPronunciation.php© VoiceAccess.phpc Voiceconsentrrerix.ong› C Notifications• _ Ooserversa Policiesu ProvidersC QueueRevositoriesD AiAutoScoringC) AccountRenositorv.oho© ContactRepository.php(C) ContactRoleRevositorv.oho© CrmConfigurationRepository.p© CrmEntityRepository.php© FieldDataRepository.php© FieldRepository.php© LayoutEntityRepository.php© LayoutRepository.phpC) LeadRepositony.pnp© OpportunityRepository.phpc Promllekepository.ono© RecordTypeFieldValuesReposistagerepository.onp© SyncBatchRepositorv.php> C GeoaraphyC) ActiveStreamsRepositorv.php© ActivityCommentRepository.php) ActivityLoaRepositorv.phpC) ActivitvMessageRepositorv.ohp(c) ActivitvMomentReoositorv.onv@ ActivitvProviderRepositorv.ohp(C) ActivitvRenositor.oho(C) ActivitvSearch-ilterRenositorv.onC) ActivitvShareRenositorv.oho(C) ActivitvUoloadSettinaReoositorv.nC) A PromotRenositorv.oho(c) AckAnvthinaRenositorv nho(C) CallimnortRenositorv nhn© CoachingFeedbackRepository.ph| 21.C) Service.php© Field.phpC) AutomatedReportsSendcommand.ongC) AutomatedReportResult.phoC) AutomatedReport.phpQ- whereHasXP Cc W .*class Aucomaceakeporcskepos1corypubtze tunctzon counerserunvoresansesuserwust->counto:* Restrict a query on the automated_reports table to reports the given user is allowed to see.* Matches the customer-facing audience:explicit user recipients (recipients.users)members ofanyof the report's groups (Ask Jiminny reports)private function applyUserAccessScope(Builder Squery, User $user): voidSuserId = $user->getId):SqroupId = Suser->getGroupIdO:->where( column: 'automated_reports.team_id'. Suser->qetTeamIdo)->where(function (Builder Sq) use (SuserId, SqroupId): void {ints->users'. SuserId):Cascade 28Command 28lif (SaroupTd |== null) {sa->orWhere(function Builder Ssub) use (Saroupid): voidSsub->where('automated_reports.tvpe'. AutomatedReportsService::TYPE_ASK JIMINNY)>whereJsoncontains('automated_reports.groups', $groupid);/*** Get report IDs for a specific team* Ananam Toam Ctoam« Anotunn |T1luminatol Sunnont|Colloction5 usagespublic function getReportIdsByTeam(Team Steam): Illuminate\ Support\Collection{...}A18X7A1A VO16S— 166=169\ 173175— 1/0177•179=181-1831841901-192192200201— 202= custom.log4 SF [jiminny@localhost] XA HS_local [iminny@localhost)# concole [ppon1A console (EU]report-not-generated.blade.phgC) sendreportNotGenerateamallJob.phpA console [STAGING]Tys Autoe jiminnyFELECT * FROM activity_searches whereELECT * FROM activity search filters WiEKe aLLvi SEN-D18 A14 22 24 ME"ELECT * FROM automated_reports where 1d = 68)IPDATE automated_reports set playbook categories = NULL where id¡ELECT * FROM automated_report_results where id = 275;¡ELECT * FROM automated_reports order by id desc;ELECT * FROM automated_report_results order by id desc;¡elect * from activity_searches where user_id = 143;elect * From ask anvthina nromnts.¡ELECT * FROM groups WHERE id = 1439;ELECT * FROM users WHERE group_id = 1439;ielect * from permissions; # 158elect x tron roleselect * from permission_roleielect * from teams where id = 1:ielect * from groups q JOIN playbooks p 1..n<->1: on g.playbook idielect * from groups where id = 28:ielect * from playbooks where team id = 1:elect * trom playbooks where 10 = 1791ielect * from playbook categories where id = 1391:elect * trom users where 10 = 1451ielect * from crm profiles where user 1d = 145%elect * from activities where crm_configuration_id = 39 and typend crm orovider id IS NOT NULL ORDER by id desc:elect * from activities where id = 422003: # 00U04000000B6foMAC¡ELECT ar.id, ar.uuid, ar.media type, ar.status, a.typeROM automated renont results anOIN automated_reports a ON a.id = ar.report.idTHERE a.type ='ask_jiminnyITMTT 10•HELECTautomated_report_results.* FROMNNEP IOTM 'automatod nonontelMHEpsautomated_report_results'.'report_id' = automated_reports"automatod nonont noculte' 'aononatod atlTC MOT NILIautomated reports'.'team_id' = 1AND JSON_CONTAINS('automated_reports'.'recipients'. 1635. '$."|100% S2Tue 21 Apr 18:25:27AutomatedReportsServiceTest ~CascadeReview Planhat IntearAutomated Reports RCalendar Multi-Domal+0..run tests and tix it not oassingo docte ai docset le /A bia ertero ftevoposto yief eoye oe telt /no dsev/en diese /lireo e e ri 2062 1PHPUnit 11.5.55 by Sebastian Beramann and contrilbutors.PhP 0.3:30Configuration: /home/jaminny/phpunit.xml05 4 495 15439 / 453 ( 419A| 453 tests pass (6 ore-existina skiooed. 5 unrelated PHPUnit deprecation notices). No fixes needed.Teal aeets additional loaic where+ « CodelClaude Qnus 17 MediumW Windsurf Toams 205-20/247 charc 5 line hroake)UTF.8io 4 spaces...
|
NULL
|
|
67050
|
NULL
|
0
|
2026-04-21T15:25:28.850506+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776785128850_m1.jpg...
|
PhpStorm
|
faVsco.js – AutomatedReportsRepository.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsServiceTest
Run 'AutomatedReportsServiceTest'
Debug 'AutomatedReportsServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
whereHas
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
3/3
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
18
7
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Repositories;
use Carbon\CarbonImmutable;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Facades\DB;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\Kiosk\AutomatedReports\ReportSort;
use Jiminny\Services\Kiosk\AutomatedReports\ReportSortDirection;
class AutomatedReportsRepository
{
/**
* Create a new automated report
*
* @param array $data
*
* @return AutomatedReport
*/
public function create(array $data): AutomatedReport
{
return AutomatedReport::create($data);
}
/**
* Find an automated report by UUID
*
* @param string $uuid
*
* @return AutomatedReport|null
*/
public function findByUuid(string $uuid): ?AutomatedReport
{
return AutomatedReport::where('uuid', AutomatedReport::toOptimized($uuid))->first();
}
public function findByIdOrUuid(string $idOrUuid): ?AutomatedReport
{
if (is_numeric($idOrUuid)) {
return AutomatedReport::find((int) $idOrUuid);
}
return AutomatedReport::where('uuid', AutomatedReport::toOptimized($idOrUuid))->first();
}
/**
* Retrieve all standard (non-Ask Jiminny) automated reports.
*
* @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.
* @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.
*
* @return Collection<AutomatedReport>
*/
public function getAllStandardReports(
string $sortColumn = 'created_at',
string $sortDirection = 'desc'
): Collection {
return $this->buildSortedQuery($sortColumn, $sortDirection)
->whereNot('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->get();
}
/**
* Retrieve all Ask Jiminny reports created by the given user.
*
* @param User $user The user whose reports to retrieve.
* @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.
* @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.
*
* @return Collection<AutomatedReport>
*/
public function getAskJiminnyReportsByUser(
User $user,
string $sortColumn = 'created_at',
string $sortDirection = 'desc'
): Collection {
return $this->buildSortedQuery($sortColumn, $sortDirection)
->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->where('created_by', $user->getId())
->get();
}
private function buildSortedQuery(string $sortColumn, string $sortDirection): \Illuminate\Database\Eloquent\Builder
{
$allowedColumns = ['created_by', 'created_at'];
if (! in_array($sortColumn, $allowedColumns)) {
$sortColumn = 'created_at';
}
$sortDirection = strtolower($sortDirection) === 'asc' ? 'asc' : 'desc';
$query = AutomatedReport::query()->with(['creator', 'team']);
if ($sortColumn === 'created_by') {
$query->leftJoin('users', 'users.id', '=', 'automated_reports.created_by')
->orderByRaw("users.name COLLATE utf8mb4_unicode_ci {$sortDirection}")
->select('automated_reports.*');
} else {
$query->orderBy($sortColumn, $sortDirection);
}
return $query;
}
/**
* Get all active Ask Jiminny reports whose expiry date has passed.
*
* @return Collection<AutomatedReport>
*/
public function getExpiredActiveAskJiminnyReports(): Collection
{
return AutomatedReport::where('status', true)
->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->whereNotNull('expires_at')
->where('expires_at', '<', now()->toDateString())
->get();
}
/**
* Get all active and enabled reports with active teams for the specified frequency.
*
* @param string $frequency
*
* @return Collection<AutomatedReport>
*/
public function getActiveReportsByFrequency(string $frequency): Collection
{
return AutomatedReport::where('automated_reports.status', true)
->where('automated_reports.frequency', $frequency)
->join('teams', 'automated_reports.team_id', '=', 'teams.id')
->where('teams.status', Team::STATUS_ACTIVE)
->where(function ($query) {
$query->whereNull('automated_reports.expires_at')
->orWhere('automated_reports.expires_at', '>=', now()->toDateString());
})
->select('automated_reports.*')
->get();
}
/**
* Update an automated report
*
* @param AutomatedReport $report
* @param array $data
*
* @return AutomatedReport
*/
public function update(AutomatedReport $report, array $data): AutomatedReport
{
$report->update($data);
return $report;
}
/**
* Create a new automated report result.
*
* @param array $data The data to create the automated report result with.
*
* @return AutomatedReportResult The newly created automated report result.
*/
public function createResult(array $data): AutomatedReportResult
{
return AutomatedReportResult::create($data);
}
/**
* Find an automated report result by UUID.
*
* @param string $uuid The UUID to find the automated report result with.
*
* @return AutomatedReportResult|null The automated report result if found, otherwise null.
*/
public function findResultByUuid(string $uuid): ?AutomatedReportResult
{
return AutomatedReportResult::where('uuid', AutomatedReportResult::toOptimized($uuid))->first();
}
public function findResultByUuidForUser(string $uuid, User $user): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('uuid', AutomatedReportResult::toOptimized($uuid))
->whereHas('report', static function ($query) use ($user): void {
$query->where('team_id', $user->getTeamId())
->where('created_by', $user->getId());
})
->first();
}
public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('parent_id', $result->getId())
->where('media_type', $type)
->first();
}
public function findLatestDefaultOrFailedResult(AutomatedReport $report): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('report_id', $report->getId())
->whereIn('status', [AutomatedReportResult::STATUS_DEFAULT, AutomatedReportResult::STATUS_FAILED])
->latest()
->first();
}
public function getGeneratedNotSentResults(): Collection
{
return AutomatedReportResult::query()
->whereNotNull('generated_at')
->whereNull('sent_at')
->where('status', AutomatedReportResult::STATUS_GENERATED)
->whereHas('report')
->with('report')
->get();
}
public function getPaginatedUserReports(
User $user,
ReportSort $sort,
ReportSortDirection $sortDirection,
int $resultsPerPage,
int $page,
?Carbon $fromDate,
?Carbon $toDate,
array $teamIds,
array $reportTypes,
?string $name,
): LengthAwarePaginator {
$query = AutomatedReportResult::query()
->whereNotNull('automated_report_results.generated_at')
->join('automated_reports', 'automated_report_results.report_id', '=', 'automated_reports.id')
->where(fn (Builder $q) => $this->applyUserAccessScope($q, $user))
->orderByRaw("$sort->value COLLATE utf8mb4_unicode_ci {$sortDirection->value}")
->select('automated_report_results.*')
->with('report.team');
if ($fromDate !== null && $toDate !== null) {
$query->whereBetween('generated_at', [$fromDate, $toDate]);
}
if (! empty($teamIds)) {
$query->where(function ($q) use ($teamIds) {
foreach ($teamIds as $id) {
$q->orWhereJsonContains('automated_reports.groups', $id);
}
});
}
if (! empty($reportTypes)) {
$query->whereIn('automated_reports.type', $reportTypes);
}
if (! empty($name)) {
$query->whereLike('name', "%$name%");
}
return $query->paginate($resultsPerPage, ['*'], 'page', $page);
}
public function countUserReports(User $user): int
{
return AutomatedReportResult::query()
->whereNotNull('generated_at')
->whereNotNull('sent_at')
->whereHas('report', function ($q) use ($user) {
$q->where('team_id', $user->getTeamId())
->whereJsonContains('recipients->users', $user->getId());
})
->count();
}
/**
* Restrict a query on the automated_reports table to reports the given user is allowed to see.
*
* Matches the customer-facing audience:
* - explicit user recipients (recipients.users)
* - members of any of the report's groups (Ask Jiminny reports)
*/
private function applyUserAccessScope(Builder $query, User $user): void
{
$userId = $user->getId();
$groupId = $user->getGroupId();
$query
->where('automated_reports.team_id', $user->getTeamId())
->where(function (Builder $q) use ($userId, $groupId): void {
$q->whereJsonContains('automated_reports.recipients->users', $userId);
if ($groupId !== null) {
$q->orWhere(function (Builder $sub) use ($groupId): void {
$sub->where('automated_reports.type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->whereJsonContains('automated_reports.groups', $groupId);
});
}
});
}
/**
* Get report IDs for a specific team
*
* @param Team $team
*
* @return \Illuminate\Support\Collection
*/
public function getReportIdsByTeam(Team $team): \Illuminate\Support\Collection
{
return AutomatedReport::where('team_id', $team->getId())->pluck('id');
}
/**
* Get all reports for a specific team
*
* @param Team $team
*
* @return Collection
*/
public function getReportsByTeam(Team $team): Collection
{
return AutomatedReport::where('team_id', $team->getId())->get();
}
/**
* Get all report results for a specific report
*
* @param AutomatedReport $report
*
* @return Collection
*/
public function getResultsByReport(AutomatedReport $report): Collection
{
return $this->getResultsByReportQuery($report)->get();
}
public function getResultsByReportQuery(AutomatedReport $report): Builder
{
return AutomatedReportResult::where('report_id', $report->getId());
}
public function getReportResultsQueryForRetention(Team $team, CarbonImmutable $retentionDate): Builder
{
$reportIds = $this->getReportIdsByTeam($team);
return AutomatedReportResult::query()->whereIn('report_id', $reportIds)
->whereRaw('IFNULL(generated_at, created_at) <= ?', [$retentionDate]);
}
/**
* @param int|null $teamId Optional team ID to filter results
*
* @return \Illuminate\Support\Collection<int, int> Collection of team IDs
*/
public function getTeamIdsWithReportsResults(?int $teamId = null): \Illuminate\Support\Collection
{
$query = DB::table('automated_reports')
->join('teams', 'automated_reports.team_id', '=', 'teams.id')
->select('teams.id')
->distinct();
if ($teamId !== null) {
$query->where('teams.id', $teamId);
}
return $query->pluck('teams.id');
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"#11894 on JY-18909-automated-reports-ask-jiminny, menu","depth":5,"help_text":"Pull request #11894 exists for current branch JY-18909-automated-reports-ask-jiminny","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AutomatedReportsServiceTest","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AutomatedReportsServiceTest'","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AutomatedReportsServiceTest'","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"whereHas","depth":4,"value":"whereHas","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"3/3","depth":4,"role_description":"text"},{"role":"AXButton","text":"Previous Occurrence","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Occurrence","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Filter Search Results","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open in Window, Multiple Cursors","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Click to highlight","depth":4,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"18","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"7","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Repositories;\n\nuse Carbon\\CarbonImmutable;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Database\\Eloquent\\Collection;\nuse Illuminate\\Pagination\\LengthAwarePaginator;\nuse Illuminate\\Support\\Facades\\DB;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\AutomatedReportsService;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\ReportSort;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\ReportSortDirection;\n\nclass AutomatedReportsRepository\n{\n /**\n * Create a new automated report\n *\n * @param array $data\n *\n * @return AutomatedReport\n */\n public function create(array $data): AutomatedReport\n {\n return AutomatedReport::create($data);\n }\n\n /**\n * Find an automated report by UUID\n *\n * @param string $uuid\n *\n * @return AutomatedReport|null\n */\n public function findByUuid(string $uuid): ?AutomatedReport\n {\n return AutomatedReport::where('uuid', AutomatedReport::toOptimized($uuid))->first();\n }\n\n public function findByIdOrUuid(string $idOrUuid): ?AutomatedReport\n {\n if (is_numeric($idOrUuid)) {\n return AutomatedReport::find((int) $idOrUuid);\n }\n\n return AutomatedReport::where('uuid', AutomatedReport::toOptimized($idOrUuid))->first();\n }\n\n /**\n * Retrieve all standard (non-Ask Jiminny) automated reports.\n *\n * @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.\n * @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.\n *\n * @return Collection<AutomatedReport>\n */\n public function getAllStandardReports(\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): Collection {\n return $this->buildSortedQuery($sortColumn, $sortDirection)\n ->whereNot('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->get();\n }\n\n /**\n * Retrieve all Ask Jiminny reports created by the given user.\n *\n * @param User $user The user whose reports to retrieve.\n * @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.\n * @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.\n *\n * @return Collection<AutomatedReport>\n */\n public function getAskJiminnyReportsByUser(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): Collection {\n return $this->buildSortedQuery($sortColumn, $sortDirection)\n ->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->where('created_by', $user->getId())\n ->get();\n }\n\n private function buildSortedQuery(string $sortColumn, string $sortDirection): \\Illuminate\\Database\\Eloquent\\Builder\n {\n $allowedColumns = ['created_by', 'created_at'];\n if (! in_array($sortColumn, $allowedColumns)) {\n $sortColumn = 'created_at';\n }\n\n $sortDirection = strtolower($sortDirection) === 'asc' ? 'asc' : 'desc';\n\n $query = AutomatedReport::query()->with(['creator', 'team']);\n\n if ($sortColumn === 'created_by') {\n $query->leftJoin('users', 'users.id', '=', 'automated_reports.created_by')\n ->orderByRaw(\"users.name COLLATE utf8mb4_unicode_ci {$sortDirection}\")\n ->select('automated_reports.*');\n } else {\n $query->orderBy($sortColumn, $sortDirection);\n }\n\n return $query;\n }\n\n /**\n * Get all active Ask Jiminny reports whose expiry date has passed.\n *\n * @return Collection<AutomatedReport>\n */\n public function getExpiredActiveAskJiminnyReports(): Collection\n {\n return AutomatedReport::where('status', true)\n ->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->whereNotNull('expires_at')\n ->where('expires_at', '<', now()->toDateString())\n ->get();\n }\n\n /**\n * Get all active and enabled reports with active teams for the specified frequency.\n *\n * @param string $frequency\n *\n * @return Collection<AutomatedReport>\n */\n public function getActiveReportsByFrequency(string $frequency): Collection\n {\n return AutomatedReport::where('automated_reports.status', true)\n ->where('automated_reports.frequency', $frequency)\n ->join('teams', 'automated_reports.team_id', '=', 'teams.id')\n ->where('teams.status', Team::STATUS_ACTIVE)\n ->where(function ($query) {\n $query->whereNull('automated_reports.expires_at')\n ->orWhere('automated_reports.expires_at', '>=', now()->toDateString());\n })\n ->select('automated_reports.*')\n ->get();\n }\n\n /**\n * Update an automated report\n *\n * @param AutomatedReport $report\n * @param array $data\n *\n * @return AutomatedReport\n */\n public function update(AutomatedReport $report, array $data): AutomatedReport\n {\n $report->update($data);\n\n return $report;\n }\n\n /**\n * Create a new automated report result.\n *\n * @param array $data The data to create the automated report result with.\n *\n * @return AutomatedReportResult The newly created automated report result.\n */\n public function createResult(array $data): AutomatedReportResult\n {\n return AutomatedReportResult::create($data);\n }\n\n /**\n * Find an automated report result by UUID.\n *\n * @param string $uuid The UUID to find the automated report result with.\n *\n * @return AutomatedReportResult|null The automated report result if found, otherwise null.\n */\n public function findResultByUuid(string $uuid): ?AutomatedReportResult\n {\n return AutomatedReportResult::where('uuid', AutomatedReportResult::toOptimized($uuid))->first();\n }\n\n public function findResultByUuidForUser(string $uuid, User $user): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('uuid', AutomatedReportResult::toOptimized($uuid))\n ->whereHas('report', static function ($query) use ($user): void {\n $query->where('team_id', $user->getTeamId())\n ->where('created_by', $user->getId());\n })\n ->first();\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('parent_id', $result->getId())\n ->where('media_type', $type)\n ->first();\n }\n\n public function findLatestDefaultOrFailedResult(AutomatedReport $report): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('report_id', $report->getId())\n ->whereIn('status', [AutomatedReportResult::STATUS_DEFAULT, AutomatedReportResult::STATUS_FAILED])\n ->latest()\n ->first();\n }\n\n public function getGeneratedNotSentResults(): Collection\n {\n return AutomatedReportResult::query()\n ->whereNotNull('generated_at')\n ->whereNull('sent_at')\n ->where('status', AutomatedReportResult::STATUS_GENERATED)\n ->whereHas('report')\n ->with('report')\n ->get();\n }\n\n public function getPaginatedUserReports(\n User $user,\n ReportSort $sort,\n ReportSortDirection $sortDirection,\n int $resultsPerPage,\n int $page,\n ?Carbon $fromDate,\n ?Carbon $toDate,\n array $teamIds,\n array $reportTypes,\n ?string $name,\n ): LengthAwarePaginator {\n $query = AutomatedReportResult::query()\n ->whereNotNull('automated_report_results.generated_at')\n ->join('automated_reports', 'automated_report_results.report_id', '=', 'automated_reports.id')\n ->where(fn (Builder $q) => $this->applyUserAccessScope($q, $user))\n ->orderByRaw(\"$sort->value COLLATE utf8mb4_unicode_ci {$sortDirection->value}\")\n ->select('automated_report_results.*')\n ->with('report.team');\n\n if ($fromDate !== null && $toDate !== null) {\n $query->whereBetween('generated_at', [$fromDate, $toDate]);\n }\n\n if (! empty($teamIds)) {\n $query->where(function ($q) use ($teamIds) {\n foreach ($teamIds as $id) {\n $q->orWhereJsonContains('automated_reports.groups', $id);\n }\n });\n }\n\n if (! empty($reportTypes)) {\n $query->whereIn('automated_reports.type', $reportTypes);\n }\n\n if (! empty($name)) {\n $query->whereLike('name', \"%$name%\");\n }\n\n return $query->paginate($resultsPerPage, ['*'], 'page', $page);\n }\n\n public function countUserReports(User $user): int\n {\n return AutomatedReportResult::query()\n ->whereNotNull('generated_at')\n ->whereNotNull('sent_at')\n ->whereHas('report', function ($q) use ($user) {\n $q->where('team_id', $user->getTeamId())\n ->whereJsonContains('recipients->users', $user->getId());\n })\n ->count();\n }\n\n /**\n * Restrict a query on the automated_reports table to reports the given user is allowed to see.\n *\n * Matches the customer-facing audience:\n * - explicit user recipients (recipients.users)\n * - members of any of the report's groups (Ask Jiminny reports)\n */\n private function applyUserAccessScope(Builder $query, User $user): void\n {\n $userId = $user->getId();\n $groupId = $user->getGroupId();\n\n $query\n ->where('automated_reports.team_id', $user->getTeamId())\n ->where(function (Builder $q) use ($userId, $groupId): void {\n $q->whereJsonContains('automated_reports.recipients->users', $userId);\n\n if ($groupId !== null) {\n $q->orWhere(function (Builder $sub) use ($groupId): void {\n $sub->where('automated_reports.type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->whereJsonContains('automated_reports.groups', $groupId);\n });\n }\n });\n }\n\n /**\n * Get report IDs for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Support\\Collection\n */\n public function getReportIdsByTeam(Team $team): \\Illuminate\\Support\\Collection\n {\n return AutomatedReport::where('team_id', $team->getId())->pluck('id');\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return Collection\n */\n public function getReportsByTeam(Team $team): Collection\n {\n return AutomatedReport::where('team_id', $team->getId())->get();\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return Collection\n */\n public function getResultsByReport(AutomatedReport $report): Collection\n {\n return $this->getResultsByReportQuery($report)->get();\n }\n\n public function getResultsByReportQuery(AutomatedReport $report): Builder\n {\n return AutomatedReportResult::where('report_id', $report->getId());\n }\n\n public function getReportResultsQueryForRetention(Team $team, CarbonImmutable $retentionDate): Builder\n {\n $reportIds = $this->getReportIdsByTeam($team);\n\n return AutomatedReportResult::query()->whereIn('report_id', $reportIds)\n ->whereRaw('IFNULL(generated_at, created_at) <= ?', [$retentionDate]);\n }\n\n /**\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return \\Illuminate\\Support\\Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): \\Illuminate\\Support\\Collection\n {\n $query = DB::table('automated_reports')\n ->join('teams', 'automated_reports.team_id', '=', 'teams.id')\n ->select('teams.id')\n ->distinct();\n\n if ($teamId !== null) {\n $query->where('teams.id', $teamId);\n }\n\n return $query->pluck('teams.id');\n }\n}","depth":4,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Repositories;\n\nuse Carbon\\CarbonImmutable;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Database\\Eloquent\\Collection;\nuse Illuminate\\Pagination\\LengthAwarePaginator;\nuse Illuminate\\Support\\Facades\\DB;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\AutomatedReportsService;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\ReportSort;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\ReportSortDirection;\n\nclass AutomatedReportsRepository\n{\n /**\n * Create a new automated report\n *\n * @param array $data\n *\n * @return AutomatedReport\n */\n public function create(array $data): AutomatedReport\n {\n return AutomatedReport::create($data);\n }\n\n /**\n * Find an automated report by UUID\n *\n * @param string $uuid\n *\n * @return AutomatedReport|null\n */\n public function findByUuid(string $uuid): ?AutomatedReport\n {\n return AutomatedReport::where('uuid', AutomatedReport::toOptimized($uuid))->first();\n }\n\n public function findByIdOrUuid(string $idOrUuid): ?AutomatedReport\n {\n if (is_numeric($idOrUuid)) {\n return AutomatedReport::find((int) $idOrUuid);\n }\n\n return AutomatedReport::where('uuid', AutomatedReport::toOptimized($idOrUuid))->first();\n }\n\n /**\n * Retrieve all standard (non-Ask Jiminny) automated reports.\n *\n * @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.\n * @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.\n *\n * @return Collection<AutomatedReport>\n */\n public function getAllStandardReports(\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): Collection {\n return $this->buildSortedQuery($sortColumn, $sortDirection)\n ->whereNot('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->get();\n }\n\n /**\n * Retrieve all Ask Jiminny reports created by the given user.\n *\n * @param User $user The user whose reports to retrieve.\n * @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.\n * @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.\n *\n * @return Collection<AutomatedReport>\n */\n public function getAskJiminnyReportsByUser(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): Collection {\n return $this->buildSortedQuery($sortColumn, $sortDirection)\n ->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->where('created_by', $user->getId())\n ->get();\n }\n\n private function buildSortedQuery(string $sortColumn, string $sortDirection): \\Illuminate\\Database\\Eloquent\\Builder\n {\n $allowedColumns = ['created_by', 'created_at'];\n if (! in_array($sortColumn, $allowedColumns)) {\n $sortColumn = 'created_at';\n }\n\n $sortDirection = strtolower($sortDirection) === 'asc' ? 'asc' : 'desc';\n\n $query = AutomatedReport::query()->with(['creator', 'team']);\n\n if ($sortColumn === 'created_by') {\n $query->leftJoin('users', 'users.id', '=', 'automated_reports.created_by')\n ->orderByRaw(\"users.name COLLATE utf8mb4_unicode_ci {$sortDirection}\")\n ->select('automated_reports.*');\n } else {\n $query->orderBy($sortColumn, $sortDirection);\n }\n\n return $query;\n }\n\n /**\n * Get all active Ask Jiminny reports whose expiry date has passed.\n *\n * @return Collection<AutomatedReport>\n */\n public function getExpiredActiveAskJiminnyReports(): Collection\n {\n return AutomatedReport::where('status', true)\n ->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->whereNotNull('expires_at')\n ->where('expires_at', '<', now()->toDateString())\n ->get();\n }\n\n /**\n * Get all active and enabled reports with active teams for the specified frequency.\n *\n * @param string $frequency\n *\n * @return Collection<AutomatedReport>\n */\n public function getActiveReportsByFrequency(string $frequency): Collection\n {\n return AutomatedReport::where('automated_reports.status', true)\n ->where('automated_reports.frequency', $frequency)\n ->join('teams', 'automated_reports.team_id', '=', 'teams.id')\n ->where('teams.status', Team::STATUS_ACTIVE)\n ->where(function ($query) {\n $query->whereNull('automated_reports.expires_at')\n ->orWhere('automated_reports.expires_at', '>=', now()->toDateString());\n })\n ->select('automated_reports.*')\n ->get();\n }\n\n /**\n * Update an automated report\n *\n * @param AutomatedReport $report\n * @param array $data\n *\n * @return AutomatedReport\n */\n public function update(AutomatedReport $report, array $data): AutomatedReport\n {\n $report->update($data);\n\n return $report;\n }\n\n /**\n * Create a new automated report result.\n *\n * @param array $data The data to create the automated report result with.\n *\n * @return AutomatedReportResult The newly created automated report result.\n */\n public function createResult(array $data): AutomatedReportResult\n {\n return AutomatedReportResult::create($data);\n }\n\n /**\n * Find an automated report result by UUID.\n *\n * @param string $uuid The UUID to find the automated report result with.\n *\n * @return AutomatedReportResult|null The automated report result if found, otherwise null.\n */\n public function findResultByUuid(string $uuid): ?AutomatedReportResult\n {\n return AutomatedReportResult::where('uuid', AutomatedReportResult::toOptimized($uuid))->first();\n }\n\n public function findResultByUuidForUser(string $uuid, User $user): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('uuid', AutomatedReportResult::toOptimized($uuid))\n ->whereHas('report', static function ($query) use ($user): void {\n $query->where('team_id', $user->getTeamId())\n ->where('created_by', $user->getId());\n })\n ->first();\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('parent_id', $result->getId())\n ->where('media_type', $type)\n ->first();\n }\n\n public function findLatestDefaultOrFailedResult(AutomatedReport $report): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('report_id', $report->getId())\n ->whereIn('status', [AutomatedReportResult::STATUS_DEFAULT, AutomatedReportResult::STATUS_FAILED])\n ->latest()\n ->first();\n }\n\n public function getGeneratedNotSentResults(): Collection\n {\n return AutomatedReportResult::query()\n ->whereNotNull('generated_at')\n ->whereNull('sent_at')\n ->where('status', AutomatedReportResult::STATUS_GENERATED)\n ->whereHas('report')\n ->with('report')\n ->get();\n }\n\n public function getPaginatedUserReports(\n User $user,\n ReportSort $sort,\n ReportSortDirection $sortDirection,\n int $resultsPerPage,\n int $page,\n ?Carbon $fromDate,\n ?Carbon $toDate,\n array $teamIds,\n array $reportTypes,\n ?string $name,\n ): LengthAwarePaginator {\n $query = AutomatedReportResult::query()\n ->whereNotNull('automated_report_results.generated_at')\n ->join('automated_reports', 'automated_report_results.report_id', '=', 'automated_reports.id')\n ->where(fn (Builder $q) => $this->applyUserAccessScope($q, $user))\n ->orderByRaw(\"$sort->value COLLATE utf8mb4_unicode_ci {$sortDirection->value}\")\n ->select('automated_report_results.*')\n ->with('report.team');\n\n if ($fromDate !== null && $toDate !== null) {\n $query->whereBetween('generated_at', [$fromDate, $toDate]);\n }\n\n if (! empty($teamIds)) {\n $query->where(function ($q) use ($teamIds) {\n foreach ($teamIds as $id) {\n $q->orWhereJsonContains('automated_reports.groups', $id);\n }\n });\n }\n\n if (! empty($reportTypes)) {\n $query->whereIn('automated_reports.type', $reportTypes);\n }\n\n if (! empty($name)) {\n $query->whereLike('name', \"%$name%\");\n }\n\n return $query->paginate($resultsPerPage, ['*'], 'page', $page);\n }\n\n public function countUserReports(User $user): int\n {\n return AutomatedReportResult::query()\n ->whereNotNull('generated_at')\n ->whereNotNull('sent_at')\n ->whereHas('report', function ($q) use ($user) {\n $q->where('team_id', $user->getTeamId())\n ->whereJsonContains('recipients->users', $user->getId());\n })\n ->count();\n }\n\n /**\n * Restrict a query on the automated_reports table to reports the given user is allowed to see.\n *\n * Matches the customer-facing audience:\n * - explicit user recipients (recipients.users)\n * - members of any of the report's groups (Ask Jiminny reports)\n */\n private function applyUserAccessScope(Builder $query, User $user): void\n {\n $userId = $user->getId();\n $groupId = $user->getGroupId();\n\n $query\n ->where('automated_reports.team_id', $user->getTeamId())\n ->where(function (Builder $q) use ($userId, $groupId): void {\n $q->whereJsonContains('automated_reports.recipients->users', $userId);\n\n if ($groupId !== null) {\n $q->orWhere(function (Builder $sub) use ($groupId): void {\n $sub->where('automated_reports.type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->whereJsonContains('automated_reports.groups', $groupId);\n });\n }\n });\n }\n\n /**\n * Get report IDs for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Support\\Collection\n */\n public function getReportIdsByTeam(Team $team): \\Illuminate\\Support\\Collection\n {\n return AutomatedReport::where('team_id', $team->getId())->pluck('id');\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return Collection\n */\n public function getReportsByTeam(Team $team): Collection\n {\n return AutomatedReport::where('team_id', $team->getId())->get();\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return Collection\n */\n public function getResultsByReport(AutomatedReport $report): Collection\n {\n return $this->getResultsByReportQuery($report)->get();\n }\n\n public function getResultsByReportQuery(AutomatedReport $report): Builder\n {\n return AutomatedReportResult::where('report_id', $report->getId());\n }\n\n public function getReportResultsQueryForRetention(Team $team, CarbonImmutable $retentionDate): Builder\n {\n $reportIds = $this->getReportIdsByTeam($team);\n\n return AutomatedReportResult::query()->whereIn('report_id', $reportIds)\n ->whereRaw('IFNULL(generated_at, created_at) <= ?', [$retentionDate]);\n }\n\n /**\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return \\Illuminate\\Support\\Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): \\Illuminate\\Support\\Collection\n {\n $query = DB::table('automated_reports')\n ->join('teams', 'automated_reports.team_id', '=', 'teams.id')\n ->select('teams.id')\n ->distinct();\n\n if ($teamId !== null) {\n $query->where('teams.id', $teamId);\n }\n\n return $query->pluck('teams.id');\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
3416807590481448167
|
-8346525445950329248
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsServiceTest
Run 'AutomatedReportsServiceTest'
Debug 'AutomatedReportsServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
whereHas
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
3/3
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
18
7
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Repositories;
use Carbon\CarbonImmutable;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Facades\DB;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\Kiosk\AutomatedReports\ReportSort;
use Jiminny\Services\Kiosk\AutomatedReports\ReportSortDirection;
class AutomatedReportsRepository
{
/**
* Create a new automated report
*
* @param array $data
*
* @return AutomatedReport
*/
public function create(array $data): AutomatedReport
{
return AutomatedReport::create($data);
}
/**
* Find an automated report by UUID
*
* @param string $uuid
*
* @return AutomatedReport|null
*/
public function findByUuid(string $uuid): ?AutomatedReport
{
return AutomatedReport::where('uuid', AutomatedReport::toOptimized($uuid))->first();
}
public function findByIdOrUuid(string $idOrUuid): ?AutomatedReport
{
if (is_numeric($idOrUuid)) {
return AutomatedReport::find((int) $idOrUuid);
}
return AutomatedReport::where('uuid', AutomatedReport::toOptimized($idOrUuid))->first();
}
/**
* Retrieve all standard (non-Ask Jiminny) automated reports.
*
* @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.
* @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.
*
* @return Collection<AutomatedReport>
*/
public function getAllStandardReports(
string $sortColumn = 'created_at',
string $sortDirection = 'desc'
): Collection {
return $this->buildSortedQuery($sortColumn, $sortDirection)
->whereNot('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->get();
}
/**
* Retrieve all Ask Jiminny reports created by the given user.
*
* @param User $user The user whose reports to retrieve.
* @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.
* @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.
*
* @return Collection<AutomatedReport>
*/
public function getAskJiminnyReportsByUser(
User $user,
string $sortColumn = 'created_at',
string $sortDirection = 'desc'
): Collection {
return $this->buildSortedQuery($sortColumn, $sortDirection)
->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->where('created_by', $user->getId())
->get();
}
private function buildSortedQuery(string $sortColumn, string $sortDirection): \Illuminate\Database\Eloquent\Builder
{
$allowedColumns = ['created_by', 'created_at'];
if (! in_array($sortColumn, $allowedColumns)) {
$sortColumn = 'created_at';
}
$sortDirection = strtolower($sortDirection) === 'asc' ? 'asc' : 'desc';
$query = AutomatedReport::query()->with(['creator', 'team']);
if ($sortColumn === 'created_by') {
$query->leftJoin('users', 'users.id', '=', 'automated_reports.created_by')
->orderByRaw("users.name COLLATE utf8mb4_unicode_ci {$sortDirection}")
->select('automated_reports.*');
} else {
$query->orderBy($sortColumn, $sortDirection);
}
return $query;
}
/**
* Get all active Ask Jiminny reports whose expiry date has passed.
*
* @return Collection<AutomatedReport>
*/
public function getExpiredActiveAskJiminnyReports(): Collection
{
return AutomatedReport::where('status', true)
->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->whereNotNull('expires_at')
->where('expires_at', '<', now()->toDateString())
->get();
}
/**
* Get all active and enabled reports with active teams for the specified frequency.
*
* @param string $frequency
*
* @return Collection<AutomatedReport>
*/
public function getActiveReportsByFrequency(string $frequency): Collection
{
return AutomatedReport::where('automated_reports.status', true)
->where('automated_reports.frequency', $frequency)
->join('teams', 'automated_reports.team_id', '=', 'teams.id')
->where('teams.status', Team::STATUS_ACTIVE)
->where(function ($query) {
$query->whereNull('automated_reports.expires_at')
->orWhere('automated_reports.expires_at', '>=', now()->toDateString());
})
->select('automated_reports.*')
->get();
}
/**
* Update an automated report
*
* @param AutomatedReport $report
* @param array $data
*
* @return AutomatedReport
*/
public function update(AutomatedReport $report, array $data): AutomatedReport
{
$report->update($data);
return $report;
}
/**
* Create a new automated report result.
*
* @param array $data The data to create the automated report result with.
*
* @return AutomatedReportResult The newly created automated report result.
*/
public function createResult(array $data): AutomatedReportResult
{
return AutomatedReportResult::create($data);
}
/**
* Find an automated report result by UUID.
*
* @param string $uuid The UUID to find the automated report result with.
*
* @return AutomatedReportResult|null The automated report result if found, otherwise null.
*/
public function findResultByUuid(string $uuid): ?AutomatedReportResult
{
return AutomatedReportResult::where('uuid', AutomatedReportResult::toOptimized($uuid))->first();
}
public function findResultByUuidForUser(string $uuid, User $user): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('uuid', AutomatedReportResult::toOptimized($uuid))
->whereHas('report', static function ($query) use ($user): void {
$query->where('team_id', $user->getTeamId())
->where('created_by', $user->getId());
})
->first();
}
public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('parent_id', $result->getId())
->where('media_type', $type)
->first();
}
public function findLatestDefaultOrFailedResult(AutomatedReport $report): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('report_id', $report->getId())
->whereIn('status', [AutomatedReportResult::STATUS_DEFAULT, AutomatedReportResult::STATUS_FAILED])
->latest()
->first();
}
public function getGeneratedNotSentResults(): Collection
{
return AutomatedReportResult::query()
->whereNotNull('generated_at')
->whereNull('sent_at')
->where('status', AutomatedReportResult::STATUS_GENERATED)
->whereHas('report')
->with('report')
->get();
}
public function getPaginatedUserReports(
User $user,
ReportSort $sort,
ReportSortDirection $sortDirection,
int $resultsPerPage,
int $page,
?Carbon $fromDate,
?Carbon $toDate,
array $teamIds,
array $reportTypes,
?string $name,
): LengthAwarePaginator {
$query = AutomatedReportResult::query()
->whereNotNull('automated_report_results.generated_at')
->join('automated_reports', 'automated_report_results.report_id', '=', 'automated_reports.id')
->where(fn (Builder $q) => $this->applyUserAccessScope($q, $user))
->orderByRaw("$sort->value COLLATE utf8mb4_unicode_ci {$sortDirection->value}")
->select('automated_report_results.*')
->with('report.team');
if ($fromDate !== null && $toDate !== null) {
$query->whereBetween('generated_at', [$fromDate, $toDate]);
}
if (! empty($teamIds)) {
$query->where(function ($q) use ($teamIds) {
foreach ($teamIds as $id) {
$q->orWhereJsonContains('automated_reports.groups', $id);
}
});
}
if (! empty($reportTypes)) {
$query->whereIn('automated_reports.type', $reportTypes);
}
if (! empty($name)) {
$query->whereLike('name', "%$name%");
}
return $query->paginate($resultsPerPage, ['*'], 'page', $page);
}
public function countUserReports(User $user): int
{
return AutomatedReportResult::query()
->whereNotNull('generated_at')
->whereNotNull('sent_at')
->whereHas('report', function ($q) use ($user) {
$q->where('team_id', $user->getTeamId())
->whereJsonContains('recipients->users', $user->getId());
})
->count();
}
/**
* Restrict a query on the automated_reports table to reports the given user is allowed to see.
*
* Matches the customer-facing audience:
* - explicit user recipients (recipients.users)
* - members of any of the report's groups (Ask Jiminny reports)
*/
private function applyUserAccessScope(Builder $query, User $user): void
{
$userId = $user->getId();
$groupId = $user->getGroupId();
$query
->where('automated_reports.team_id', $user->getTeamId())
->where(function (Builder $q) use ($userId, $groupId): void {
$q->whereJsonContains('automated_reports.recipients->users', $userId);
if ($groupId !== null) {
$q->orWhere(function (Builder $sub) use ($groupId): void {
$sub->where('automated_reports.type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->whereJsonContains('automated_reports.groups', $groupId);
});
}
});
}
/**
* Get report IDs for a specific team
*
* @param Team $team
*
* @return \Illuminate\Support\Collection
*/
public function getReportIdsByTeam(Team $team): \Illuminate\Support\Collection
{
return AutomatedReport::where('team_id', $team->getId())->pluck('id');
}
/**
* Get all reports for a specific team
*
* @param Team $team
*
* @return Collection
*/
public function getReportsByTeam(Team $team): Collection
{
return AutomatedReport::where('team_id', $team->getId())->get();
}
/**
* Get all report results for a specific report
*
* @param AutomatedReport $report
*
* @return Collection
*/
public function getResultsByReport(AutomatedReport $report): Collection
{
return $this->getResultsByReportQuery($report)->get();
}
public function getResultsByReportQuery(AutomatedReport $report): Builder
{
return AutomatedReportResult::where('report_id', $report->getId());
}
public function getReportResultsQueryForRetention(Team $team, CarbonImmutable $retentionDate): Builder
{
$reportIds = $this->getReportIdsByTeam($team);
return AutomatedReportResult::query()->whereIn('report_id', $reportIds)
->whereRaw('IFNULL(generated_at, created_at) <= ?', [$retentionDate]);
}
/**
* @param int|null $teamId Optional team ID to filter results
*
* @return \Illuminate\Support\Collection<int, int> Collection of team IDs
*/
public function getTeamIdsWithReportsResults(?int $teamId = null): \Illuminate\Support\Collection
{
$query = DB::table('automated_reports')
->join('teams', 'automated_reports.team_id', '=', 'teams.id')
->select('teams.id')
->distinct();
if ($teamId !== null) {
$query->where('teams.id', $teamId);
}
return $query->pluck('teams.id');
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification...
|
NULL
|
|
67051
|
1512
|
0
|
2026-04-21T15:25:30.466356+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776785130466_m2.jpg...
|
PhpStorm
|
faVsco.js – AutomatedReportsRepository.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsServiceTest
Run 'AutomatedReportsServiceTest'
Debug 'AutomatedReportsServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
whereHas
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
3/3
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
16
7
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Repositories;
use Carbon\CarbonImmutable;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Facades\DB;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\Kiosk\AutomatedReports\ReportSort;
use Jiminny\Services\Kiosk\AutomatedReports\ReportSortDirection;
class AutomatedReportsRepository
{
/**
* Create a new automated report
*
* @param array $data
*
* @return AutomatedReport
*/
public function create(array $data): AutomatedReport
{
return AutomatedReport::create($data);
}
/**
* Find an automated report by UUID
*
* @param string $uuid
*
* @return AutomatedReport|null
*/
public function findByUuid(string $uuid): ?AutomatedReport
{
return AutomatedReport::where('uuid', AutomatedReport::toOptimized($uuid))->first();
}
public function findByIdOrUuid(string $idOrUuid): ?AutomatedReport
{
if (is_numeric($idOrUuid)) {
return AutomatedReport::find((int) $idOrUuid);
}
return AutomatedReport::where('uuid', AutomatedReport::toOptimized($idOrUuid))->first();
}
/**
* Retrieve all standard (non-Ask Jiminny) automated reports.
*
* @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.
* @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.
*
* @return Collection<AutomatedReport>
*/
public function getAllStandardReports(
string $sortColumn = 'created_at',
string $sortDirection = 'desc'
): Collection {
return $this->buildSortedQuery($sortColumn, $sortDirection)
->whereNot('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->get();
}
/**
* Retrieve all Ask Jiminny reports created by the given user.
*
* @param User $user The user whose reports to retrieve.
* @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.
* @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.
*
* @return Collection<AutomatedReport>
*/
public function getAskJiminnyReportsByUser(
User $user,
string $sortColumn = 'created_at',
string $sortDirection = 'desc'
): Collection {
return $this->buildSortedQuery($sortColumn, $sortDirection)
->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->where('created_by', $user->getId())
->get();
}
private function buildSortedQuery(string $sortColumn, string $sortDirection): \Illuminate\Database\Eloquent\Builder
{
$allowedColumns = ['created_by', 'created_at'];
if (! in_array($sortColumn, $allowedColumns)) {
$sortColumn = 'created_at';
}
$sortDirection = strtolower($sortDirection) === 'asc' ? 'asc' : 'desc';
$query = AutomatedReport::query()->with(['creator', 'team']);
if ($sortColumn === 'created_by') {
$query->leftJoin('users', 'users.id', '=', 'automated_reports.created_by')
->orderByRaw("users.name COLLATE utf8mb4_unicode_ci {$sortDirection}")
->select('automated_reports.*');
} else {
$query->orderBy($sortColumn, $sortDirection);
}
return $query;
}
/**
* Get all active Ask Jiminny reports whose expiry date has passed.
*
* @return Collection<AutomatedReport>
*/
public function getExpiredActiveAskJiminnyReports(): Collection
{
return AutomatedReport::where('status', true)
->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->whereNotNull('expires_at')
->where('expires_at', '<', now()->toDateString())
->get();
}
/**
* Get all active and enabled reports with active teams for the specified frequency.
*
* @param string $frequency
*
* @return Collection<AutomatedReport>
*/
public function getActiveReportsByFrequency(string $frequency): Collection
{
return AutomatedReport::where('automated_reports.status', true)
->where('automated_reports.frequency', $frequency)
->join('teams', 'automated_reports.team_id', '=', 'teams.id')
->where('teams.status', Team::STATUS_ACTIVE)
->where(function ($query) {
$query->whereNull('automated_reports.expires_at')
->orWhere('automated_reports.expires_at', '>=', now()->toDateString());
})
->select('automated_reports.*')
->get();
}
/**
* Update an automated report
*
* @param AutomatedReport $report
* @param array $data
*
* @return AutomatedReport
*/
public function update(AutomatedReport $report, array $data): AutomatedReport
{
$report->update($data);
return $report;
}
/**
* Create a new automated report result.
*
* @param array $data The data to create the automated report result with.
*
* @return AutomatedReportResult The newly created automated report result.
*/
public function createResult(array $data): AutomatedReportResult
{
return AutomatedReportResult::create($data);
}
/**
* Find an automated report result by UUID.
*
* @param string $uuid The UUID to find the automated report result with.
*
* @return AutomatedReportResult|null The automated report result if found, otherwise null.
*/
public function findResultByUuid(string $uuid): ?AutomatedReportResult
{
return AutomatedReportResult::where('uuid', AutomatedReportResult::toOptimized($uuid))->first();
}
public function findResultByUuidForUser(string $uuid, User $user): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('uuid', AutomatedReportResult::toOptimized($uuid))
->whereHas('report', static function ($query) use ($user): void {
$query->where('team_id', $user->getTeamId())
->where('created_by', $user->getId());
})
->first();
}
public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('parent_id', $result->getId())
->where('media_type', $type)
->first();
}
public function findLatestDefaultOrFailedResult(AutomatedReport $report): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('report_id', $report->getId())
->whereIn('status', [AutomatedReportResult::STATUS_DEFAULT, AutomatedReportResult::STATUS_FAILED])
->latest()
->first();
}
public function getGeneratedNotSentResults(): Collection
{
return AutomatedReportResult::query()
->whereNotNull('generated_at')
->whereNull('sent_at')
->where('status', AutomatedReportResult::STATUS_GENERATED)
->whereHas('report')
->with('report')
->get();
}
public function getPaginatedUserReports(
User $user,
ReportSort $sort,
ReportSortDirection $sortDirection,
int $resultsPerPage,
int $page,
?Carbon $fromDate,
?Carbon $toDate,
array $teamIds,
array $reportTypes,
?string $name,
): LengthAwarePaginator {
$query = AutomatedReportResult::query()
->whereNotNull('automated_report_results.generated_at')
->join('automated_reports', 'automated_report_results.report_id', '=', 'automated_reports.id')
->where(fn (Builder $q) => $this->applyUserAccessScope($q, $user))
->orderByRaw("$sort->value COLLATE utf8mb4_unicode_ci {$sortDirection->value}")
->select('automated_report_results.*')
->with('report.team');
if ($fromDate !== null && $toDate !== null) {
$query->whereBetween('generated_at', [$fromDate, $toDate]);
}
if (! empty($teamIds)) {
$query->where(function ($q) use ($teamIds) {
foreach ($teamIds as $id) {
$q->orWhereJsonContains('automated_reports.groups', $id);
}
});
}
if (! empty($reportTypes)) {
$query->whereIn('automated_reports.type', $reportTypes);
}
if (! empty($name)) {
$query->whereLike('name', "%$name%");
}
return $query->paginate($resultsPerPage, ['*'], 'page', $page);
}
public function countUserReports(User $user): int
{
return AutomatedReportResult::query()
->whereNotNull('generated_at')
->whereNotNull('sent_at')
->whereHas('report', function ($q) use ($user) {
$q->where('team_id', $user->getTeamId())
->whereJsonContains('recipients->users', $user->getId());
})
->count();
}
/**
* Restrict a query on the automated_reports table to reports the given user is allowed to see.
*
* Matches the customer-facing audience:
* - explicit user recipients (recipients.users)
* - members of any of the report's groups (Ask Jiminny reports)
*/
private function applyUserAccessScope(Builder $query, User $user): void
{
$userId = $user->getId();
$groupId = $user->getGroupId();
$query
->where('automated_reports.team_id', $user->getTeamId())
->where(function (Builder $q) use ($userId, $groupId): void {
$q->whereJsonContains('automated_reports.recipients->users', $userId);
if ($groupId !== null) {
$q->orWhere(function (Builder $sub) use ($groupId): void {
$sub->where('automated_reports.type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->whereJsonContains('automated_reports.groups', $groupId);
});
}
});
}
/**
* Get report IDs for a specific team
*
* @param Team $team
*
* @return \Illuminate\Support\Collection
*/
public function getReportIdsByTeam(Team $team): \Illuminate\Support\Collection
{
return AutomatedReport::where('team_id', $team->getId())->pluck('id');
}
/**
* Get all reports for a specific team
*
* @param Team $team
*
* @return Collection
*/
public function getReportsByTeam(Team $team): Collection
{
return AutomatedReport::where('team_id', $team->getId())->get();
}
/**
* Get all report results for a specific report
*
* @param AutomatedReport $report
*
* @return Collection
*/
public function getResultsByReport(AutomatedReport $report): Collection
{
return $this->getResultsByReportQuery($report)->get();
}
public function getResultsByReportQuery(AutomatedReport $report): Builder
{
return AutomatedReportResult::where('report_id', $report->getId());
}
public function getReportResultsQueryForRetention(Team $team, CarbonImmutable $retentionDate): Builder
{
$reportIds = $this->getReportIdsByTeam($team);
return AutomatedReportResult::query()->whereIn('report_id', $reportIds)
->whereRaw('IFNULL(generated_at, created_at) <= ?', [$retentionDate]);
}
/**
* @param int|null $teamId Optional team ID to filter results
*
* @return \Illuminate\Support\Collection<int, int> Collection of team IDs
*/
public function getTeamIdsWithReportsResults(?int $teamId = null): \Illuminate\Support\Collection
{
$query = DB::table('automated_reports')
->join('teams', 'automated_reports.team_id', '=', 'teams.id')
->select('teams.id')
->distinct();
if ($teamId !== null) {
$query->where('teams.id', $teamId);
}
return $query->pluck('teams.id');
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
18
14
2
4
Previous Highlighted Error
Next Highlighted Error
SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o
JOIN activities a ON o.id = a.opportunity_id
WHERE a.crm_configuration_id = 39
AND a.actual_start_time > '2025-10-13'
AND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')
;
SELECT * FROM activities
WHERE crm_configuration_id = 39 and user_id = 143
and actual_start_time >= '2025-10-13'
AND type IN ('conference', 'softphone-inbound', 'softphone-outbound')
;
SELECT * FROM opportunities WHERE account_id IN (178);
select * from activities where id IN (620137, 620187, 620188, 620189, 620230);
# HS
SELECT * FROM opportunities WHERE id IN (238);
select * from activities where id IN (477,2076);
select * from users;
SELECT COUNT(*) FROM users;
SELECT COUNT(*) FROM activities;
SELECT COUNT(*) FROM opportunities;
UPDATE activities
SET
actual_start_time = '2025-12-19 09:00:00',
actual_end_time = '2025-12-19 10:30:00',
scheduled_start_time = '2025-12-19 09:00:00',
scheduled_end_time = '2025-12-19 10:30:00'
WHERE id IN (407509,407375);
select * from partners;
SELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id
FROM activities
WHERE user_id = 143
AND actual_start_time >= '2025-10-13 00:00:00'
AND actual_start_time <= '2026-01-13 23:59:59'
ORDER BY actual_start_time DESC;
SELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;
SELECT * FROM crm_layouts where crm_configuration_id = 39;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;
# lead_id
# account_id 177
# contact_id 3969
# opportunity_id
# stage_id 203
SELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;
SELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'
AND user_id = 143 and actual_start_time >= '2025-10-13';
SELECT * FROM activities a
# JOIN opportunities o ON a.opportunity_id = o.id
WHERE a.crm_configuration_id = 39 AND a.type = 'conference'
and status = 'completed' and recording_state = 'recorded'
and a.actual_start_time >= '2025-10-13'
AND a.user_id = 143
;
select * from leads
where crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707
SELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);
SELECT * FROM activities WHERE id IN (356013,616188,616202,616310);
SELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198
SELECT * FROM activities WHERE id IN (356001, 356008); # contacts:
SELECT * FROM opportunities WHERE id IN (1707);
SELECT * FROM stages where id IN (204, 198);
SELECT * FROM opportunities WHERE account_id IN (178);
SELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';
SELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal
SELECT * FROM activities where crm_configuration_id = 39
AND opportunity_id IS NULL
AND is_internal = false
and status = 'completed' and recording_state = 'recorded'
AND actual_start_time >= '2025-10-13'
AND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)
# AND lead_id IN (112, 109)
;
SELECT * FROM crm_profiles WHERE user_id = 143;
select * from inboxes; # 212
select * from users where id = 143; # 143
select * from inbox_email_batches where inbox_id = 212
and updated_at >= '2026-01-28 00:00:00' order by id desc;
select * from inbox_emails where inbox_id = 212
and batch_id = 95885 order by id desc;
select * from email_messages where origin_user_id = 143;
select * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';
select * from participants where activity_id = 620247;
select * from crm_profiles where user_id = 143;
SELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001
select * from transcription where activity_id = 356001; # 6943
select * from ai_prompts where transcription_id = 6943;
SELECT * FROM activity_summary_logs where activity_id = 356001;
SELECT * FROM social_accounts WHERE sociable_id = 143;
# [PASSWORD_DOTS]
SELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;
# 422515 softphone tr. 8100
SELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;
# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS
select * from ai_prompts where transcription_id IN (8100, 7670);
select * from activity_summary_logs where activity_id = 407509;
select * from sidekick_settings;
select * from default_activity_types;
SELECT * FROM contacts WHERE crm_configuration_id = 39 and email = '[EMAIL]';
SELECT * FROM leads WHERE crm_configuration_id = 39 and email = '[EMAIL]';
SELECT * FROM activity_searches where user_id = 143;
SELECT * FROM groups where team_id = 1;
select * from teams where id = 1;
select * from groups where team_id = 1; # 1150 - 7e75f8025c22
select id, name, group_id, status, deleted_at, email
from users where team_id = 1 order by group_id desc ;
select * from activity_searches where id in (1977, 1978, 1979);
select * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);
select * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277
select * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879
INSERT INTO `activity_search_filters`
(`activity_search_id`, `filter`, `value`) VALUES
(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),
(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),
(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')
;
select * from crm_configurations where id = 39;
select sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id
where u.team_id = 1;
SELECT * FROM social_accounts WHERE sociable_id = 1635;
SELECT * FROM users WHERE id = 1635;
select * from teams where id = 1;
select * from users where team_id = 1;
select * from team_features where team_id = 1;
select * from features;
SELECT * FROM activity_searches where id = 1982; # 1981
SELECT * FROM activity_search_filters WHERE activity_search_id = 1982;
SELECT * FROM automated_reports where id = 68;
UPDATE automated_reports set playbook_categories = NULL where id = 68;
SELECT * FROM automated_report_results where id = 275;
SELECT * FROM automated_reports order by id desc;
SELECT * FROM automated_report_results order by id desc;
select * from activity_searches where user_id = 143;
select * from ask_anything_prompts;
SELECT * FROM groups WHERE id = 1439;
SELECT * FROM users WHERE group_id = 1439;
select * from permissions; # 158
select * from roles;
select * from permission_role
select * from teams where id = 1;
select * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;
select * from groups where id = 28;
select * from playbooks where team_id = 1;
select * from playbooks where id = 179;
select * from playbook_categories where id = 1391;
select * from users where id = 143;
select * from crm_profiles where user_id = 143;
select * from activities where crm_configuration_id = 39 and type = 'conference'
and crm_provider_id IS NOT NULL ORDER by id desc;
select * from activities where id = 422003; # 00UO400000pB6fpMAC
SELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type
FROM automated_report_results ar
JOIN automated_reports a ON a.id = ar.report_id
WHERE a.type = 'ask_jiminny'
LIMIT 10;
SELECT `automated_report_results`.* FROM `automated_report_results`
INNER JOIN `automated_reports`
ON `automated_report_results`.`report_id` = `automated_reports`.`id`
WHERE `automated_report_results`.`generated_at` IS NOT NULL
AND `automated_reports`.`team_id` = 1
AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$."users"')
;
select * from teams where id = 3143;
select * from crm_configurations where id = 500;
select * from users where name = 'Integration Account'; # 1695
SELECT * FROM social_accounts WHERE sociable_id = 1695;
select * from activities where crm_configuration_id = 39
and recording_state = 'recorded' and duration > 60
and status = 'completed' and actual_start_time >= '2025-12-01';
SELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;
select * from leads;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"#11894 on JY-18909-automated-reports-ask-jiminny, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.12134308,"height":0.025538707},"help_text":"Pull request #11894 exists for current branch JY-18909-automated-reports-ask-jiminny","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8218085,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AutomatedReportsServiceTest","depth":6,"bounds":{"left":0.83710104,"top":0.019952115,"width":0.078457445,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AutomatedReportsServiceTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AutomatedReportsServiceTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"bounds":{"left":0.12101064,"top":0.20430966,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"bounds":{"left":0.13364361,"top":0.20351157,"width":0.00731383,"height":0.017557861},"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"whereHas","depth":4,"bounds":{"left":0.14461437,"top":0.20351157,"width":0.06050532,"height":0.015961692},"value":"whereHas","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.21409574,"top":0.20351157,"width":0.00731383,"height":0.017557861},"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"bounds":{"left":0.22406915,"top":0.20351157,"width":0.00731383,"height":0.017557861},"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"bounds":{"left":0.23271276,"top":0.20351157,"width":0.00731383,"height":0.017557861},"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"bounds":{"left":0.24135639,"top":0.20351157,"width":0.00731383,"height":0.017557861},"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"3/3","depth":4,"bounds":{"left":0.2549867,"top":0.20271349,"width":0.025598405,"height":0.017557861},"role_description":"text"},{"role":"AXButton","text":"Previous Occurrence","depth":4,"bounds":{"left":0.2805851,"top":0.2019154,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Occurrence","depth":4,"bounds":{"left":0.28922874,"top":0.2019154,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Filter Search Results","depth":4,"bounds":{"left":0.29787233,"top":0.2019154,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open in Window, Multiple Cursors","depth":4,"bounds":{"left":0.30651596,"top":0.2019154,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Click to highlight","depth":4,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close","depth":4,"bounds":{"left":0.4870346,"top":0.2019154,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"16","depth":4,"bounds":{"left":0.4481383,"top":0.2330407,"width":0.009640957,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"7","depth":4,"bounds":{"left":0.45977393,"top":0.2330407,"width":0.0076462766,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.4694149,"top":0.2330407,"width":0.00731383,"height":0.015163607},"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.47839096,"top":0.23144454,"width":0.00731383,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.48570478,"top":0.23144454,"width":0.006981383,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Repositories;\n\nuse Carbon\\CarbonImmutable;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Database\\Eloquent\\Collection;\nuse Illuminate\\Pagination\\LengthAwarePaginator;\nuse Illuminate\\Support\\Facades\\DB;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\AutomatedReportsService;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\ReportSort;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\ReportSortDirection;\n\nclass AutomatedReportsRepository\n{\n /**\n * Create a new automated report\n *\n * @param array $data\n *\n * @return AutomatedReport\n */\n public function create(array $data): AutomatedReport\n {\n return AutomatedReport::create($data);\n }\n\n /**\n * Find an automated report by UUID\n *\n * @param string $uuid\n *\n * @return AutomatedReport|null\n */\n public function findByUuid(string $uuid): ?AutomatedReport\n {\n return AutomatedReport::where('uuid', AutomatedReport::toOptimized($uuid))->first();\n }\n\n public function findByIdOrUuid(string $idOrUuid): ?AutomatedReport\n {\n if (is_numeric($idOrUuid)) {\n return AutomatedReport::find((int) $idOrUuid);\n }\n\n return AutomatedReport::where('uuid', AutomatedReport::toOptimized($idOrUuid))->first();\n }\n\n /**\n * Retrieve all standard (non-Ask Jiminny) automated reports.\n *\n * @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.\n * @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.\n *\n * @return Collection<AutomatedReport>\n */\n public function getAllStandardReports(\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): Collection {\n return $this->buildSortedQuery($sortColumn, $sortDirection)\n ->whereNot('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->get();\n }\n\n /**\n * Retrieve all Ask Jiminny reports created by the given user.\n *\n * @param User $user The user whose reports to retrieve.\n * @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.\n * @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.\n *\n * @return Collection<AutomatedReport>\n */\n public function getAskJiminnyReportsByUser(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): Collection {\n return $this->buildSortedQuery($sortColumn, $sortDirection)\n ->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->where('created_by', $user->getId())\n ->get();\n }\n\n private function buildSortedQuery(string $sortColumn, string $sortDirection): \\Illuminate\\Database\\Eloquent\\Builder\n {\n $allowedColumns = ['created_by', 'created_at'];\n if (! in_array($sortColumn, $allowedColumns)) {\n $sortColumn = 'created_at';\n }\n\n $sortDirection = strtolower($sortDirection) === 'asc' ? 'asc' : 'desc';\n\n $query = AutomatedReport::query()->with(['creator', 'team']);\n\n if ($sortColumn === 'created_by') {\n $query->leftJoin('users', 'users.id', '=', 'automated_reports.created_by')\n ->orderByRaw(\"users.name COLLATE utf8mb4_unicode_ci {$sortDirection}\")\n ->select('automated_reports.*');\n } else {\n $query->orderBy($sortColumn, $sortDirection);\n }\n\n return $query;\n }\n\n /**\n * Get all active Ask Jiminny reports whose expiry date has passed.\n *\n * @return Collection<AutomatedReport>\n */\n public function getExpiredActiveAskJiminnyReports(): Collection\n {\n return AutomatedReport::where('status', true)\n ->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->whereNotNull('expires_at')\n ->where('expires_at', '<', now()->toDateString())\n ->get();\n }\n\n /**\n * Get all active and enabled reports with active teams for the specified frequency.\n *\n * @param string $frequency\n *\n * @return Collection<AutomatedReport>\n */\n public function getActiveReportsByFrequency(string $frequency): Collection\n {\n return AutomatedReport::where('automated_reports.status', true)\n ->where('automated_reports.frequency', $frequency)\n ->join('teams', 'automated_reports.team_id', '=', 'teams.id')\n ->where('teams.status', Team::STATUS_ACTIVE)\n ->where(function ($query) {\n $query->whereNull('automated_reports.expires_at')\n ->orWhere('automated_reports.expires_at', '>=', now()->toDateString());\n })\n ->select('automated_reports.*')\n ->get();\n }\n\n /**\n * Update an automated report\n *\n * @param AutomatedReport $report\n * @param array $data\n *\n * @return AutomatedReport\n */\n public function update(AutomatedReport $report, array $data): AutomatedReport\n {\n $report->update($data);\n\n return $report;\n }\n\n /**\n * Create a new automated report result.\n *\n * @param array $data The data to create the automated report result with.\n *\n * @return AutomatedReportResult The newly created automated report result.\n */\n public function createResult(array $data): AutomatedReportResult\n {\n return AutomatedReportResult::create($data);\n }\n\n /**\n * Find an automated report result by UUID.\n *\n * @param string $uuid The UUID to find the automated report result with.\n *\n * @return AutomatedReportResult|null The automated report result if found, otherwise null.\n */\n public function findResultByUuid(string $uuid): ?AutomatedReportResult\n {\n return AutomatedReportResult::where('uuid', AutomatedReportResult::toOptimized($uuid))->first();\n }\n\n public function findResultByUuidForUser(string $uuid, User $user): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('uuid', AutomatedReportResult::toOptimized($uuid))\n ->whereHas('report', static function ($query) use ($user): void {\n $query->where('team_id', $user->getTeamId())\n ->where('created_by', $user->getId());\n })\n ->first();\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('parent_id', $result->getId())\n ->where('media_type', $type)\n ->first();\n }\n\n public function findLatestDefaultOrFailedResult(AutomatedReport $report): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('report_id', $report->getId())\n ->whereIn('status', [AutomatedReportResult::STATUS_DEFAULT, AutomatedReportResult::STATUS_FAILED])\n ->latest()\n ->first();\n }\n\n public function getGeneratedNotSentResults(): Collection\n {\n return AutomatedReportResult::query()\n ->whereNotNull('generated_at')\n ->whereNull('sent_at')\n ->where('status', AutomatedReportResult::STATUS_GENERATED)\n ->whereHas('report')\n ->with('report')\n ->get();\n }\n\n public function getPaginatedUserReports(\n User $user,\n ReportSort $sort,\n ReportSortDirection $sortDirection,\n int $resultsPerPage,\n int $page,\n ?Carbon $fromDate,\n ?Carbon $toDate,\n array $teamIds,\n array $reportTypes,\n ?string $name,\n ): LengthAwarePaginator {\n $query = AutomatedReportResult::query()\n ->whereNotNull('automated_report_results.generated_at')\n ->join('automated_reports', 'automated_report_results.report_id', '=', 'automated_reports.id')\n ->where(fn (Builder $q) => $this->applyUserAccessScope($q, $user))\n ->orderByRaw(\"$sort->value COLLATE utf8mb4_unicode_ci {$sortDirection->value}\")\n ->select('automated_report_results.*')\n ->with('report.team');\n\n if ($fromDate !== null && $toDate !== null) {\n $query->whereBetween('generated_at', [$fromDate, $toDate]);\n }\n\n if (! empty($teamIds)) {\n $query->where(function ($q) use ($teamIds) {\n foreach ($teamIds as $id) {\n $q->orWhereJsonContains('automated_reports.groups', $id);\n }\n });\n }\n\n if (! empty($reportTypes)) {\n $query->whereIn('automated_reports.type', $reportTypes);\n }\n\n if (! empty($name)) {\n $query->whereLike('name', \"%$name%\");\n }\n\n return $query->paginate($resultsPerPage, ['*'], 'page', $page);\n }\n\n public function countUserReports(User $user): int\n {\n return AutomatedReportResult::query()\n ->whereNotNull('generated_at')\n ->whereNotNull('sent_at')\n ->whereHas('report', function ($q) use ($user) {\n $q->where('team_id', $user->getTeamId())\n ->whereJsonContains('recipients->users', $user->getId());\n })\n ->count();\n }\n\n /**\n * Restrict a query on the automated_reports table to reports the given user is allowed to see.\n *\n * Matches the customer-facing audience:\n * - explicit user recipients (recipients.users)\n * - members of any of the report's groups (Ask Jiminny reports)\n */\n private function applyUserAccessScope(Builder $query, User $user): void\n {\n $userId = $user->getId();\n $groupId = $user->getGroupId();\n\n $query\n ->where('automated_reports.team_id', $user->getTeamId())\n ->where(function (Builder $q) use ($userId, $groupId): void {\n $q->whereJsonContains('automated_reports.recipients->users', $userId);\n\n if ($groupId !== null) {\n $q->orWhere(function (Builder $sub) use ($groupId): void {\n $sub->where('automated_reports.type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->whereJsonContains('automated_reports.groups', $groupId);\n });\n }\n });\n }\n\n /**\n * Get report IDs for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Support\\Collection\n */\n public function getReportIdsByTeam(Team $team): \\Illuminate\\Support\\Collection\n {\n return AutomatedReport::where('team_id', $team->getId())->pluck('id');\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return Collection\n */\n public function getReportsByTeam(Team $team): Collection\n {\n return AutomatedReport::where('team_id', $team->getId())->get();\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return Collection\n */\n public function getResultsByReport(AutomatedReport $report): Collection\n {\n return $this->getResultsByReportQuery($report)->get();\n }\n\n public function getResultsByReportQuery(AutomatedReport $report): Builder\n {\n return AutomatedReportResult::where('report_id', $report->getId());\n }\n\n public function getReportResultsQueryForRetention(Team $team, CarbonImmutable $retentionDate): Builder\n {\n $reportIds = $this->getReportIdsByTeam($team);\n\n return AutomatedReportResult::query()->whereIn('report_id', $reportIds)\n ->whereRaw('IFNULL(generated_at, created_at) <= ?', [$retentionDate]);\n }\n\n /**\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return \\Illuminate\\Support\\Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): \\Illuminate\\Support\\Collection\n {\n $query = DB::table('automated_reports')\n ->join('teams', 'automated_reports.team_id', '=', 'teams.id')\n ->select('teams.id')\n ->distinct();\n\n if ($teamId !== null) {\n $query->where('teams.id', $teamId);\n }\n\n return $query->pluck('teams.id');\n }\n}","depth":4,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Repositories;\n\nuse Carbon\\CarbonImmutable;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Database\\Eloquent\\Collection;\nuse Illuminate\\Pagination\\LengthAwarePaginator;\nuse Illuminate\\Support\\Facades\\DB;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\AutomatedReportsService;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\ReportSort;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\ReportSortDirection;\n\nclass AutomatedReportsRepository\n{\n /**\n * Create a new automated report\n *\n * @param array $data\n *\n * @return AutomatedReport\n */\n public function create(array $data): AutomatedReport\n {\n return AutomatedReport::create($data);\n }\n\n /**\n * Find an automated report by UUID\n *\n * @param string $uuid\n *\n * @return AutomatedReport|null\n */\n public function findByUuid(string $uuid): ?AutomatedReport\n {\n return AutomatedReport::where('uuid', AutomatedReport::toOptimized($uuid))->first();\n }\n\n public function findByIdOrUuid(string $idOrUuid): ?AutomatedReport\n {\n if (is_numeric($idOrUuid)) {\n return AutomatedReport::find((int) $idOrUuid);\n }\n\n return AutomatedReport::where('uuid', AutomatedReport::toOptimized($idOrUuid))->first();\n }\n\n /**\n * Retrieve all standard (non-Ask Jiminny) automated reports.\n *\n * @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.\n * @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.\n *\n * @return Collection<AutomatedReport>\n */\n public function getAllStandardReports(\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): Collection {\n return $this->buildSortedQuery($sortColumn, $sortDirection)\n ->whereNot('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->get();\n }\n\n /**\n * Retrieve all Ask Jiminny reports created by the given user.\n *\n * @param User $user The user whose reports to retrieve.\n * @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.\n * @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.\n *\n * @return Collection<AutomatedReport>\n */\n public function getAskJiminnyReportsByUser(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): Collection {\n return $this->buildSortedQuery($sortColumn, $sortDirection)\n ->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->where('created_by', $user->getId())\n ->get();\n }\n\n private function buildSortedQuery(string $sortColumn, string $sortDirection): \\Illuminate\\Database\\Eloquent\\Builder\n {\n $allowedColumns = ['created_by', 'created_at'];\n if (! in_array($sortColumn, $allowedColumns)) {\n $sortColumn = 'created_at';\n }\n\n $sortDirection = strtolower($sortDirection) === 'asc' ? 'asc' : 'desc';\n\n $query = AutomatedReport::query()->with(['creator', 'team']);\n\n if ($sortColumn === 'created_by') {\n $query->leftJoin('users', 'users.id', '=', 'automated_reports.created_by')\n ->orderByRaw(\"users.name COLLATE utf8mb4_unicode_ci {$sortDirection}\")\n ->select('automated_reports.*');\n } else {\n $query->orderBy($sortColumn, $sortDirection);\n }\n\n return $query;\n }\n\n /**\n * Get all active Ask Jiminny reports whose expiry date has passed.\n *\n * @return Collection<AutomatedReport>\n */\n public function getExpiredActiveAskJiminnyReports(): Collection\n {\n return AutomatedReport::where('status', true)\n ->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->whereNotNull('expires_at')\n ->where('expires_at', '<', now()->toDateString())\n ->get();\n }\n\n /**\n * Get all active and enabled reports with active teams for the specified frequency.\n *\n * @param string $frequency\n *\n * @return Collection<AutomatedReport>\n */\n public function getActiveReportsByFrequency(string $frequency): Collection\n {\n return AutomatedReport::where('automated_reports.status', true)\n ->where('automated_reports.frequency', $frequency)\n ->join('teams', 'automated_reports.team_id', '=', 'teams.id')\n ->where('teams.status', Team::STATUS_ACTIVE)\n ->where(function ($query) {\n $query->whereNull('automated_reports.expires_at')\n ->orWhere('automated_reports.expires_at', '>=', now()->toDateString());\n })\n ->select('automated_reports.*')\n ->get();\n }\n\n /**\n * Update an automated report\n *\n * @param AutomatedReport $report\n * @param array $data\n *\n * @return AutomatedReport\n */\n public function update(AutomatedReport $report, array $data): AutomatedReport\n {\n $report->update($data);\n\n return $report;\n }\n\n /**\n * Create a new automated report result.\n *\n * @param array $data The data to create the automated report result with.\n *\n * @return AutomatedReportResult The newly created automated report result.\n */\n public function createResult(array $data): AutomatedReportResult\n {\n return AutomatedReportResult::create($data);\n }\n\n /**\n * Find an automated report result by UUID.\n *\n * @param string $uuid The UUID to find the automated report result with.\n *\n * @return AutomatedReportResult|null The automated report result if found, otherwise null.\n */\n public function findResultByUuid(string $uuid): ?AutomatedReportResult\n {\n return AutomatedReportResult::where('uuid', AutomatedReportResult::toOptimized($uuid))->first();\n }\n\n public function findResultByUuidForUser(string $uuid, User $user): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('uuid', AutomatedReportResult::toOptimized($uuid))\n ->whereHas('report', static function ($query) use ($user): void {\n $query->where('team_id', $user->getTeamId())\n ->where('created_by', $user->getId());\n })\n ->first();\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('parent_id', $result->getId())\n ->where('media_type', $type)\n ->first();\n }\n\n public function findLatestDefaultOrFailedResult(AutomatedReport $report): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('report_id', $report->getId())\n ->whereIn('status', [AutomatedReportResult::STATUS_DEFAULT, AutomatedReportResult::STATUS_FAILED])\n ->latest()\n ->first();\n }\n\n public function getGeneratedNotSentResults(): Collection\n {\n return AutomatedReportResult::query()\n ->whereNotNull('generated_at')\n ->whereNull('sent_at')\n ->where('status', AutomatedReportResult::STATUS_GENERATED)\n ->whereHas('report')\n ->with('report')\n ->get();\n }\n\n public function getPaginatedUserReports(\n User $user,\n ReportSort $sort,\n ReportSortDirection $sortDirection,\n int $resultsPerPage,\n int $page,\n ?Carbon $fromDate,\n ?Carbon $toDate,\n array $teamIds,\n array $reportTypes,\n ?string $name,\n ): LengthAwarePaginator {\n $query = AutomatedReportResult::query()\n ->whereNotNull('automated_report_results.generated_at')\n ->join('automated_reports', 'automated_report_results.report_id', '=', 'automated_reports.id')\n ->where(fn (Builder $q) => $this->applyUserAccessScope($q, $user))\n ->orderByRaw(\"$sort->value COLLATE utf8mb4_unicode_ci {$sortDirection->value}\")\n ->select('automated_report_results.*')\n ->with('report.team');\n\n if ($fromDate !== null && $toDate !== null) {\n $query->whereBetween('generated_at', [$fromDate, $toDate]);\n }\n\n if (! empty($teamIds)) {\n $query->where(function ($q) use ($teamIds) {\n foreach ($teamIds as $id) {\n $q->orWhereJsonContains('automated_reports.groups', $id);\n }\n });\n }\n\n if (! empty($reportTypes)) {\n $query->whereIn('automated_reports.type', $reportTypes);\n }\n\n if (! empty($name)) {\n $query->whereLike('name', \"%$name%\");\n }\n\n return $query->paginate($resultsPerPage, ['*'], 'page', $page);\n }\n\n public function countUserReports(User $user): int\n {\n return AutomatedReportResult::query()\n ->whereNotNull('generated_at')\n ->whereNotNull('sent_at')\n ->whereHas('report', function ($q) use ($user) {\n $q->where('team_id', $user->getTeamId())\n ->whereJsonContains('recipients->users', $user->getId());\n })\n ->count();\n }\n\n /**\n * Restrict a query on the automated_reports table to reports the given user is allowed to see.\n *\n * Matches the customer-facing audience:\n * - explicit user recipients (recipients.users)\n * - members of any of the report's groups (Ask Jiminny reports)\n */\n private function applyUserAccessScope(Builder $query, User $user): void\n {\n $userId = $user->getId();\n $groupId = $user->getGroupId();\n\n $query\n ->where('automated_reports.team_id', $user->getTeamId())\n ->where(function (Builder $q) use ($userId, $groupId): void {\n $q->whereJsonContains('automated_reports.recipients->users', $userId);\n\n if ($groupId !== null) {\n $q->orWhere(function (Builder $sub) use ($groupId): void {\n $sub->where('automated_reports.type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->whereJsonContains('automated_reports.groups', $groupId);\n });\n }\n });\n }\n\n /**\n * Get report IDs for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Support\\Collection\n */\n public function getReportIdsByTeam(Team $team): \\Illuminate\\Support\\Collection\n {\n return AutomatedReport::where('team_id', $team->getId())->pluck('id');\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return Collection\n */\n public function getReportsByTeam(Team $team): Collection\n {\n return AutomatedReport::where('team_id', $team->getId())->get();\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return Collection\n */\n public function getResultsByReport(AutomatedReport $report): Collection\n {\n return $this->getResultsByReportQuery($report)->get();\n }\n\n public function getResultsByReportQuery(AutomatedReport $report): Builder\n {\n return AutomatedReportResult::where('report_id', $report->getId());\n }\n\n public function getReportResultsQueryForRetention(Team $team, CarbonImmutable $retentionDate): Builder\n {\n $reportIds = $this->getReportIdsByTeam($team);\n\n return AutomatedReportResult::query()->whereIn('report_id', $reportIds)\n ->whereRaw('IFNULL(generated_at, created_at) <= ?', [$retentionDate]);\n }\n\n /**\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return \\Illuminate\\Support\\Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): \\Illuminate\\Support\\Collection\n {\n $query = DB::table('automated_reports')\n ->join('teams', 'automated_reports.team_id', '=', 'teams.id')\n ->select('teams.id')\n ->distinct();\n\n if ($teamId !== null) {\n $query->where('teams.id', $teamId);\n }\n\n return $query->pluck('teams.id');\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"bounds":{"left":0.50166225,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"bounds":{"left":0.5103058,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"bounds":{"left":0.5212766,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"bounds":{"left":0.5299202,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"bounds":{"left":0.53856385,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"bounds":{"left":0.54953456,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"bounds":{"left":0.56050533,"top":0.14844373,"width":0.024268618,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"bounds":{"left":0.58710104,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"bounds":{"left":0.5980718,"top":0.14844373,"width":0.029587766,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"bounds":{"left":0.6599069,"top":0.14844373,"width":0.02825798,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"18","depth":4,"bounds":{"left":0.63231385,"top":0.17318435,"width":0.009640957,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"14","depth":4,"bounds":{"left":0.64394945,"top":0.17318435,"width":0.009640957,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"2","depth":4,"bounds":{"left":0.6555851,"top":0.17318435,"width":0.007978723,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"4","depth":4,"bounds":{"left":0.6655585,"top":0.17318435,"width":0.007978723,"height":0.015163607},"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.67519945,"top":0.17158818,"width":0.00731383,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.6825133,"top":0.17158818,"width":0.006981383,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o\nJOIN activities a ON o.id = a.opportunity_id\nWHERE a.crm_configuration_id = 39\nAND a.actual_start_time > '2025-10-13'\nAND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM activities\nWHERE crm_configuration_id = 39 and user_id = 143\nand actual_start_time >= '2025-10-13'\nAND type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM opportunities WHERE account_id IN (178);\nselect * from activities where id IN (620137, 620187, 620188, 620189, 620230);\n\n# HS\nSELECT * FROM opportunities WHERE id IN (238);\nselect * from activities where id IN (477,2076);\n\nselect * from users;\n\nSELECT COUNT(*) FROM users;\nSELECT COUNT(*) FROM activities;\nSELECT COUNT(*) FROM opportunities;\n\nUPDATE activities\nSET\n actual_start_time = '2025-12-19 09:00:00',\n actual_end_time = '2025-12-19 10:30:00',\n scheduled_start_time = '2025-12-19 09:00:00',\n scheduled_end_time = '2025-12-19 10:30:00'\nWHERE id IN (407509,407375);\n\nselect * from partners;\n\nSELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id\nFROM activities\nWHERE user_id = 143\nAND actual_start_time >= '2025-10-13 00:00:00'\nAND actual_start_time <= '2026-01-13 23:59:59'\nORDER BY actual_start_time DESC;\n\nSELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;\nSELECT * FROM crm_layouts where crm_configuration_id = 39;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;\n# lead_id\n# account_id 177\n# contact_id 3969\n# opportunity_id\n# stage_id 203\n\nSELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;\n\nSELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'\nAND user_id = 143 and actual_start_time >= '2025-10-13';\n\nSELECT * FROM activities a\n# JOIN opportunities o ON a.opportunity_id = o.id\nWHERE a.crm_configuration_id = 39 AND a.type = 'conference'\nand status = 'completed' and recording_state = 'recorded'\nand a.actual_start_time >= '2025-10-13'\nAND a.user_id = 143\n;\n\nselect * from leads\nwhere crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707\n\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310);\nSELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198\nSELECT * FROM activities WHERE id IN (356001, 356008); # contacts:\n\nSELECT * FROM opportunities WHERE id IN (1707);\nSELECT * FROM stages where id IN (204, 198);\nSELECT * FROM opportunities WHERE account_id IN (178);\nSELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';\nSELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal\n\nSELECT * FROM activities where crm_configuration_id = 39\nAND opportunity_id IS NULL\nAND is_internal = false\nand status = 'completed' and recording_state = 'recorded'\nAND actual_start_time >= '2025-10-13'\nAND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)\n# AND lead_id IN (112, 109)\n;\n\nSELECT * FROM crm_profiles WHERE user_id = 143;\n\nselect * from inboxes; # 212\nselect * from users where id = 143; # 143\nselect * from inbox_email_batches where inbox_id = 212\nand updated_at >= '2026-01-28 00:00:00' order by id desc;\nselect * from inbox_emails where inbox_id = 212\nand batch_id = 95885 order by id desc;\nselect * from email_messages where origin_user_id = 143;\nselect * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';\nselect * from participants where activity_id = 620247;\n\nselect * from crm_profiles where user_id = 143;\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001\nselect * from transcription where activity_id = 356001; # 6943\nselect * from ai_prompts where transcription_id = 6943;\nSELECT * FROM activity_summary_logs where activity_id = 356001;\n\nSELECT * FROM social_accounts WHERE sociable_id = 143;\n\n# ************************************************************************************\nSELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;\n# 422515 softphone tr. 8100\n\nSELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;\n# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS\n\nselect * from ai_prompts where transcription_id IN (8100, 7670);\nselect * from activity_summary_logs where activity_id = 407509;\n\nselect * from sidekick_settings;\nselect * from default_activity_types;\n\nSELECT * FROM contacts WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\nSELECT * FROM leads WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\n\nSELECT * FROM activity_searches where user_id = 143;\nSELECT * FROM groups where team_id = 1;\n\nselect * from teams where id = 1;\nselect * from groups where team_id = 1; # 1150 - 7e75f8025c22\nselect id, name, group_id, status, deleted_at, email\nfrom users where team_id = 1 order by group_id desc ;\n\nselect * from activity_searches where id in (1977, 1978, 1979);\nselect * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);\nselect * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277\nselect * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879\n\nINSERT INTO `activity_search_filters`\n(`activity_search_id`, `filter`, `value`) VALUES\n(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')\n;\n\nselect * from crm_configurations where id = 39;\n\n\nselect sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id\nwhere u.team_id = 1;\nSELECT * FROM social_accounts WHERE sociable_id = 1635;\nSELECT * FROM users WHERE id = 1635;\n\nselect * from teams where id = 1;\nselect * from users where team_id = 1;\nselect * from team_features where team_id = 1;\nselect * from features;\n\nSELECT * FROM activity_searches where id = 1982; # 1981\nSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;\n\nSELECT * FROM automated_reports where id = 68;\nUPDATE automated_reports set playbook_categories = NULL where id = 68;\nSELECT * FROM automated_report_results where id = 275;\n\nSELECT * FROM automated_reports order by id desc;\nSELECT * FROM automated_report_results order by id desc;\nselect * from activity_searches where user_id = 143;\nselect * from ask_anything_prompts;\n\nSELECT * FROM groups WHERE id = 1439;\nSELECT * FROM users WHERE group_id = 1439;\n\nselect * from permissions; # 158\nselect * from roles;\nselect * from permission_role\n\nselect * from teams where id = 1;\nselect * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;\nselect * from groups where id = 28;\nselect * from playbooks where team_id = 1;\nselect * from playbooks where id = 179;\nselect * from playbook_categories where id = 1391;\nselect * from users where id = 143;\nselect * from crm_profiles where user_id = 143;\nselect * from activities where crm_configuration_id = 39 and type = 'conference'\nand crm_provider_id IS NOT NULL ORDER by id desc;\nselect * from activities where id = 422003; # 00UO400000pB6fpMAC\n\nSELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type\nFROM automated_report_results ar\nJOIN automated_reports a ON a.id = ar.report_id\nWHERE a.type = 'ask_jiminny'\nLIMIT 10;\n\nSELECT `automated_report_results`.* FROM `automated_report_results`\nINNER JOIN `automated_reports`\n ON `automated_report_results`.`report_id` = `automated_reports`.`id`\nWHERE `automated_report_results`.`generated_at` IS NOT NULL\n AND `automated_reports`.`team_id` = 1\n AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$.\"users\"')\n;\n\n\nselect * from teams where id = 3143;\nselect * from crm_configurations where id = 500;\nselect * from users where name = 'Integration Account'; # 1695\nSELECT * FROM social_accounts WHERE sociable_id = 1695;\n\nselect * from activities where crm_configuration_id = 39\nand recording_state = 'recorded' and duration > 60\nand status = 'completed' and actual_start_time >= '2025-12-01';\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;\n\nselect * from leads;","depth":4,"value":"SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o\nJOIN activities a ON o.id = a.opportunity_id\nWHERE a.crm_configuration_id = 39\nAND a.actual_start_time > '2025-10-13'\nAND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM activities\nWHERE crm_configuration_id = 39 and user_id = 143\nand actual_start_time >= '2025-10-13'\nAND type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM opportunities WHERE account_id IN (178);\nselect * from activities where id IN (620137, 620187, 620188, 620189, 620230);\n\n# HS\nSELECT * FROM opportunities WHERE id IN (238);\nselect * from activities where id IN (477,2076);\n\nselect * from users;\n\nSELECT COUNT(*) FROM users;\nSELECT COUNT(*) FROM activities;\nSELECT COUNT(*) FROM opportunities;\n\nUPDATE activities\nSET\n actual_start_time = '2025-12-19 09:00:00',\n actual_end_time = '2025-12-19 10:30:00',\n scheduled_start_time = '2025-12-19 09:00:00',\n scheduled_end_time = '2025-12-19 10:30:00'\nWHERE id IN (407509,407375);\n\nselect * from partners;\n\nSELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id\nFROM activities\nWHERE user_id = 143\nAND actual_start_time >= '2025-10-13 00:00:00'\nAND actual_start_time <= '2026-01-13 23:59:59'\nORDER BY actual_start_time DESC;\n\nSELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;\nSELECT * FROM crm_layouts where crm_configuration_id = 39;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;\n# lead_id\n# account_id 177\n# contact_id 3969\n# opportunity_id\n# stage_id 203\n\nSELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;\n\nSELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'\nAND user_id = 143 and actual_start_time >= '2025-10-13';\n\nSELECT * FROM activities a\n# JOIN opportunities o ON a.opportunity_id = o.id\nWHERE a.crm_configuration_id = 39 AND a.type = 'conference'\nand status = 'completed' and recording_state = 'recorded'\nand a.actual_start_time >= '2025-10-13'\nAND a.user_id = 143\n;\n\nselect * from leads\nwhere crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707\n\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310);\nSELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198\nSELECT * FROM activities WHERE id IN (356001, 356008); # contacts:\n\nSELECT * FROM opportunities WHERE id IN (1707);\nSELECT * FROM stages where id IN (204, 198);\nSELECT * FROM opportunities WHERE account_id IN (178);\nSELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';\nSELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal\n\nSELECT * FROM activities where crm_configuration_id = 39\nAND opportunity_id IS NULL\nAND is_internal = false\nand status = 'completed' and recording_state = 'recorded'\nAND actual_start_time >= '2025-10-13'\nAND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)\n# AND lead_id IN (112, 109)\n;\n\nSELECT * FROM crm_profiles WHERE user_id = 143;\n\nselect * from inboxes; # 212\nselect * from users where id = 143; # 143\nselect * from inbox_email_batches where inbox_id = 212\nand updated_at >= '2026-01-28 00:00:00' order by id desc;\nselect * from inbox_emails where inbox_id = 212\nand batch_id = 95885 order by id desc;\nselect * from email_messages where origin_user_id = 143;\nselect * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';\nselect * from participants where activity_id = 620247;\n\nselect * from crm_profiles where user_id = 143;\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001\nselect * from transcription where activity_id = 356001; # 6943\nselect * from ai_prompts where transcription_id = 6943;\nSELECT * FROM activity_summary_logs where activity_id = 356001;\n\nSELECT * FROM social_accounts WHERE sociable_id = 143;\n\n# ************************************************************************************\nSELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;\n# 422515 softphone tr. 8100\n\nSELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;\n# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS\n\nselect * from ai_prompts where transcription_id IN (8100, 7670);\nselect * from activity_summary_logs where activity_id = 407509;\n\nselect * from sidekick_settings;\nselect * from default_activity_types;\n\nSELECT * FROM contacts WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\nSELECT * FROM leads WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\n\nSELECT * FROM activity_searches where user_id = 143;\nSELECT * FROM groups where team_id = 1;\n\nselect * from teams where id = 1;\nselect * from groups where team_id = 1; # 1150 - 7e75f8025c22\nselect id, name, group_id, status, deleted_at, email\nfrom users where team_id = 1 order by group_id desc ;\n\nselect * from activity_searches where id in (1977, 1978, 1979);\nselect * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);\nselect * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277\nselect * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879\n\nINSERT INTO `activity_search_filters`\n(`activity_search_id`, `filter`, `value`) VALUES\n(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')\n;\n\nselect * from crm_configurations where id = 39;\n\n\nselect sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id\nwhere u.team_id = 1;\nSELECT * FROM social_accounts WHERE sociable_id = 1635;\nSELECT * FROM users WHERE id = 1635;\n\nselect * from teams where id = 1;\nselect * from users where team_id = 1;\nselect * from team_features where team_id = 1;\nselect * from features;\n\nSELECT * FROM activity_searches where id = 1982; # 1981\nSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;\n\nSELECT * FROM automated_reports where id = 68;\nUPDATE automated_reports set playbook_categories = NULL where id = 68;\nSELECT * FROM automated_report_results where id = 275;\n\nSELECT * FROM automated_reports order by id desc;\nSELECT * FROM automated_report_results order by id desc;\nselect * from activity_searches where user_id = 143;\nselect * from ask_anything_prompts;\n\nSELECT * FROM groups WHERE id = 1439;\nSELECT * FROM users WHERE group_id = 1439;\n\nselect * from permissions; # 158\nselect * from roles;\nselect * from permission_role\n\nselect * from teams where id = 1;\nselect * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;\nselect * from groups where id = 28;\nselect * from playbooks where team_id = 1;\nselect * from playbooks where id = 179;\nselect * from playbook_categories where id = 1391;\nselect * from users where id = 143;\nselect * from crm_profiles where user_id = 143;\nselect * from activities where crm_configuration_id = 39 and type = 'conference'\nand crm_provider_id IS NOT NULL ORDER by id desc;\nselect * from activities where id = 422003; # 00UO400000pB6fpMAC\n\nSELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type\nFROM automated_report_results ar\nJOIN automated_reports a ON a.id = ar.report_id\nWHERE a.type = 'ask_jiminny'\nLIMIT 10;\n\nSELECT `automated_report_results`.* FROM `automated_report_results`\nINNER JOIN `automated_reports`\n ON `automated_report_results`.`report_id` = `automated_reports`.`id`\nWHERE `automated_report_results`.`generated_at` IS NOT NULL\n AND `automated_reports`.`team_id` = 1\n AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$.\"users\"')\n;\n\n\nselect * from teams where id = 3143;\nselect * from crm_configurations where id = 500;\nselect * from users where name = 'Integration Account'; # 1695\nSELECT * FROM social_accounts WHERE sociable_id = 1695;\n\nselect * from activities where crm_configuration_id = 39\nand recording_state = 'recorded' and duration > 60\nand status = 'completed' and actual_start_time >= '2025-12-01';\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;\n\nselect * from leads;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"bounds":{"left":0.011968086,"top":0.047885075,"width":0.024268618,"height":0.024740623},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
5262134208844209929
|
-2393068234934446523
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsServiceTest
Run 'AutomatedReportsServiceTest'
Debug 'AutomatedReportsServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
whereHas
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
3/3
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
16
7
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Repositories;
use Carbon\CarbonImmutable;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Facades\DB;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\Kiosk\AutomatedReports\ReportSort;
use Jiminny\Services\Kiosk\AutomatedReports\ReportSortDirection;
class AutomatedReportsRepository
{
/**
* Create a new automated report
*
* @param array $data
*
* @return AutomatedReport
*/
public function create(array $data): AutomatedReport
{
return AutomatedReport::create($data);
}
/**
* Find an automated report by UUID
*
* @param string $uuid
*
* @return AutomatedReport|null
*/
public function findByUuid(string $uuid): ?AutomatedReport
{
return AutomatedReport::where('uuid', AutomatedReport::toOptimized($uuid))->first();
}
public function findByIdOrUuid(string $idOrUuid): ?AutomatedReport
{
if (is_numeric($idOrUuid)) {
return AutomatedReport::find((int) $idOrUuid);
}
return AutomatedReport::where('uuid', AutomatedReport::toOptimized($idOrUuid))->first();
}
/**
* Retrieve all standard (non-Ask Jiminny) automated reports.
*
* @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.
* @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.
*
* @return Collection<AutomatedReport>
*/
public function getAllStandardReports(
string $sortColumn = 'created_at',
string $sortDirection = 'desc'
): Collection {
return $this->buildSortedQuery($sortColumn, $sortDirection)
->whereNot('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->get();
}
/**
* Retrieve all Ask Jiminny reports created by the given user.
*
* @param User $user The user whose reports to retrieve.
* @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.
* @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.
*
* @return Collection<AutomatedReport>
*/
public function getAskJiminnyReportsByUser(
User $user,
string $sortColumn = 'created_at',
string $sortDirection = 'desc'
): Collection {
return $this->buildSortedQuery($sortColumn, $sortDirection)
->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->where('created_by', $user->getId())
->get();
}
private function buildSortedQuery(string $sortColumn, string $sortDirection): \Illuminate\Database\Eloquent\Builder
{
$allowedColumns = ['created_by', 'created_at'];
if (! in_array($sortColumn, $allowedColumns)) {
$sortColumn = 'created_at';
}
$sortDirection = strtolower($sortDirection) === 'asc' ? 'asc' : 'desc';
$query = AutomatedReport::query()->with(['creator', 'team']);
if ($sortColumn === 'created_by') {
$query->leftJoin('users', 'users.id', '=', 'automated_reports.created_by')
->orderByRaw("users.name COLLATE utf8mb4_unicode_ci {$sortDirection}")
->select('automated_reports.*');
} else {
$query->orderBy($sortColumn, $sortDirection);
}
return $query;
}
/**
* Get all active Ask Jiminny reports whose expiry date has passed.
*
* @return Collection<AutomatedReport>
*/
public function getExpiredActiveAskJiminnyReports(): Collection
{
return AutomatedReport::where('status', true)
->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->whereNotNull('expires_at')
->where('expires_at', '<', now()->toDateString())
->get();
}
/**
* Get all active and enabled reports with active teams for the specified frequency.
*
* @param string $frequency
*
* @return Collection<AutomatedReport>
*/
public function getActiveReportsByFrequency(string $frequency): Collection
{
return AutomatedReport::where('automated_reports.status', true)
->where('automated_reports.frequency', $frequency)
->join('teams', 'automated_reports.team_id', '=', 'teams.id')
->where('teams.status', Team::STATUS_ACTIVE)
->where(function ($query) {
$query->whereNull('automated_reports.expires_at')
->orWhere('automated_reports.expires_at', '>=', now()->toDateString());
})
->select('automated_reports.*')
->get();
}
/**
* Update an automated report
*
* @param AutomatedReport $report
* @param array $data
*
* @return AutomatedReport
*/
public function update(AutomatedReport $report, array $data): AutomatedReport
{
$report->update($data);
return $report;
}
/**
* Create a new automated report result.
*
* @param array $data The data to create the automated report result with.
*
* @return AutomatedReportResult The newly created automated report result.
*/
public function createResult(array $data): AutomatedReportResult
{
return AutomatedReportResult::create($data);
}
/**
* Find an automated report result by UUID.
*
* @param string $uuid The UUID to find the automated report result with.
*
* @return AutomatedReportResult|null The automated report result if found, otherwise null.
*/
public function findResultByUuid(string $uuid): ?AutomatedReportResult
{
return AutomatedReportResult::where('uuid', AutomatedReportResult::toOptimized($uuid))->first();
}
public function findResultByUuidForUser(string $uuid, User $user): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('uuid', AutomatedReportResult::toOptimized($uuid))
->whereHas('report', static function ($query) use ($user): void {
$query->where('team_id', $user->getTeamId())
->where('created_by', $user->getId());
})
->first();
}
public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('parent_id', $result->getId())
->where('media_type', $type)
->first();
}
public function findLatestDefaultOrFailedResult(AutomatedReport $report): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('report_id', $report->getId())
->whereIn('status', [AutomatedReportResult::STATUS_DEFAULT, AutomatedReportResult::STATUS_FAILED])
->latest()
->first();
}
public function getGeneratedNotSentResults(): Collection
{
return AutomatedReportResult::query()
->whereNotNull('generated_at')
->whereNull('sent_at')
->where('status', AutomatedReportResult::STATUS_GENERATED)
->whereHas('report')
->with('report')
->get();
}
public function getPaginatedUserReports(
User $user,
ReportSort $sort,
ReportSortDirection $sortDirection,
int $resultsPerPage,
int $page,
?Carbon $fromDate,
?Carbon $toDate,
array $teamIds,
array $reportTypes,
?string $name,
): LengthAwarePaginator {
$query = AutomatedReportResult::query()
->whereNotNull('automated_report_results.generated_at')
->join('automated_reports', 'automated_report_results.report_id', '=', 'automated_reports.id')
->where(fn (Builder $q) => $this->applyUserAccessScope($q, $user))
->orderByRaw("$sort->value COLLATE utf8mb4_unicode_ci {$sortDirection->value}")
->select('automated_report_results.*')
->with('report.team');
if ($fromDate !== null && $toDate !== null) {
$query->whereBetween('generated_at', [$fromDate, $toDate]);
}
if (! empty($teamIds)) {
$query->where(function ($q) use ($teamIds) {
foreach ($teamIds as $id) {
$q->orWhereJsonContains('automated_reports.groups', $id);
}
});
}
if (! empty($reportTypes)) {
$query->whereIn('automated_reports.type', $reportTypes);
}
if (! empty($name)) {
$query->whereLike('name', "%$name%");
}
return $query->paginate($resultsPerPage, ['*'], 'page', $page);
}
public function countUserReports(User $user): int
{
return AutomatedReportResult::query()
->whereNotNull('generated_at')
->whereNotNull('sent_at')
->whereHas('report', function ($q) use ($user) {
$q->where('team_id', $user->getTeamId())
->whereJsonContains('recipients->users', $user->getId());
})
->count();
}
/**
* Restrict a query on the automated_reports table to reports the given user is allowed to see.
*
* Matches the customer-facing audience:
* - explicit user recipients (recipients.users)
* - members of any of the report's groups (Ask Jiminny reports)
*/
private function applyUserAccessScope(Builder $query, User $user): void
{
$userId = $user->getId();
$groupId = $user->getGroupId();
$query
->where('automated_reports.team_id', $user->getTeamId())
->where(function (Builder $q) use ($userId, $groupId): void {
$q->whereJsonContains('automated_reports.recipients->users', $userId);
if ($groupId !== null) {
$q->orWhere(function (Builder $sub) use ($groupId): void {
$sub->where('automated_reports.type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->whereJsonContains('automated_reports.groups', $groupId);
});
}
});
}
/**
* Get report IDs for a specific team
*
* @param Team $team
*
* @return \Illuminate\Support\Collection
*/
public function getReportIdsByTeam(Team $team): \Illuminate\Support\Collection
{
return AutomatedReport::where('team_id', $team->getId())->pluck('id');
}
/**
* Get all reports for a specific team
*
* @param Team $team
*
* @return Collection
*/
public function getReportsByTeam(Team $team): Collection
{
return AutomatedReport::where('team_id', $team->getId())->get();
}
/**
* Get all report results for a specific report
*
* @param AutomatedReport $report
*
* @return Collection
*/
public function getResultsByReport(AutomatedReport $report): Collection
{
return $this->getResultsByReportQuery($report)->get();
}
public function getResultsByReportQuery(AutomatedReport $report): Builder
{
return AutomatedReportResult::where('report_id', $report->getId());
}
public function getReportResultsQueryForRetention(Team $team, CarbonImmutable $retentionDate): Builder
{
$reportIds = $this->getReportIdsByTeam($team);
return AutomatedReportResult::query()->whereIn('report_id', $reportIds)
->whereRaw('IFNULL(generated_at, created_at) <= ?', [$retentionDate]);
}
/**
* @param int|null $teamId Optional team ID to filter results
*
* @return \Illuminate\Support\Collection<int, int> Collection of team IDs
*/
public function getTeamIdsWithReportsResults(?int $teamId = null): \Illuminate\Support\Collection
{
$query = DB::table('automated_reports')
->join('teams', 'automated_reports.team_id', '=', 'teams.id')
->select('teams.id')
->distinct();
if ($teamId !== null) {
$query->where('teams.id', $teamId);
}
return $query->pluck('teams.id');
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
18
14
2
4
Previous Highlighted Error
Next Highlighted Error
SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o
JOIN activities a ON o.id = a.opportunity_id
WHERE a.crm_configuration_id = 39
AND a.actual_start_time > '2025-10-13'
AND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')
;
SELECT * FROM activities
WHERE crm_configuration_id = 39 and user_id = 143
and actual_start_time >= '2025-10-13'
AND type IN ('conference', 'softphone-inbound', 'softphone-outbound')
;
SELECT * FROM opportunities WHERE account_id IN (178);
select * from activities where id IN (620137, 620187, 620188, 620189, 620230);
# HS
SELECT * FROM opportunities WHERE id IN (238);
select * from activities where id IN (477,2076);
select * from users;
SELECT COUNT(*) FROM users;
SELECT COUNT(*) FROM activities;
SELECT COUNT(*) FROM opportunities;
UPDATE activities
SET
actual_start_time = '2025-12-19 09:00:00',
actual_end_time = '2025-12-19 10:30:00',
scheduled_start_time = '2025-12-19 09:00:00',
scheduled_end_time = '2025-12-19 10:30:00'
WHERE id IN (407509,407375);
select * from partners;
SELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id
FROM activities
WHERE user_id = 143
AND actual_start_time >= '2025-10-13 00:00:00'
AND actual_start_time <= '2026-01-13 23:59:59'
ORDER BY actual_start_time DESC;
SELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;
SELECT * FROM crm_layouts where crm_configuration_id = 39;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;
# lead_id
# account_id 177
# contact_id 3969
# opportunity_id
# stage_id 203
SELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;
SELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'
AND user_id = 143 and actual_start_time >= '2025-10-13';
SELECT * FROM activities a
# JOIN opportunities o ON a.opportunity_id = o.id
WHERE a.crm_configuration_id = 39 AND a.type = 'conference'
and status = 'completed' and recording_state = 'recorded'
and a.actual_start_time >= '2025-10-13'
AND a.user_id = 143
;
select * from leads
where crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707
SELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);
SELECT * FROM activities WHERE id IN (356013,616188,616202,616310);
SELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198
SELECT * FROM activities WHERE id IN (356001, 356008); # contacts:
SELECT * FROM opportunities WHERE id IN (1707);
SELECT * FROM stages where id IN (204, 198);
SELECT * FROM opportunities WHERE account_id IN (178);
SELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';
SELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal
SELECT * FROM activities where crm_configuration_id = 39
AND opportunity_id IS NULL
AND is_internal = false
and status = 'completed' and recording_state = 'recorded'
AND actual_start_time >= '2025-10-13'
AND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)
# AND lead_id IN (112, 109)
;
SELECT * FROM crm_profiles WHERE user_id = 143;
select * from inboxes; # 212
select * from users where id = 143; # 143
select * from inbox_email_batches where inbox_id = 212
and updated_at >= '2026-01-28 00:00:00' order by id desc;
select * from inbox_emails where inbox_id = 212
and batch_id = 95885 order by id desc;
select * from email_messages where origin_user_id = 143;
select * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';
select * from participants where activity_id = 620247;
select * from crm_profiles where user_id = 143;
SELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001
select * from transcription where activity_id = 356001; # 6943
select * from ai_prompts where transcription_id = 6943;
SELECT * FROM activity_summary_logs where activity_id = 356001;
SELECT * FROM social_accounts WHERE sociable_id = 143;
# [PASSWORD_DOTS]
SELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;
# 422515 softphone tr. 8100
SELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;
# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS
select * from ai_prompts where transcription_id IN (8100, 7670);
select * from activity_summary_logs where activity_id = 407509;
select * from sidekick_settings;
select * from default_activity_types;
SELECT * FROM contacts WHERE crm_configuration_id = 39 and email = '[EMAIL]';
SELECT * FROM leads WHERE crm_configuration_id = 39 and email = '[EMAIL]';
SELECT * FROM activity_searches where user_id = 143;
SELECT * FROM groups where team_id = 1;
select * from teams where id = 1;
select * from groups where team_id = 1; # 1150 - 7e75f8025c22
select id, name, group_id, status, deleted_at, email
from users where team_id = 1 order by group_id desc ;
select * from activity_searches where id in (1977, 1978, 1979);
select * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);
select * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277
select * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879
INSERT INTO `activity_search_filters`
(`activity_search_id`, `filter`, `value`) VALUES
(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),
(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),
(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')
;
select * from crm_configurations where id = 39;
select sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id
where u.team_id = 1;
SELECT * FROM social_accounts WHERE sociable_id = 1635;
SELECT * FROM users WHERE id = 1635;
select * from teams where id = 1;
select * from users where team_id = 1;
select * from team_features where team_id = 1;
select * from features;
SELECT * FROM activity_searches where id = 1982; # 1981
SELECT * FROM activity_search_filters WHERE activity_search_id = 1982;
SELECT * FROM automated_reports where id = 68;
UPDATE automated_reports set playbook_categories = NULL where id = 68;
SELECT * FROM automated_report_results where id = 275;
SELECT * FROM automated_reports order by id desc;
SELECT * FROM automated_report_results order by id desc;
select * from activity_searches where user_id = 143;
select * from ask_anything_prompts;
SELECT * FROM groups WHERE id = 1439;
SELECT * FROM users WHERE group_id = 1439;
select * from permissions; # 158
select * from roles;
select * from permission_role
select * from teams where id = 1;
select * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;
select * from groups where id = 28;
select * from playbooks where team_id = 1;
select * from playbooks where id = 179;
select * from playbook_categories where id = 1391;
select * from users where id = 143;
select * from crm_profiles where user_id = 143;
select * from activities where crm_configuration_id = 39 and type = 'conference'
and crm_provider_id IS NOT NULL ORDER by id desc;
select * from activities where id = 422003; # 00UO400000pB6fpMAC
SELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type
FROM automated_report_results ar
JOIN automated_reports a ON a.id = ar.report_id
WHERE a.type = 'ask_jiminny'
LIMIT 10;
SELECT `automated_report_results`.* FROM `automated_report_results`
INNER JOIN `automated_reports`
ON `automated_report_results`.`report_id` = `automated_reports`.`id`
WHERE `automated_report_results`.`generated_at` IS NOT NULL
AND `automated_reports`.`team_id` = 1
AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$."users"')
;
select * from teams where id = 3143;
select * from crm_configurations where id = 500;
select * from users where name = 'Integration Account'; # 1695
SELECT * FROM social_accounts WHERE sociable_id = 1695;
select * from activities where crm_configuration_id = 39
and recording_state = 'recorded' and duration > 60
and status = 'completed' and actual_start_time >= '2025-12-01';
SELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;
select * from leads;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
67049
|
|
67053
|
1511
|
0
|
2026-04-21T15:25:37.291456+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776785137291_m1.jpg...
|
PhpStorm
|
faVsco.js – AutomatedReportsRepository.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsServiceTest
Run 'AutomatedReportsServiceTest'
Debug 'AutomatedReportsServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
whereHas
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
3/3
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
16
7
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Repositories;
use Carbon\CarbonImmutable;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Facades\DB;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\Kiosk\AutomatedReports\ReportSort;
use Jiminny\Services\Kiosk\AutomatedReports\ReportSortDirection;
class AutomatedReportsRepository
{
/**
* Create a new automated report
*
* @param array $data
*
* @return AutomatedReport
*/
public function create(array $data): AutomatedReport
{
return AutomatedReport::create($data);
}
/**
* Find an automated report by UUID
*
* @param string $uuid
*
* @return AutomatedReport|null
*/
public function findByUuid(string $uuid): ?AutomatedReport
{
return AutomatedReport::where('uuid', AutomatedReport::toOptimized($uuid))->first();
}
public function findByIdOrUuid(string $idOrUuid): ?AutomatedReport
{
if (is_numeric($idOrUuid)) {
return AutomatedReport::find((int) $idOrUuid);
}
return AutomatedReport::where('uuid', AutomatedReport::toOptimized($idOrUuid))->first();
}
/**
* Retrieve all standard (non-Ask Jiminny) automated reports.
*
* @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.
* @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.
*
* @return Collection<AutomatedReport>
*/
public function getAllStandardReports(
string $sortColumn = 'created_at',
string $sortDirection = 'desc'
): Collection {
return $this->buildSortedQuery($sortColumn, $sortDirection)
->whereNot('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->get();
}
/**
* Retrieve all Ask Jiminny reports created by the given user.
*
* @param User $user The user whose reports to retrieve.
* @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.
* @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.
*
* @return Collection<AutomatedReport>
*/
public function getAskJiminnyReportsByUser(
User $user,
string $sortColumn = 'created_at',
string $sortDirection = 'desc'
): Collection {
return $this->buildSortedQuery($sortColumn, $sortDirection)
->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->where('created_by', $user->getId())
->get();
}
private function buildSortedQuery(string $sortColumn, string $sortDirection): \Illuminate\Database\Eloquent\Builder
{
$allowedColumns = ['created_by', 'created_at'];
if (! in_array($sortColumn, $allowedColumns)) {
$sortColumn = 'created_at';
}
$sortDirection = strtolower($sortDirection) === 'asc' ? 'asc' : 'desc';
$query = AutomatedReport::query()->with(['creator', 'team']);
if ($sortColumn === 'created_by') {
$query->leftJoin('users', 'users.id', '=', 'automated_reports.created_by')
->orderByRaw("users.name COLLATE utf8mb4_unicode_ci {$sortDirection}")
->select('automated_reports.*');
} else {
$query->orderBy($sortColumn, $sortDirection);
}
return $query;
}
/**
* Get all active Ask Jiminny reports whose expiry date has passed.
*
* @return Collection<AutomatedReport>
*/
public function getExpiredActiveAskJiminnyReports(): Collection
{
return AutomatedReport::where('status', true)
->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->whereNotNull('expires_at')
->where('expires_at', '<', now()->toDateString())
->get();
}
/**
* Get all active and enabled reports with active teams for the specified frequency.
*
* @param string $frequency
*
* @return Collection<AutomatedReport>
*/
public function getActiveReportsByFrequency(string $frequency): Collection
{
return AutomatedReport::where('automated_reports.status', true)
->where('automated_reports.frequency', $frequency)
->join('teams', 'automated_reports.team_id', '=', 'teams.id')
->where('teams.status', Team::STATUS_ACTIVE)
->where(function ($query) {
$query->whereNull('automated_reports.expires_at')
->orWhere('automated_reports.expires_at', '>=', now()->toDateString());
})
->select('automated_reports.*')
->get();
}
/**
* Update an automated report
*
* @param AutomatedReport $report
* @param array $data
*
* @return AutomatedReport
*/
public function update(AutomatedReport $report, array $data): AutomatedReport
{
$report->update($data);
return $report;
}
/**
* Create a new automated report result.
*
* @param array $data The data to create the automated report result with.
*
* @return AutomatedReportResult The newly created automated report result.
*/
public function createResult(array $data): AutomatedReportResult
{
return AutomatedReportResult::create($data);
}
/**
* Find an automated report result by UUID.
*
* @param string $uuid The UUID to find the automated report result with.
*
* @return AutomatedReportResult|null The automated report result if found, otherwise null.
*/
public function findResultByUuid(string $uuid): ?AutomatedReportResult
{
return AutomatedReportResult::where('uuid', AutomatedReportResult::toOptimized($uuid))->first();
}
public function findResultByUuidForUser(string $uuid, User $user): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('uuid', AutomatedReportResult::toOptimized($uuid))
->whereHas('report', static function ($query) use ($user): void {
$query->where('team_id', $user->getTeamId())
->where('created_by', $user->getId());
})
->first();
}
public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('parent_id', $result->getId())
->where('media_type', $type)
->first();
}
public function findLatestDefaultOrFailedResult(AutomatedReport $report): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('report_id', $report->getId())
->whereIn('status', [AutomatedReportResult::STATUS_DEFAULT, AutomatedReportResult::STATUS_FAILED])
->latest()
->first();
}
public function getGeneratedNotSentResults(): Collection
{
return AutomatedReportResult::query()
->whereNotNull('generated_at')
->whereNull('sent_at')
->where('status', AutomatedReportResult::STATUS_GENERATED)
->whereHas('report')
->with('report')
->get();
}
public function getPaginatedUserReports(
User $user,
ReportSort $sort,
ReportSortDirection $sortDirection,
int $resultsPerPage,
int $page,
?Carbon $fromDate,
?Carbon $toDate,
array $teamIds,
array $reportTypes,
?string $name,
): LengthAwarePaginator {
$query = AutomatedReportResult::query()
->whereNotNull('automated_report_results.generated_at')
->join('automated_reports', 'automated_report_results.report_id', '=', 'automated_reports.id')
->where(fn (Builder $q) => $this->applyUserAccessScope($q, $user))
->orderByRaw("$sort->value COLLATE utf8mb4_unicode_ci {$sortDirection->value}")
->select('automated_report_results.*')
->with('report.team');
if ($fromDate !== null && $toDate !== null) {
$query->whereBetween('generated_at', [$fromDate, $toDate]);
}
if (! empty($teamIds)) {
$query->where(function ($q) use ($teamIds) {
foreach ($teamIds as $id) {
$q->orWhereJsonContains('automated_reports.groups', $id);
}
});
}
if (! empty($reportTypes)) {
$query->whereIn('automated_reports.type', $reportTypes);
}
if (! empty($name)) {
$query->whereLike('name', "%$name%");
}
return $query->paginate($resultsPerPage, ['*'], 'page', $page);
}
public function countUserReports(User $user): int
{
return AutomatedReportResult::query()
->whereNotNull('generated_at')
->whereNotNull('sent_at')
->whereHas('report', function ($q) use ($user) {
$q->where('team_id', $user->getTeamId())
->whereJsonContains('recipients->users', $user->getId());
})
->count();
}
/**
* Restrict a query on the automated_reports table to reports the given user is allowed to see.
*
* Matches the customer-facing audience:
* - explicit user recipients (recipients.users)
* - members of any of the report's groups (Ask Jiminny reports)
*/
private function applyUserAccessScope(Builder $query, User $user): void
{
$userId = $user->getId();
$groupId = $user->getGroupId();
$query
->where('automated_reports.team_id', $user->getTeamId())
->where(function (Builder $q) use ($userId, $groupId): void {
$q->whereJsonContains('automated_reports.recipients->users', $userId);
if ($groupId !== null) {
$q->orWhere(function (Builder $sub) use ($groupId): void {
$sub->where('automated_reports.type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->whereJsonContains('automated_reports.groups', $groupId);
});
}
});
}
/**
* Get report IDs for a specific team
*
* @param Team $team
*
* @return \Illuminate\Support\Collection
*/
public function getReportIdsByTeam(Team $team): \Illuminate\Support\Collection
{
return AutomatedReport::where('team_id', $team->getId())->pluck('id');
}
/**
* Get all reports for a specific team
*
* @param Team $team
*
* @return Collection
*/
public function getReportsByTeam(Team $team): Collection
{
return AutomatedReport::where('team_id', $team->getId())->get();
}
/**
* Get all report results for a specific report
*
* @param AutomatedReport $report
*
* @return Collection
*/
public function getResultsByReport(AutomatedReport $report): Collection
{
return $this->getResultsByReportQuery($report)->get();
}
public function getResultsByReportQuery(AutomatedReport $report): Builder
{
return AutomatedReportResult::where('report_id', $report->getId());
}
public function getReportResultsQueryForRetention(Team $team, CarbonImmutable $retentionDate): Builder
{
$reportIds = $this->getReportIdsByTeam($team);
return AutomatedReportResult::query()->whereIn('report_id', $reportIds)
->whereRaw('IFNULL(generated_at, created_at) <= ?', [$retentionDate]);
}
/**
* @param int|null $teamId Optional team ID to filter results
*
* @return \Illuminate\Support\Collection<int, int> Collection of team IDs
*/
public function getTeamIdsWithReportsResults(?int $teamId = null): \Illuminate\Support\Collection
{
$query = DB::table('automated_reports')
->join('teams', 'automated_reports.team_id', '=', 'teams.id')
->select('teams.id')
->distinct();
if ($teamId !== null) {
$query->where('teams.id', $teamId);
}
return $query->pluck('teams.id');
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
18
14
2
4
Previous Highlighted Error
Next Highlighted Error
SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o
JOIN activities a ON o.id = a.opportunity_id
WHERE a.crm_configuration_id = 39
AND a.actual_start_time > '2025-10-13'
AND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')
;
SELECT * FROM activities
WHERE crm_configuration_id = 39 and user_id = 143
and actual_start_time >= '2025-10-13'
AND type IN ('conference', 'softphone-inbound', 'softphone-outbound')
;
SELECT * FROM opportunities WHERE account_id IN (178);
select * from activities where id IN (620137, 620187, 620188, 620189, 620230);
# HS
SELECT * FROM opportunities WHERE id IN (238);
select * from activities where id IN (477,2076);
select * from users;
SELECT COUNT(*) FROM users;
SELECT COUNT(*) FROM activities;
SELECT COUNT(*) FROM opportunities;
UPDATE activities
SET
actual_start_time = '2025-12-19 09:00:00',
actual_end_time = '2025-12-19 10:30:00',
scheduled_start_time = '2025-12-19 09:00:00',
scheduled_end_time = '2025-12-19 10:30:00'
WHERE id IN (407509,407375);
select * from partners;
SELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id
FROM activities
WHERE user_id = 143
AND actual_start_time >= '2025-10-13 00:00:00'
AND actual_start_time <= '2026-01-13 23:59:59'
ORDER BY actual_start_time DESC;
SELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;
SELECT * FROM crm_layouts where crm_configuration_id = 39;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;
# lead_id
# account_id 177
# contact_id 3969
# opportunity_id
# stage_id 203
SELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;
SELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'
AND user_id = 143 and actual_start_time >= '2025-10-13';
SELECT * FROM activities a
# JOIN opportunities o ON a.opportunity_id = o.id
WHERE a.crm_configuration_id = 39 AND a.type = 'conference'
and status = 'completed' and recording_state = 'recorded'
and a.actual_start_time >= '2025-10-13'
AND a.user_id = 143
;
select * from leads
where crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707
SELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);
SELECT * FROM activities WHERE id IN (356013,616188,616202,616310);
SELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198
SELECT * FROM activities WHERE id IN (356001, 356008); # contacts:
SELECT * FROM opportunities WHERE id IN (1707);
SELECT * FROM stages where id IN (204, 198);
SELECT * FROM opportunities WHERE account_id IN (178);
SELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';
SELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal
SELECT * FROM activities where crm_configuration_id = 39
AND opportunity_id IS NULL
AND is_internal = false
and status = 'completed' and recording_state = 'recorded'
AND actual_start_time >= '2025-10-13'
AND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)
# AND lead_id IN (112, 109)
;
SELECT * FROM crm_profiles WHERE user_id = 143;
select * from inboxes; # 212
select * from users where id = 143; # 143
select * from inbox_email_batches where inbox_id = 212
and updated_at >= '2026-01-28 00:00:00' order by id desc;
select * from inbox_emails where inbox_id = 212
and batch_id = 95885 order by id desc;
select * from email_messages where origin_user_id = 143;
select * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';
select * from participants where activity_id = 620247;
select * from crm_profiles where user_id = 143;
SELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001
select * from transcription where activity_id = 356001; # 6943
select * from ai_prompts where transcription_id = 6943;
SELECT * FROM activity_summary_logs where activity_id = 356001;
SELECT * FROM social_accounts WHERE sociable_id = 143;
# [PASSWORD_DOTS]
SELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;
# 422515 softphone tr. 8100
SELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;
# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS
select * from ai_prompts where transcription_id IN (8100, 7670);
select * from activity_summary_logs where activity_id = 407509;
select * from sidekick_settings;
select * from default_activity_types;
SELECT * FROM contacts WHERE crm_configuration_id = 39 and email = '[EMAIL]';
SELECT * FROM leads WHERE crm_configuration_id = 39 and email = '[EMAIL]';
SELECT * FROM activity_searches where user_id = 143;
SELECT * FROM groups where team_id = 1;
select * from teams where id = 1;
select * from groups where team_id = 1; # 1150 - 7e75f8025c22
select id, name, group_id, status, deleted_at, email
from users where team_id = 1 order by group_id desc ;
select * from activity_searches where id in (1977, 1978, 1979);
select * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);
select * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277
select * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879
INSERT INTO `activity_search_filters`
(`activity_search_id`, `filter`, `value`) VALUES
(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),
(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),
(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')
;
select * from crm_configurations where id = 39;
select sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id
where u.team_id = 1;
SELECT * FROM social_accounts WHERE sociable_id = 1635;
SELECT * FROM users WHERE id = 1635;
select * from teams where id = 1;
select * from users where team_id = 1;
select * from team_features where team_id = 1;
select * from features;
SELECT * FROM activity_searches where id = 1982; # 1981
SELECT * FROM activity_search_filters WHERE activity_search_id = 1982;
SELECT * FROM automated_reports where id = 68;
UPDATE automated_reports set playbook_categories = NULL where id = 68;
SELECT * FROM automated_report_results where id = 275;
SELECT * FROM automated_reports order by id desc;
SELECT * FROM automated_report_results order by id desc;
select * from activity_searches where user_id = 143;
select * from ask_anything_prompts;
SELECT * FROM groups WHERE id = 1439;
SELECT * FROM users WHERE group_id = 1439;
select * from permissions; # 158
select * from roles;
select * from permission_role
select * from teams where id = 1;
select * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;
select * from groups where id = 28;
select * from playbooks where team_id = 1;
select * from playbooks where id = 179;
select * from playbook_categories where id = 1391;
select * from users where id = 143;
select * from crm_profiles where user_id = 143;
select * from activities where crm_configuration_id = 39 and type = 'conference'
and crm_provider_id IS NOT NULL ORDER by id desc;
select * from activities where id = 422003; # 00UO400000pB6fpMAC
SELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type
FROM automated_report_results ar
JOIN automated_reports a ON a.id = ar.report_id
WHERE a.type = 'ask_jiminny'
LIMIT 10;
SELECT `automated_report_results`.* FROM `automated_report_results`
INNER JOIN `automated_reports`
ON `automated_report_results`.`report_id` = `automated_reports`.`id`
WHERE `automated_report_results`.`generated_at` IS NOT NULL
AND `automated_reports`.`team_id` = 1
AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$."users"')
;
select * from teams where id = 3143;
select * from crm_configurations where id = 500;
select * from users where name = 'Integration Account'; # 1695
SELECT * FROM social_accounts WHERE sociable_id = 1695;
select * from activities where crm_configuration_id = 39
and recording_state = 'recorded' and duration > 60
and status = 'completed' and actual_start_time >= '2025-12-01';
SELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;
select * from leads;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"#11894 on JY-18909-automated-reports-ask-jiminny, menu","depth":5,"help_text":"Pull request #11894 exists for current branch JY-18909-automated-reports-ask-jiminny","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AutomatedReportsServiceTest","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AutomatedReportsServiceTest'","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AutomatedReportsServiceTest'","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"whereHas","depth":4,"value":"whereHas","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"3/3","depth":4,"role_description":"text"},{"role":"AXButton","text":"Previous Occurrence","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Occurrence","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Filter Search Results","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open in Window, Multiple Cursors","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Click to highlight","depth":4,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"16","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"7","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Repositories;\n\nuse Carbon\\CarbonImmutable;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Database\\Eloquent\\Collection;\nuse Illuminate\\Pagination\\LengthAwarePaginator;\nuse Illuminate\\Support\\Facades\\DB;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\AutomatedReportsService;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\ReportSort;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\ReportSortDirection;\n\nclass AutomatedReportsRepository\n{\n /**\n * Create a new automated report\n *\n * @param array $data\n *\n * @return AutomatedReport\n */\n public function create(array $data): AutomatedReport\n {\n return AutomatedReport::create($data);\n }\n\n /**\n * Find an automated report by UUID\n *\n * @param string $uuid\n *\n * @return AutomatedReport|null\n */\n public function findByUuid(string $uuid): ?AutomatedReport\n {\n return AutomatedReport::where('uuid', AutomatedReport::toOptimized($uuid))->first();\n }\n\n public function findByIdOrUuid(string $idOrUuid): ?AutomatedReport\n {\n if (is_numeric($idOrUuid)) {\n return AutomatedReport::find((int) $idOrUuid);\n }\n\n return AutomatedReport::where('uuid', AutomatedReport::toOptimized($idOrUuid))->first();\n }\n\n /**\n * Retrieve all standard (non-Ask Jiminny) automated reports.\n *\n * @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.\n * @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.\n *\n * @return Collection<AutomatedReport>\n */\n public function getAllStandardReports(\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): Collection {\n return $this->buildSortedQuery($sortColumn, $sortDirection)\n ->whereNot('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->get();\n }\n\n /**\n * Retrieve all Ask Jiminny reports created by the given user.\n *\n * @param User $user The user whose reports to retrieve.\n * @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.\n * @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.\n *\n * @return Collection<AutomatedReport>\n */\n public function getAskJiminnyReportsByUser(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): Collection {\n return $this->buildSortedQuery($sortColumn, $sortDirection)\n ->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->where('created_by', $user->getId())\n ->get();\n }\n\n private function buildSortedQuery(string $sortColumn, string $sortDirection): \\Illuminate\\Database\\Eloquent\\Builder\n {\n $allowedColumns = ['created_by', 'created_at'];\n if (! in_array($sortColumn, $allowedColumns)) {\n $sortColumn = 'created_at';\n }\n\n $sortDirection = strtolower($sortDirection) === 'asc' ? 'asc' : 'desc';\n\n $query = AutomatedReport::query()->with(['creator', 'team']);\n\n if ($sortColumn === 'created_by') {\n $query->leftJoin('users', 'users.id', '=', 'automated_reports.created_by')\n ->orderByRaw(\"users.name COLLATE utf8mb4_unicode_ci {$sortDirection}\")\n ->select('automated_reports.*');\n } else {\n $query->orderBy($sortColumn, $sortDirection);\n }\n\n return $query;\n }\n\n /**\n * Get all active Ask Jiminny reports whose expiry date has passed.\n *\n * @return Collection<AutomatedReport>\n */\n public function getExpiredActiveAskJiminnyReports(): Collection\n {\n return AutomatedReport::where('status', true)\n ->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->whereNotNull('expires_at')\n ->where('expires_at', '<', now()->toDateString())\n ->get();\n }\n\n /**\n * Get all active and enabled reports with active teams for the specified frequency.\n *\n * @param string $frequency\n *\n * @return Collection<AutomatedReport>\n */\n public function getActiveReportsByFrequency(string $frequency): Collection\n {\n return AutomatedReport::where('automated_reports.status', true)\n ->where('automated_reports.frequency', $frequency)\n ->join('teams', 'automated_reports.team_id', '=', 'teams.id')\n ->where('teams.status', Team::STATUS_ACTIVE)\n ->where(function ($query) {\n $query->whereNull('automated_reports.expires_at')\n ->orWhere('automated_reports.expires_at', '>=', now()->toDateString());\n })\n ->select('automated_reports.*')\n ->get();\n }\n\n /**\n * Update an automated report\n *\n * @param AutomatedReport $report\n * @param array $data\n *\n * @return AutomatedReport\n */\n public function update(AutomatedReport $report, array $data): AutomatedReport\n {\n $report->update($data);\n\n return $report;\n }\n\n /**\n * Create a new automated report result.\n *\n * @param array $data The data to create the automated report result with.\n *\n * @return AutomatedReportResult The newly created automated report result.\n */\n public function createResult(array $data): AutomatedReportResult\n {\n return AutomatedReportResult::create($data);\n }\n\n /**\n * Find an automated report result by UUID.\n *\n * @param string $uuid The UUID to find the automated report result with.\n *\n * @return AutomatedReportResult|null The automated report result if found, otherwise null.\n */\n public function findResultByUuid(string $uuid): ?AutomatedReportResult\n {\n return AutomatedReportResult::where('uuid', AutomatedReportResult::toOptimized($uuid))->first();\n }\n\n public function findResultByUuidForUser(string $uuid, User $user): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('uuid', AutomatedReportResult::toOptimized($uuid))\n ->whereHas('report', static function ($query) use ($user): void {\n $query->where('team_id', $user->getTeamId())\n ->where('created_by', $user->getId());\n })\n ->first();\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('parent_id', $result->getId())\n ->where('media_type', $type)\n ->first();\n }\n\n public function findLatestDefaultOrFailedResult(AutomatedReport $report): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('report_id', $report->getId())\n ->whereIn('status', [AutomatedReportResult::STATUS_DEFAULT, AutomatedReportResult::STATUS_FAILED])\n ->latest()\n ->first();\n }\n\n public function getGeneratedNotSentResults(): Collection\n {\n return AutomatedReportResult::query()\n ->whereNotNull('generated_at')\n ->whereNull('sent_at')\n ->where('status', AutomatedReportResult::STATUS_GENERATED)\n ->whereHas('report')\n ->with('report')\n ->get();\n }\n\n public function getPaginatedUserReports(\n User $user,\n ReportSort $sort,\n ReportSortDirection $sortDirection,\n int $resultsPerPage,\n int $page,\n ?Carbon $fromDate,\n ?Carbon $toDate,\n array $teamIds,\n array $reportTypes,\n ?string $name,\n ): LengthAwarePaginator {\n $query = AutomatedReportResult::query()\n ->whereNotNull('automated_report_results.generated_at')\n ->join('automated_reports', 'automated_report_results.report_id', '=', 'automated_reports.id')\n ->where(fn (Builder $q) => $this->applyUserAccessScope($q, $user))\n ->orderByRaw(\"$sort->value COLLATE utf8mb4_unicode_ci {$sortDirection->value}\")\n ->select('automated_report_results.*')\n ->with('report.team');\n\n if ($fromDate !== null && $toDate !== null) {\n $query->whereBetween('generated_at', [$fromDate, $toDate]);\n }\n\n if (! empty($teamIds)) {\n $query->where(function ($q) use ($teamIds) {\n foreach ($teamIds as $id) {\n $q->orWhereJsonContains('automated_reports.groups', $id);\n }\n });\n }\n\n if (! empty($reportTypes)) {\n $query->whereIn('automated_reports.type', $reportTypes);\n }\n\n if (! empty($name)) {\n $query->whereLike('name', \"%$name%\");\n }\n\n return $query->paginate($resultsPerPage, ['*'], 'page', $page);\n }\n\n public function countUserReports(User $user): int\n {\n return AutomatedReportResult::query()\n ->whereNotNull('generated_at')\n ->whereNotNull('sent_at')\n ->whereHas('report', function ($q) use ($user) {\n $q->where('team_id', $user->getTeamId())\n ->whereJsonContains('recipients->users', $user->getId());\n })\n ->count();\n }\n\n /**\n * Restrict a query on the automated_reports table to reports the given user is allowed to see.\n *\n * Matches the customer-facing audience:\n * - explicit user recipients (recipients.users)\n * - members of any of the report's groups (Ask Jiminny reports)\n */\n private function applyUserAccessScope(Builder $query, User $user): void\n {\n $userId = $user->getId();\n $groupId = $user->getGroupId();\n\n $query\n ->where('automated_reports.team_id', $user->getTeamId())\n ->where(function (Builder $q) use ($userId, $groupId): void {\n $q->whereJsonContains('automated_reports.recipients->users', $userId);\n\n if ($groupId !== null) {\n $q->orWhere(function (Builder $sub) use ($groupId): void {\n $sub->where('automated_reports.type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->whereJsonContains('automated_reports.groups', $groupId);\n });\n }\n });\n }\n\n /**\n * Get report IDs for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Support\\Collection\n */\n public function getReportIdsByTeam(Team $team): \\Illuminate\\Support\\Collection\n {\n return AutomatedReport::where('team_id', $team->getId())->pluck('id');\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return Collection\n */\n public function getReportsByTeam(Team $team): Collection\n {\n return AutomatedReport::where('team_id', $team->getId())->get();\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return Collection\n */\n public function getResultsByReport(AutomatedReport $report): Collection\n {\n return $this->getResultsByReportQuery($report)->get();\n }\n\n public function getResultsByReportQuery(AutomatedReport $report): Builder\n {\n return AutomatedReportResult::where('report_id', $report->getId());\n }\n\n public function getReportResultsQueryForRetention(Team $team, CarbonImmutable $retentionDate): Builder\n {\n $reportIds = $this->getReportIdsByTeam($team);\n\n return AutomatedReportResult::query()->whereIn('report_id', $reportIds)\n ->whereRaw('IFNULL(generated_at, created_at) <= ?', [$retentionDate]);\n }\n\n /**\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return \\Illuminate\\Support\\Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): \\Illuminate\\Support\\Collection\n {\n $query = DB::table('automated_reports')\n ->join('teams', 'automated_reports.team_id', '=', 'teams.id')\n ->select('teams.id')\n ->distinct();\n\n if ($teamId !== null) {\n $query->where('teams.id', $teamId);\n }\n\n return $query->pluck('teams.id');\n }\n}","depth":4,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Repositories;\n\nuse Carbon\\CarbonImmutable;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Database\\Eloquent\\Collection;\nuse Illuminate\\Pagination\\LengthAwarePaginator;\nuse Illuminate\\Support\\Facades\\DB;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\AutomatedReportsService;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\ReportSort;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\ReportSortDirection;\n\nclass AutomatedReportsRepository\n{\n /**\n * Create a new automated report\n *\n * @param array $data\n *\n * @return AutomatedReport\n */\n public function create(array $data): AutomatedReport\n {\n return AutomatedReport::create($data);\n }\n\n /**\n * Find an automated report by UUID\n *\n * @param string $uuid\n *\n * @return AutomatedReport|null\n */\n public function findByUuid(string $uuid): ?AutomatedReport\n {\n return AutomatedReport::where('uuid', AutomatedReport::toOptimized($uuid))->first();\n }\n\n public function findByIdOrUuid(string $idOrUuid): ?AutomatedReport\n {\n if (is_numeric($idOrUuid)) {\n return AutomatedReport::find((int) $idOrUuid);\n }\n\n return AutomatedReport::where('uuid', AutomatedReport::toOptimized($idOrUuid))->first();\n }\n\n /**\n * Retrieve all standard (non-Ask Jiminny) automated reports.\n *\n * @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.\n * @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.\n *\n * @return Collection<AutomatedReport>\n */\n public function getAllStandardReports(\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): Collection {\n return $this->buildSortedQuery($sortColumn, $sortDirection)\n ->whereNot('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->get();\n }\n\n /**\n * Retrieve all Ask Jiminny reports created by the given user.\n *\n * @param User $user The user whose reports to retrieve.\n * @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.\n * @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.\n *\n * @return Collection<AutomatedReport>\n */\n public function getAskJiminnyReportsByUser(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): Collection {\n return $this->buildSortedQuery($sortColumn, $sortDirection)\n ->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->where('created_by', $user->getId())\n ->get();\n }\n\n private function buildSortedQuery(string $sortColumn, string $sortDirection): \\Illuminate\\Database\\Eloquent\\Builder\n {\n $allowedColumns = ['created_by', 'created_at'];\n if (! in_array($sortColumn, $allowedColumns)) {\n $sortColumn = 'created_at';\n }\n\n $sortDirection = strtolower($sortDirection) === 'asc' ? 'asc' : 'desc';\n\n $query = AutomatedReport::query()->with(['creator', 'team']);\n\n if ($sortColumn === 'created_by') {\n $query->leftJoin('users', 'users.id', '=', 'automated_reports.created_by')\n ->orderByRaw(\"users.name COLLATE utf8mb4_unicode_ci {$sortDirection}\")\n ->select('automated_reports.*');\n } else {\n $query->orderBy($sortColumn, $sortDirection);\n }\n\n return $query;\n }\n\n /**\n * Get all active Ask Jiminny reports whose expiry date has passed.\n *\n * @return Collection<AutomatedReport>\n */\n public function getExpiredActiveAskJiminnyReports(): Collection\n {\n return AutomatedReport::where('status', true)\n ->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->whereNotNull('expires_at')\n ->where('expires_at', '<', now()->toDateString())\n ->get();\n }\n\n /**\n * Get all active and enabled reports with active teams for the specified frequency.\n *\n * @param string $frequency\n *\n * @return Collection<AutomatedReport>\n */\n public function getActiveReportsByFrequency(string $frequency): Collection\n {\n return AutomatedReport::where('automated_reports.status', true)\n ->where('automated_reports.frequency', $frequency)\n ->join('teams', 'automated_reports.team_id', '=', 'teams.id')\n ->where('teams.status', Team::STATUS_ACTIVE)\n ->where(function ($query) {\n $query->whereNull('automated_reports.expires_at')\n ->orWhere('automated_reports.expires_at', '>=', now()->toDateString());\n })\n ->select('automated_reports.*')\n ->get();\n }\n\n /**\n * Update an automated report\n *\n * @param AutomatedReport $report\n * @param array $data\n *\n * @return AutomatedReport\n */\n public function update(AutomatedReport $report, array $data): AutomatedReport\n {\n $report->update($data);\n\n return $report;\n }\n\n /**\n * Create a new automated report result.\n *\n * @param array $data The data to create the automated report result with.\n *\n * @return AutomatedReportResult The newly created automated report result.\n */\n public function createResult(array $data): AutomatedReportResult\n {\n return AutomatedReportResult::create($data);\n }\n\n /**\n * Find an automated report result by UUID.\n *\n * @param string $uuid The UUID to find the automated report result with.\n *\n * @return AutomatedReportResult|null The automated report result if found, otherwise null.\n */\n public function findResultByUuid(string $uuid): ?AutomatedReportResult\n {\n return AutomatedReportResult::where('uuid', AutomatedReportResult::toOptimized($uuid))->first();\n }\n\n public function findResultByUuidForUser(string $uuid, User $user): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('uuid', AutomatedReportResult::toOptimized($uuid))\n ->whereHas('report', static function ($query) use ($user): void {\n $query->where('team_id', $user->getTeamId())\n ->where('created_by', $user->getId());\n })\n ->first();\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('parent_id', $result->getId())\n ->where('media_type', $type)\n ->first();\n }\n\n public function findLatestDefaultOrFailedResult(AutomatedReport $report): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('report_id', $report->getId())\n ->whereIn('status', [AutomatedReportResult::STATUS_DEFAULT, AutomatedReportResult::STATUS_FAILED])\n ->latest()\n ->first();\n }\n\n public function getGeneratedNotSentResults(): Collection\n {\n return AutomatedReportResult::query()\n ->whereNotNull('generated_at')\n ->whereNull('sent_at')\n ->where('status', AutomatedReportResult::STATUS_GENERATED)\n ->whereHas('report')\n ->with('report')\n ->get();\n }\n\n public function getPaginatedUserReports(\n User $user,\n ReportSort $sort,\n ReportSortDirection $sortDirection,\n int $resultsPerPage,\n int $page,\n ?Carbon $fromDate,\n ?Carbon $toDate,\n array $teamIds,\n array $reportTypes,\n ?string $name,\n ): LengthAwarePaginator {\n $query = AutomatedReportResult::query()\n ->whereNotNull('automated_report_results.generated_at')\n ->join('automated_reports', 'automated_report_results.report_id', '=', 'automated_reports.id')\n ->where(fn (Builder $q) => $this->applyUserAccessScope($q, $user))\n ->orderByRaw(\"$sort->value COLLATE utf8mb4_unicode_ci {$sortDirection->value}\")\n ->select('automated_report_results.*')\n ->with('report.team');\n\n if ($fromDate !== null && $toDate !== null) {\n $query->whereBetween('generated_at', [$fromDate, $toDate]);\n }\n\n if (! empty($teamIds)) {\n $query->where(function ($q) use ($teamIds) {\n foreach ($teamIds as $id) {\n $q->orWhereJsonContains('automated_reports.groups', $id);\n }\n });\n }\n\n if (! empty($reportTypes)) {\n $query->whereIn('automated_reports.type', $reportTypes);\n }\n\n if (! empty($name)) {\n $query->whereLike('name', \"%$name%\");\n }\n\n return $query->paginate($resultsPerPage, ['*'], 'page', $page);\n }\n\n public function countUserReports(User $user): int\n {\n return AutomatedReportResult::query()\n ->whereNotNull('generated_at')\n ->whereNotNull('sent_at')\n ->whereHas('report', function ($q) use ($user) {\n $q->where('team_id', $user->getTeamId())\n ->whereJsonContains('recipients->users', $user->getId());\n })\n ->count();\n }\n\n /**\n * Restrict a query on the automated_reports table to reports the given user is allowed to see.\n *\n * Matches the customer-facing audience:\n * - explicit user recipients (recipients.users)\n * - members of any of the report's groups (Ask Jiminny reports)\n */\n private function applyUserAccessScope(Builder $query, User $user): void\n {\n $userId = $user->getId();\n $groupId = $user->getGroupId();\n\n $query\n ->where('automated_reports.team_id', $user->getTeamId())\n ->where(function (Builder $q) use ($userId, $groupId): void {\n $q->whereJsonContains('automated_reports.recipients->users', $userId);\n\n if ($groupId !== null) {\n $q->orWhere(function (Builder $sub) use ($groupId): void {\n $sub->where('automated_reports.type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->whereJsonContains('automated_reports.groups', $groupId);\n });\n }\n });\n }\n\n /**\n * Get report IDs for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Support\\Collection\n */\n public function getReportIdsByTeam(Team $team): \\Illuminate\\Support\\Collection\n {\n return AutomatedReport::where('team_id', $team->getId())->pluck('id');\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return Collection\n */\n public function getReportsByTeam(Team $team): Collection\n {\n return AutomatedReport::where('team_id', $team->getId())->get();\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return Collection\n */\n public function getResultsByReport(AutomatedReport $report): Collection\n {\n return $this->getResultsByReportQuery($report)->get();\n }\n\n public function getResultsByReportQuery(AutomatedReport $report): Builder\n {\n return AutomatedReportResult::where('report_id', $report->getId());\n }\n\n public function getReportResultsQueryForRetention(Team $team, CarbonImmutable $retentionDate): Builder\n {\n $reportIds = $this->getReportIdsByTeam($team);\n\n return AutomatedReportResult::query()->whereIn('report_id', $reportIds)\n ->whereRaw('IFNULL(generated_at, created_at) <= ?', [$retentionDate]);\n }\n\n /**\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return \\Illuminate\\Support\\Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): \\Illuminate\\Support\\Collection\n {\n $query = DB::table('automated_reports')\n ->join('teams', 'automated_reports.team_id', '=', 'teams.id')\n ->select('teams.id')\n ->distinct();\n\n if ($teamId !== null) {\n $query->where('teams.id', $teamId);\n }\n\n return $query->pluck('teams.id');\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"18","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"14","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"2","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"4","depth":4,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o\nJOIN activities a ON o.id = a.opportunity_id\nWHERE a.crm_configuration_id = 39\nAND a.actual_start_time > '2025-10-13'\nAND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM activities\nWHERE crm_configuration_id = 39 and user_id = 143\nand actual_start_time >= '2025-10-13'\nAND type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM opportunities WHERE account_id IN (178);\nselect * from activities where id IN (620137, 620187, 620188, 620189, 620230);\n\n# HS\nSELECT * FROM opportunities WHERE id IN (238);\nselect * from activities where id IN (477,2076);\n\nselect * from users;\n\nSELECT COUNT(*) FROM users;\nSELECT COUNT(*) FROM activities;\nSELECT COUNT(*) FROM opportunities;\n\nUPDATE activities\nSET\n actual_start_time = '2025-12-19 09:00:00',\n actual_end_time = '2025-12-19 10:30:00',\n scheduled_start_time = '2025-12-19 09:00:00',\n scheduled_end_time = '2025-12-19 10:30:00'\nWHERE id IN (407509,407375);\n\nselect * from partners;\n\nSELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id\nFROM activities\nWHERE user_id = 143\nAND actual_start_time >= '2025-10-13 00:00:00'\nAND actual_start_time <= '2026-01-13 23:59:59'\nORDER BY actual_start_time DESC;\n\nSELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;\nSELECT * FROM crm_layouts where crm_configuration_id = 39;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;\n# lead_id\n# account_id 177\n# contact_id 3969\n# opportunity_id\n# stage_id 203\n\nSELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;\n\nSELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'\nAND user_id = 143 and actual_start_time >= '2025-10-13';\n\nSELECT * FROM activities a\n# JOIN opportunities o ON a.opportunity_id = o.id\nWHERE a.crm_configuration_id = 39 AND a.type = 'conference'\nand status = 'completed' and recording_state = 'recorded'\nand a.actual_start_time >= '2025-10-13'\nAND a.user_id = 143\n;\n\nselect * from leads\nwhere crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707\n\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310);\nSELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198\nSELECT * FROM activities WHERE id IN (356001, 356008); # contacts:\n\nSELECT * FROM opportunities WHERE id IN (1707);\nSELECT * FROM stages where id IN (204, 198);\nSELECT * FROM opportunities WHERE account_id IN (178);\nSELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';\nSELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal\n\nSELECT * FROM activities where crm_configuration_id = 39\nAND opportunity_id IS NULL\nAND is_internal = false\nand status = 'completed' and recording_state = 'recorded'\nAND actual_start_time >= '2025-10-13'\nAND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)\n# AND lead_id IN (112, 109)\n;\n\nSELECT * FROM crm_profiles WHERE user_id = 143;\n\nselect * from inboxes; # 212\nselect * from users where id = 143; # 143\nselect * from inbox_email_batches where inbox_id = 212\nand updated_at >= '2026-01-28 00:00:00' order by id desc;\nselect * from inbox_emails where inbox_id = 212\nand batch_id = 95885 order by id desc;\nselect * from email_messages where origin_user_id = 143;\nselect * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';\nselect * from participants where activity_id = 620247;\n\nselect * from crm_profiles where user_id = 143;\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001\nselect * from transcription where activity_id = 356001; # 6943\nselect * from ai_prompts where transcription_id = 6943;\nSELECT * FROM activity_summary_logs where activity_id = 356001;\n\nSELECT * FROM social_accounts WHERE sociable_id = 143;\n\n# ************************************************************************************\nSELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;\n# 422515 softphone tr. 8100\n\nSELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;\n# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS\n\nselect * from ai_prompts where transcription_id IN (8100, 7670);\nselect * from activity_summary_logs where activity_id = 407509;\n\nselect * from sidekick_settings;\nselect * from default_activity_types;\n\nSELECT * FROM contacts WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\nSELECT * FROM leads WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\n\nSELECT * FROM activity_searches where user_id = 143;\nSELECT * FROM groups where team_id = 1;\n\nselect * from teams where id = 1;\nselect * from groups where team_id = 1; # 1150 - 7e75f8025c22\nselect id, name, group_id, status, deleted_at, email\nfrom users where team_id = 1 order by group_id desc ;\n\nselect * from activity_searches where id in (1977, 1978, 1979);\nselect * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);\nselect * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277\nselect * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879\n\nINSERT INTO `activity_search_filters`\n(`activity_search_id`, `filter`, `value`) VALUES\n(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')\n;\n\nselect * from crm_configurations where id = 39;\n\n\nselect sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id\nwhere u.team_id = 1;\nSELECT * FROM social_accounts WHERE sociable_id = 1635;\nSELECT * FROM users WHERE id = 1635;\n\nselect * from teams where id = 1;\nselect * from users where team_id = 1;\nselect * from team_features where team_id = 1;\nselect * from features;\n\nSELECT * FROM activity_searches where id = 1982; # 1981\nSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;\n\nSELECT * FROM automated_reports where id = 68;\nUPDATE automated_reports set playbook_categories = NULL where id = 68;\nSELECT * FROM automated_report_results where id = 275;\n\nSELECT * FROM automated_reports order by id desc;\nSELECT * FROM automated_report_results order by id desc;\nselect * from activity_searches where user_id = 143;\nselect * from ask_anything_prompts;\n\nSELECT * FROM groups WHERE id = 1439;\nSELECT * FROM users WHERE group_id = 1439;\n\nselect * from permissions; # 158\nselect * from roles;\nselect * from permission_role\n\nselect * from teams where id = 1;\nselect * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;\nselect * from groups where id = 28;\nselect * from playbooks where team_id = 1;\nselect * from playbooks where id = 179;\nselect * from playbook_categories where id = 1391;\nselect * from users where id = 143;\nselect * from crm_profiles where user_id = 143;\nselect * from activities where crm_configuration_id = 39 and type = 'conference'\nand crm_provider_id IS NOT NULL ORDER by id desc;\nselect * from activities where id = 422003; # 00UO400000pB6fpMAC\n\nSELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type\nFROM automated_report_results ar\nJOIN automated_reports a ON a.id = ar.report_id\nWHERE a.type = 'ask_jiminny'\nLIMIT 10;\n\nSELECT `automated_report_results`.* FROM `automated_report_results`\nINNER JOIN `automated_reports`\n ON `automated_report_results`.`report_id` = `automated_reports`.`id`\nWHERE `automated_report_results`.`generated_at` IS NOT NULL\n AND `automated_reports`.`team_id` = 1\n AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$.\"users\"')\n;\n\n\nselect * from teams where id = 3143;\nselect * from crm_configurations where id = 500;\nselect * from users where name = 'Integration Account'; # 1695\nSELECT * FROM social_accounts WHERE sociable_id = 1695;\n\nselect * from activities where crm_configuration_id = 39\nand recording_state = 'recorded' and duration > 60\nand status = 'completed' and actual_start_time >= '2025-12-01';\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;\n\nselect * from leads;","depth":4,"value":"SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o\nJOIN activities a ON o.id = a.opportunity_id\nWHERE a.crm_configuration_id = 39\nAND a.actual_start_time > '2025-10-13'\nAND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM activities\nWHERE crm_configuration_id = 39 and user_id = 143\nand actual_start_time >= '2025-10-13'\nAND type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM opportunities WHERE account_id IN (178);\nselect * from activities where id IN (620137, 620187, 620188, 620189, 620230);\n\n# HS\nSELECT * FROM opportunities WHERE id IN (238);\nselect * from activities where id IN (477,2076);\n\nselect * from users;\n\nSELECT COUNT(*) FROM users;\nSELECT COUNT(*) FROM activities;\nSELECT COUNT(*) FROM opportunities;\n\nUPDATE activities\nSET\n actual_start_time = '2025-12-19 09:00:00',\n actual_end_time = '2025-12-19 10:30:00',\n scheduled_start_time = '2025-12-19 09:00:00',\n scheduled_end_time = '2025-12-19 10:30:00'\nWHERE id IN (407509,407375);\n\nselect * from partners;\n\nSELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id\nFROM activities\nWHERE user_id = 143\nAND actual_start_time >= '2025-10-13 00:00:00'\nAND actual_start_time <= '2026-01-13 23:59:59'\nORDER BY actual_start_time DESC;\n\nSELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;\nSELECT * FROM crm_layouts where crm_configuration_id = 39;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;\n# lead_id\n# account_id 177\n# contact_id 3969\n# opportunity_id\n# stage_id 203\n\nSELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;\n\nSELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'\nAND user_id = 143 and actual_start_time >= '2025-10-13';\n\nSELECT * FROM activities a\n# JOIN opportunities o ON a.opportunity_id = o.id\nWHERE a.crm_configuration_id = 39 AND a.type = 'conference'\nand status = 'completed' and recording_state = 'recorded'\nand a.actual_start_time >= '2025-10-13'\nAND a.user_id = 143\n;\n\nselect * from leads\nwhere crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707\n\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310);\nSELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198\nSELECT * FROM activities WHERE id IN (356001, 356008); # contacts:\n\nSELECT * FROM opportunities WHERE id IN (1707);\nSELECT * FROM stages where id IN (204, 198);\nSELECT * FROM opportunities WHERE account_id IN (178);\nSELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';\nSELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal\n\nSELECT * FROM activities where crm_configuration_id = 39\nAND opportunity_id IS NULL\nAND is_internal = false\nand status = 'completed' and recording_state = 'recorded'\nAND actual_start_time >= '2025-10-13'\nAND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)\n# AND lead_id IN (112, 109)\n;\n\nSELECT * FROM crm_profiles WHERE user_id = 143;\n\nselect * from inboxes; # 212\nselect * from users where id = 143; # 143\nselect * from inbox_email_batches where inbox_id = 212\nand updated_at >= '2026-01-28 00:00:00' order by id desc;\nselect * from inbox_emails where inbox_id = 212\nand batch_id = 95885 order by id desc;\nselect * from email_messages where origin_user_id = 143;\nselect * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';\nselect * from participants where activity_id = 620247;\n\nselect * from crm_profiles where user_id = 143;\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001\nselect * from transcription where activity_id = 356001; # 6943\nselect * from ai_prompts where transcription_id = 6943;\nSELECT * FROM activity_summary_logs where activity_id = 356001;\n\nSELECT * FROM social_accounts WHERE sociable_id = 143;\n\n# ************************************************************************************\nSELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;\n# 422515 softphone tr. 8100\n\nSELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;\n# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS\n\nselect * from ai_prompts where transcription_id IN (8100, 7670);\nselect * from activity_summary_logs where activity_id = 407509;\n\nselect * from sidekick_settings;\nselect * from default_activity_types;\n\nSELECT * FROM contacts WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\nSELECT * FROM leads WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\n\nSELECT * FROM activity_searches where user_id = 143;\nSELECT * FROM groups where team_id = 1;\n\nselect * from teams where id = 1;\nselect * from groups where team_id = 1; # 1150 - 7e75f8025c22\nselect id, name, group_id, status, deleted_at, email\nfrom users where team_id = 1 order by group_id desc ;\n\nselect * from activity_searches where id in (1977, 1978, 1979);\nselect * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);\nselect * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277\nselect * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879\n\nINSERT INTO `activity_search_filters`\n(`activity_search_id`, `filter`, `value`) VALUES\n(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')\n;\n\nselect * from crm_configurations where id = 39;\n\n\nselect sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id\nwhere u.team_id = 1;\nSELECT * FROM social_accounts WHERE sociable_id = 1635;\nSELECT * FROM users WHERE id = 1635;\n\nselect * from teams where id = 1;\nselect * from users where team_id = 1;\nselect * from team_features where team_id = 1;\nselect * from features;\n\nSELECT * FROM activity_searches where id = 1982; # 1981\nSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;\n\nSELECT * FROM automated_reports where id = 68;\nUPDATE automated_reports set playbook_categories = NULL where id = 68;\nSELECT * FROM automated_report_results where id = 275;\n\nSELECT * FROM automated_reports order by id desc;\nSELECT * FROM automated_report_results order by id desc;\nselect * from activity_searches where user_id = 143;\nselect * from ask_anything_prompts;\n\nSELECT * FROM groups WHERE id = 1439;\nSELECT * FROM users WHERE group_id = 1439;\n\nselect * from permissions; # 158\nselect * from roles;\nselect * from permission_role\n\nselect * from teams where id = 1;\nselect * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;\nselect * from groups where id = 28;\nselect * from playbooks where team_id = 1;\nselect * from playbooks where id = 179;\nselect * from playbook_categories where id = 1391;\nselect * from users where id = 143;\nselect * from crm_profiles where user_id = 143;\nselect * from activities where crm_configuration_id = 39 and type = 'conference'\nand crm_provider_id IS NOT NULL ORDER by id desc;\nselect * from activities where id = 422003; # 00UO400000pB6fpMAC\n\nSELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type\nFROM automated_report_results ar\nJOIN automated_reports a ON a.id = ar.report_id\nWHERE a.type = 'ask_jiminny'\nLIMIT 10;\n\nSELECT `automated_report_results`.* FROM `automated_report_results`\nINNER JOIN `automated_reports`\n ON `automated_report_results`.`report_id` = `automated_reports`.`id`\nWHERE `automated_report_results`.`generated_at` IS NOT NULL\n AND `automated_reports`.`team_id` = 1\n AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$.\"users\"')\n;\n\n\nselect * from teams where id = 3143;\nselect * from crm_configurations where id = 500;\nselect * from users where name = 'Integration Account'; # 1695\nSELECT * FROM social_accounts WHERE sociable_id = 1695;\n\nselect * from activities where crm_configuration_id = 39\nand recording_state = 'recorded' and duration > 60\nand status = 'completed' and actual_start_time >= '2025-12-01';\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;\n\nselect * from leads;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
5262134208844209929
|
-2393068234934446523
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsServiceTest
Run 'AutomatedReportsServiceTest'
Debug 'AutomatedReportsServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
whereHas
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
3/3
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
16
7
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Repositories;
use Carbon\CarbonImmutable;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Facades\DB;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\Kiosk\AutomatedReports\ReportSort;
use Jiminny\Services\Kiosk\AutomatedReports\ReportSortDirection;
class AutomatedReportsRepository
{
/**
* Create a new automated report
*
* @param array $data
*
* @return AutomatedReport
*/
public function create(array $data): AutomatedReport
{
return AutomatedReport::create($data);
}
/**
* Find an automated report by UUID
*
* @param string $uuid
*
* @return AutomatedReport|null
*/
public function findByUuid(string $uuid): ?AutomatedReport
{
return AutomatedReport::where('uuid', AutomatedReport::toOptimized($uuid))->first();
}
public function findByIdOrUuid(string $idOrUuid): ?AutomatedReport
{
if (is_numeric($idOrUuid)) {
return AutomatedReport::find((int) $idOrUuid);
}
return AutomatedReport::where('uuid', AutomatedReport::toOptimized($idOrUuid))->first();
}
/**
* Retrieve all standard (non-Ask Jiminny) automated reports.
*
* @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.
* @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.
*
* @return Collection<AutomatedReport>
*/
public function getAllStandardReports(
string $sortColumn = 'created_at',
string $sortDirection = 'desc'
): Collection {
return $this->buildSortedQuery($sortColumn, $sortDirection)
->whereNot('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->get();
}
/**
* Retrieve all Ask Jiminny reports created by the given user.
*
* @param User $user The user whose reports to retrieve.
* @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.
* @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.
*
* @return Collection<AutomatedReport>
*/
public function getAskJiminnyReportsByUser(
User $user,
string $sortColumn = 'created_at',
string $sortDirection = 'desc'
): Collection {
return $this->buildSortedQuery($sortColumn, $sortDirection)
->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->where('created_by', $user->getId())
->get();
}
private function buildSortedQuery(string $sortColumn, string $sortDirection): \Illuminate\Database\Eloquent\Builder
{
$allowedColumns = ['created_by', 'created_at'];
if (! in_array($sortColumn, $allowedColumns)) {
$sortColumn = 'created_at';
}
$sortDirection = strtolower($sortDirection) === 'asc' ? 'asc' : 'desc';
$query = AutomatedReport::query()->with(['creator', 'team']);
if ($sortColumn === 'created_by') {
$query->leftJoin('users', 'users.id', '=', 'automated_reports.created_by')
->orderByRaw("users.name COLLATE utf8mb4_unicode_ci {$sortDirection}")
->select('automated_reports.*');
} else {
$query->orderBy($sortColumn, $sortDirection);
}
return $query;
}
/**
* Get all active Ask Jiminny reports whose expiry date has passed.
*
* @return Collection<AutomatedReport>
*/
public function getExpiredActiveAskJiminnyReports(): Collection
{
return AutomatedReport::where('status', true)
->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->whereNotNull('expires_at')
->where('expires_at', '<', now()->toDateString())
->get();
}
/**
* Get all active and enabled reports with active teams for the specified frequency.
*
* @param string $frequency
*
* @return Collection<AutomatedReport>
*/
public function getActiveReportsByFrequency(string $frequency): Collection
{
return AutomatedReport::where('automated_reports.status', true)
->where('automated_reports.frequency', $frequency)
->join('teams', 'automated_reports.team_id', '=', 'teams.id')
->where('teams.status', Team::STATUS_ACTIVE)
->where(function ($query) {
$query->whereNull('automated_reports.expires_at')
->orWhere('automated_reports.expires_at', '>=', now()->toDateString());
})
->select('automated_reports.*')
->get();
}
/**
* Update an automated report
*
* @param AutomatedReport $report
* @param array $data
*
* @return AutomatedReport
*/
public function update(AutomatedReport $report, array $data): AutomatedReport
{
$report->update($data);
return $report;
}
/**
* Create a new automated report result.
*
* @param array $data The data to create the automated report result with.
*
* @return AutomatedReportResult The newly created automated report result.
*/
public function createResult(array $data): AutomatedReportResult
{
return AutomatedReportResult::create($data);
}
/**
* Find an automated report result by UUID.
*
* @param string $uuid The UUID to find the automated report result with.
*
* @return AutomatedReportResult|null The automated report result if found, otherwise null.
*/
public function findResultByUuid(string $uuid): ?AutomatedReportResult
{
return AutomatedReportResult::where('uuid', AutomatedReportResult::toOptimized($uuid))->first();
}
public function findResultByUuidForUser(string $uuid, User $user): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('uuid', AutomatedReportResult::toOptimized($uuid))
->whereHas('report', static function ($query) use ($user): void {
$query->where('team_id', $user->getTeamId())
->where('created_by', $user->getId());
})
->first();
}
public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('parent_id', $result->getId())
->where('media_type', $type)
->first();
}
public function findLatestDefaultOrFailedResult(AutomatedReport $report): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('report_id', $report->getId())
->whereIn('status', [AutomatedReportResult::STATUS_DEFAULT, AutomatedReportResult::STATUS_FAILED])
->latest()
->first();
}
public function getGeneratedNotSentResults(): Collection
{
return AutomatedReportResult::query()
->whereNotNull('generated_at')
->whereNull('sent_at')
->where('status', AutomatedReportResult::STATUS_GENERATED)
->whereHas('report')
->with('report')
->get();
}
public function getPaginatedUserReports(
User $user,
ReportSort $sort,
ReportSortDirection $sortDirection,
int $resultsPerPage,
int $page,
?Carbon $fromDate,
?Carbon $toDate,
array $teamIds,
array $reportTypes,
?string $name,
): LengthAwarePaginator {
$query = AutomatedReportResult::query()
->whereNotNull('automated_report_results.generated_at')
->join('automated_reports', 'automated_report_results.report_id', '=', 'automated_reports.id')
->where(fn (Builder $q) => $this->applyUserAccessScope($q, $user))
->orderByRaw("$sort->value COLLATE utf8mb4_unicode_ci {$sortDirection->value}")
->select('automated_report_results.*')
->with('report.team');
if ($fromDate !== null && $toDate !== null) {
$query->whereBetween('generated_at', [$fromDate, $toDate]);
}
if (! empty($teamIds)) {
$query->where(function ($q) use ($teamIds) {
foreach ($teamIds as $id) {
$q->orWhereJsonContains('automated_reports.groups', $id);
}
});
}
if (! empty($reportTypes)) {
$query->whereIn('automated_reports.type', $reportTypes);
}
if (! empty($name)) {
$query->whereLike('name', "%$name%");
}
return $query->paginate($resultsPerPage, ['*'], 'page', $page);
}
public function countUserReports(User $user): int
{
return AutomatedReportResult::query()
->whereNotNull('generated_at')
->whereNotNull('sent_at')
->whereHas('report', function ($q) use ($user) {
$q->where('team_id', $user->getTeamId())
->whereJsonContains('recipients->users', $user->getId());
})
->count();
}
/**
* Restrict a query on the automated_reports table to reports the given user is allowed to see.
*
* Matches the customer-facing audience:
* - explicit user recipients (recipients.users)
* - members of any of the report's groups (Ask Jiminny reports)
*/
private function applyUserAccessScope(Builder $query, User $user): void
{
$userId = $user->getId();
$groupId = $user->getGroupId();
$query
->where('automated_reports.team_id', $user->getTeamId())
->where(function (Builder $q) use ($userId, $groupId): void {
$q->whereJsonContains('automated_reports.recipients->users', $userId);
if ($groupId !== null) {
$q->orWhere(function (Builder $sub) use ($groupId): void {
$sub->where('automated_reports.type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->whereJsonContains('automated_reports.groups', $groupId);
});
}
});
}
/**
* Get report IDs for a specific team
*
* @param Team $team
*
* @return \Illuminate\Support\Collection
*/
public function getReportIdsByTeam(Team $team): \Illuminate\Support\Collection
{
return AutomatedReport::where('team_id', $team->getId())->pluck('id');
}
/**
* Get all reports for a specific team
*
* @param Team $team
*
* @return Collection
*/
public function getReportsByTeam(Team $team): Collection
{
return AutomatedReport::where('team_id', $team->getId())->get();
}
/**
* Get all report results for a specific report
*
* @param AutomatedReport $report
*
* @return Collection
*/
public function getResultsByReport(AutomatedReport $report): Collection
{
return $this->getResultsByReportQuery($report)->get();
}
public function getResultsByReportQuery(AutomatedReport $report): Builder
{
return AutomatedReportResult::where('report_id', $report->getId());
}
public function getReportResultsQueryForRetention(Team $team, CarbonImmutable $retentionDate): Builder
{
$reportIds = $this->getReportIdsByTeam($team);
return AutomatedReportResult::query()->whereIn('report_id', $reportIds)
->whereRaw('IFNULL(generated_at, created_at) <= ?', [$retentionDate]);
}
/**
* @param int|null $teamId Optional team ID to filter results
*
* @return \Illuminate\Support\Collection<int, int> Collection of team IDs
*/
public function getTeamIdsWithReportsResults(?int $teamId = null): \Illuminate\Support\Collection
{
$query = DB::table('automated_reports')
->join('teams', 'automated_reports.team_id', '=', 'teams.id')
->select('teams.id')
->distinct();
if ($teamId !== null) {
$query->where('teams.id', $teamId);
}
return $query->pluck('teams.id');
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
18
14
2
4
Previous Highlighted Error
Next Highlighted Error
SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o
JOIN activities a ON o.id = a.opportunity_id
WHERE a.crm_configuration_id = 39
AND a.actual_start_time > '2025-10-13'
AND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')
;
SELECT * FROM activities
WHERE crm_configuration_id = 39 and user_id = 143
and actual_start_time >= '2025-10-13'
AND type IN ('conference', 'softphone-inbound', 'softphone-outbound')
;
SELECT * FROM opportunities WHERE account_id IN (178);
select * from activities where id IN (620137, 620187, 620188, 620189, 620230);
# HS
SELECT * FROM opportunities WHERE id IN (238);
select * from activities where id IN (477,2076);
select * from users;
SELECT COUNT(*) FROM users;
SELECT COUNT(*) FROM activities;
SELECT COUNT(*) FROM opportunities;
UPDATE activities
SET
actual_start_time = '2025-12-19 09:00:00',
actual_end_time = '2025-12-19 10:30:00',
scheduled_start_time = '2025-12-19 09:00:00',
scheduled_end_time = '2025-12-19 10:30:00'
WHERE id IN (407509,407375);
select * from partners;
SELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id
FROM activities
WHERE user_id = 143
AND actual_start_time >= '2025-10-13 00:00:00'
AND actual_start_time <= '2026-01-13 23:59:59'
ORDER BY actual_start_time DESC;
SELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;
SELECT * FROM crm_layouts where crm_configuration_id = 39;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;
# lead_id
# account_id 177
# contact_id 3969
# opportunity_id
# stage_id 203
SELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;
SELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'
AND user_id = 143 and actual_start_time >= '2025-10-13';
SELECT * FROM activities a
# JOIN opportunities o ON a.opportunity_id = o.id
WHERE a.crm_configuration_id = 39 AND a.type = 'conference'
and status = 'completed' and recording_state = 'recorded'
and a.actual_start_time >= '2025-10-13'
AND a.user_id = 143
;
select * from leads
where crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707
SELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);
SELECT * FROM activities WHERE id IN (356013,616188,616202,616310);
SELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198
SELECT * FROM activities WHERE id IN (356001, 356008); # contacts:
SELECT * FROM opportunities WHERE id IN (1707);
SELECT * FROM stages where id IN (204, 198);
SELECT * FROM opportunities WHERE account_id IN (178);
SELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';
SELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal
SELECT * FROM activities where crm_configuration_id = 39
AND opportunity_id IS NULL
AND is_internal = false
and status = 'completed' and recording_state = 'recorded'
AND actual_start_time >= '2025-10-13'
AND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)
# AND lead_id IN (112, 109)
;
SELECT * FROM crm_profiles WHERE user_id = 143;
select * from inboxes; # 212
select * from users where id = 143; # 143
select * from inbox_email_batches where inbox_id = 212
and updated_at >= '2026-01-28 00:00:00' order by id desc;
select * from inbox_emails where inbox_id = 212
and batch_id = 95885 order by id desc;
select * from email_messages where origin_user_id = 143;
select * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';
select * from participants where activity_id = 620247;
select * from crm_profiles where user_id = 143;
SELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001
select * from transcription where activity_id = 356001; # 6943
select * from ai_prompts where transcription_id = 6943;
SELECT * FROM activity_summary_logs where activity_id = 356001;
SELECT * FROM social_accounts WHERE sociable_id = 143;
# [PASSWORD_DOTS]
SELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;
# 422515 softphone tr. 8100
SELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;
# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS
select * from ai_prompts where transcription_id IN (8100, 7670);
select * from activity_summary_logs where activity_id = 407509;
select * from sidekick_settings;
select * from default_activity_types;
SELECT * FROM contacts WHERE crm_configuration_id = 39 and email = '[EMAIL]';
SELECT * FROM leads WHERE crm_configuration_id = 39 and email = '[EMAIL]';
SELECT * FROM activity_searches where user_id = 143;
SELECT * FROM groups where team_id = 1;
select * from teams where id = 1;
select * from groups where team_id = 1; # 1150 - 7e75f8025c22
select id, name, group_id, status, deleted_at, email
from users where team_id = 1 order by group_id desc ;
select * from activity_searches where id in (1977, 1978, 1979);
select * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);
select * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277
select * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879
INSERT INTO `activity_search_filters`
(`activity_search_id`, `filter`, `value`) VALUES
(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),
(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),
(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')
;
select * from crm_configurations where id = 39;
select sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id
where u.team_id = 1;
SELECT * FROM social_accounts WHERE sociable_id = 1635;
SELECT * FROM users WHERE id = 1635;
select * from teams where id = 1;
select * from users where team_id = 1;
select * from team_features where team_id = 1;
select * from features;
SELECT * FROM activity_searches where id = 1982; # 1981
SELECT * FROM activity_search_filters WHERE activity_search_id = 1982;
SELECT * FROM automated_reports where id = 68;
UPDATE automated_reports set playbook_categories = NULL where id = 68;
SELECT * FROM automated_report_results where id = 275;
SELECT * FROM automated_reports order by id desc;
SELECT * FROM automated_report_results order by id desc;
select * from activity_searches where user_id = 143;
select * from ask_anything_prompts;
SELECT * FROM groups WHERE id = 1439;
SELECT * FROM users WHERE group_id = 1439;
select * from permissions; # 158
select * from roles;
select * from permission_role
select * from teams where id = 1;
select * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;
select * from groups where id = 28;
select * from playbooks where team_id = 1;
select * from playbooks where id = 179;
select * from playbook_categories where id = 1391;
select * from users where id = 143;
select * from crm_profiles where user_id = 143;
select * from activities where crm_configuration_id = 39 and type = 'conference'
and crm_provider_id IS NOT NULL ORDER by id desc;
select * from activities where id = 422003; # 00UO400000pB6fpMAC
SELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type
FROM automated_report_results ar
JOIN automated_reports a ON a.id = ar.report_id
WHERE a.type = 'ask_jiminny'
LIMIT 10;
SELECT `automated_report_results`.* FROM `automated_report_results`
INNER JOIN `automated_reports`
ON `automated_report_results`.`report_id` = `automated_reports`.`id`
WHERE `automated_report_results`.`generated_at` IS NOT NULL
AND `automated_reports`.`team_id` = 1
AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$."users"')
;
select * from teams where id = 3143;
select * from crm_configurations where id = 500;
select * from users where name = 'Integration Account'; # 1695
SELECT * FROM social_accounts WHERE sociable_id = 1695;
select * from activities where crm_configuration_id = 39
and recording_state = 'recorded' and duration > 60
and status = 'completed' and actual_start_time >= '2025-12-01';
SELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;
select * from leads;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
67050
|
|
67228
|
NULL
|
0
|
2026-04-21T15:29:48.087724+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776785388087_m2.jpg...
|
Firefox
|
Jiminny — Work
|
1
|
app.staging.jiminny.com/ai-reports
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Platform Sprint 2 Q2 - Platform Team - Scrum Board Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira
Project Phoenix – Figma
Project Phoenix – Figma
[JY-20372] AI Reports > Empty page design and promotion - Jira
[JY-20372] AI Reports > Empty page design and promotion - Jira
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Jiminny MCP Connector - Product - Confluence
Jiminny MCP Connector - Product - Confluence
Jiminny Mail
Jiminny Mail
[JY-20500] Batch initial sync for Salesforce - Jira
[JY-20500] Batch initial sync for Salesforce - Jira
Feed — jiminny — Sentry
Feed — jiminny — Sentry
Jiminny
Jiminny
Pipelines - jiminny/app
Pipelines - jiminny/app
Formalize
Formalize
[SRD-6793] Les Mills activity types not pulling in - Jira
[SRD-6793] Les Mills activity types not pulling in - Jira
Search results: calendar | Jiminny Help Center
Search results: calendar | Jiminny Help Center
Jiminny
Jiminny
Jiminny
Jiminny
Close tab
Edit - Engineering - Confluence
Edit - Engineering - Confluence
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
JY-18909-automated-reports-ask-jiminny ■ 874667
28
28
AI Reports
AI Reports
Ask Jiminny reports
Ask Jiminny reports
Report name
Period
Exec Summary × Report Type
Exec Summary
×
Report Type
Clear all
NAME
FREQUENCY
SHARED
DATE
ACTIONS
Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Exec Summary Podcast - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
You are currently impersonating Nikolay Yankov
Settings
Settings
Back To My Account
Back To My Account
Kiosk
Kiosk
Organization
Organization
Profile
Profile
Logout
Logout
Clear
Filter URLs
Pause/Resume recording network log
New Request
Search
Request Blocking
Disable Cache
Disable Cache
No Throttling
Network Settings
All
HTML
CSS
JS
XHR
Fonts
Images
Media
WS
Other
Status
Status
Method
Method
Domain
Domain
File
File
Initiator
Initiator
Type
Type
Transferred
Transferred
Size
Size
0 ms
0 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
17.48 kB
0 B
188 ms
204
OPTIONS
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
plain
752 B
0 B
138 ms
200
POST
o36719.ingest.sentry.io
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
sentry-B6v5fcc5.js
:2
(fetch)
json
500 B
2 B
37 ms
200
POST
o36719.ingest.sentry.io
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
sentry-B6v5fcc5.js
:2
(fetch)
json
500 B
2 B
36 ms
200
GET
app.staging.jiminny.com
search?status[]=completed&sort_by=dateHeld&sort_direction=desc&exclude[]=stats&only_recorded=1&user_id[]=c4fb084a-b33a-46fe-904b-351b592a4b0f
xhr
json
6.28 kB
24.21 kB
719 ms
200
GET
app.staging.jiminny.com
automated-reports
xhr
json
4.03 kB
6.13 kB
688 ms
200
GET
app.staging.jiminny.com
recent
xhr
json
5.65 kB
15.26 kB
504 ms
200
GET
app.staging.jiminny.com
integrations
xhr
json
3.83 kB
5.53 kB
812 ms
200
GET
find.userpilot.io
NX-094be170
xhr
json
cached
62 B
0 ms
200
POST
app.staging.jiminny.com
authenticate
xhr
json
3.11 kB
96 B
424 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
553.04 kB
0 B
485 ms
200
GET
app.staging.jiminny.com
automated-reports?page=1&sort_column=generated_at&sort_direction=desc&report_type[]=exec_summary
xhr
json
3.71 kB
2.77 kB
254 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
41.05 kB
0 B
202 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
3.08 kB
0 B
170 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
3.85 kB
0 B
156 ms
Status
Status
200
204
200
200
200
200
200
200
200
200
Method
Method
POST
OPTIONS
POST
POST
GET
GET
GET
GET
GET
POST
Domain
Domain
r.logr-in.com
r.logr-in.com
o36719.ingest.sentry.io
o36719.ingest.sentry.io
app.staging.jiminny.com
app.staging.jiminny.com
app.staging.jiminny.com
app.staging.jiminny.com
find.userpilot.io
app.staging.jiminny.com
File
File
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
search?status[]=completed&sort_by=dateHeld&sort_direction=desc&exclude[]=stats&only_recorded=1&user_id[]=c4fb084a-b33a-46fe-904b-351b592a4b0f
automated-reports
recent
integrations
NX-094be170
authenticate
Initiator
Initiator
xhr
xhr
sentry-B6v5fcc5.js...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira","depth":4,"bounds":{"left":0.0018284575,"top":0.0518755,"width":0.07596409,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"bounds":{"left":0.0,"top":0.09497207,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"bounds":{"left":0.013297873,"top":0.10614525,"width":0.041888297,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20372] AI Reports > Empty page design and promotion - Jira","depth":4,"bounds":{"left":0.0,"top":0.12769353,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20372] AI Reports > Empty page design and promotion - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.13886672,"width":0.11319814,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"bounds":{"left":0.0,"top":0.16041501,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"bounds":{"left":0.013297873,"top":0.17158818,"width":0.041888297,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"bounds":{"left":0.0,"top":0.19313647,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"bounds":{"left":0.013297873,"top":0.20430966,"width":0.041888297,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"bounds":{"left":0.0,"top":0.22585794,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"bounds":{"left":0.013297873,"top":0.23703113,"width":0.041888297,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny MCP Connector - Product - Confluence","depth":4,"bounds":{"left":0.0,"top":0.2585794,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny MCP Connector - Product - Confluence","depth":5,"bounds":{"left":0.013297873,"top":0.2697526,"width":0.08294548,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny Mail","depth":4,"bounds":{"left":0.0,"top":0.29130086,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny Mail","depth":5,"bounds":{"left":0.013297873,"top":0.30247405,"width":0.02144282,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20500] Batch initial sync for Salesforce - Jira","depth":4,"bounds":{"left":0.0,"top":0.32402235,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20500] Batch initial sync for Salesforce - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.33519554,"width":0.08610372,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Feed — jiminny — Sentry","depth":4,"bounds":{"left":0.0,"top":0.3567438,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Feed — jiminny — Sentry","depth":5,"bounds":{"left":0.013297873,"top":0.367917,"width":0.042719416,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"bounds":{"left":0.0,"top":0.38946527,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"bounds":{"left":0.013297873,"top":0.40063846,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Pipelines - jiminny/app","depth":4,"bounds":{"left":0.0,"top":0.42218676,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pipelines - jiminny/app","depth":5,"bounds":{"left":0.013297873,"top":0.43335995,"width":0.039228722,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Formalize","depth":4,"bounds":{"left":0.0,"top":0.45490822,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Formalize","depth":5,"bounds":{"left":0.013297873,"top":0.4660814,"width":0.016788565,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[SRD-6793] Les Mills activity types not pulling in - Jira","depth":4,"bounds":{"left":0.0,"top":0.48762968,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[SRD-6793] Les Mills activity types not pulling in - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.49880287,"width":0.09524601,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Search results: calendar | Jiminny Help Center","depth":4,"bounds":{"left":0.0,"top":0.5203512,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Search results: calendar | Jiminny Help Center","depth":5,"bounds":{"left":0.013297873,"top":0.53152436,"width":0.080119684,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"bounds":{"left":0.0,"top":0.55307263,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"bounds":{"left":0.013297873,"top":0.5642458,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"bounds":{"left":0.0,"top":0.5857941,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Jiminny","depth":5,"bounds":{"left":0.013297873,"top":0.5969673,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.06732048,"top":0.59297687,"width":0.007978723,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Edit - Engineering - Confluence","depth":4,"bounds":{"left":0.0,"top":0.61851555,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Edit - Engineering - Confluence","depth":5,"bounds":{"left":0.013297873,"top":0.62968874,"width":0.054853722,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.0028257978,"top":0.6528332,"width":0.07413564,"height":0.025538707},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.0028257978,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.013796543,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Tabs from other devices","depth":6,"bounds":{"left":0.024933511,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.036070477,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.04720745,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-18909-automated-reports-ask-jiminny ■ 874667","depth":9,"bounds":{"left":0.08028591,"top":0.9860335,"width":0.10056516,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"28","depth":12,"bounds":{"left":0.08228058,"top":0.91380686,"width":0.015957447,"height":0.035115723},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"28","depth":14,"bounds":{"left":0.09059176,"top":0.9173983,"width":0.004654255,"height":0.011971269},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"AI Reports","depth":13,"bounds":{"left":0.10887633,"top":0.06943336,"width":0.031416222,"height":0.019553073},"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"AI Reports","depth":14,"bounds":{"left":0.10887633,"top":0.06943336,"width":0.031416222,"height":0.019553073},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Ask Jiminny reports","depth":13,"bounds":{"left":0.62682843,"top":0.06464485,"width":0.059341755,"height":0.028731046},"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ask Jiminny reports","depth":14,"bounds":{"left":0.64045876,"top":0.07222666,"width":0.04105718,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXTextField","text":"Report name","depth":17,"bounds":{"left":0.12167553,"top":0.10933759,"width":0.058011968,"height":0.019952115},"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Period","depth":20,"bounds":{"left":0.19963431,"top":0.114924185,"width":0.012799202,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXComboBox","text":"Exec Summary × Report Type","depth":16,"bounds":{"left":0.26944813,"top":0.10933759,"width":0.06615692,"height":0.028731046},"value":"Exec Summary × Report Type","help_text":"","role_description":"combo box","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Exec Summary","depth":20,"bounds":{"left":0.27177528,"top":0.11691939,"width":0.03025266,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"×","depth":21,"bounds":{"left":0.30435506,"top":0.11652035,"width":0.0028257978,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXTextField","text":"Report Type","depth":18,"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Clear all","depth":13,"bounds":{"left":0.34192154,"top":0.112529926,"width":0.028424202,"height":0.015961692},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"NAME","depth":16,"bounds":{"left":0.10854388,"top":0.17398244,"width":0.012965426,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"FREQUENCY","depth":16,"bounds":{"left":0.35854387,"top":0.17398244,"width":0.026263298,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"SHARED","depth":16,"bounds":{"left":0.4418218,"top":0.17398244,"width":0.017453458,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"DATE","depth":16,"bounds":{"left":0.52509975,"top":0.17398244,"width":0.011136968,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"ACTIONS","depth":16,"bounds":{"left":0.6085439,"top":0.17398244,"width":0.019115692,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All","depth":17,"bounds":{"left":0.12184176,"top":0.22067039,"width":0.0987367,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"bounds":{"left":0.35854387,"top":0.22067039,"width":0.016456118,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.22067039,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exec Summary Podcast - 1 Nov 2024 - 17 Dec 2025 - All","depth":17,"bounds":{"left":0.12184176,"top":0.2677574,"width":0.1165226,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"bounds":{"left":0.35854387,"top":0.2677574,"width":0.016456118,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.2677574,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All","depth":17,"bounds":{"left":0.12184176,"top":0.31484437,"width":0.0987367,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"bounds":{"left":0.35854387,"top":0.31484437,"width":0.016456118,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.31484437,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You are currently impersonating Nikolay Yankov","depth":11,"bounds":{"left":0.33194813,"top":0.053072624,"width":0.09940159,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Settings","depth":10,"bounds":{"left":0.10139628,"top":0.7717478,"width":0.065159574,"height":0.028731046},"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Settings","depth":11,"bounds":{"left":0.10472074,"top":0.77853155,"width":0.019115692,"height":0.01556265},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Back To My Account","depth":11,"bounds":{"left":0.10139628,"top":0.8044693,"width":0.065159574,"height":0.035115723},"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Back To My Account","depth":12,"bounds":{"left":0.11968085,"top":0.8152434,"width":0.041888297,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Kiosk","depth":11,"bounds":{"left":0.10139628,"top":0.839585,"width":0.065159574,"height":0.035115723},"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Kiosk","depth":12,"bounds":{"left":0.11968085,"top":0.85035914,"width":0.011635638,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Organization","depth":11,"bounds":{"left":0.10139628,"top":0.8747007,"width":0.065159574,"height":0.035115723},"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Organization","depth":12,"bounds":{"left":0.11968085,"top":0.88547486,"width":0.027094414,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Profile","depth":11,"bounds":{"left":0.10139628,"top":0.90981644,"width":0.065159574,"height":0.035115723},"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Profile","depth":12,"bounds":{"left":0.11968085,"top":0.9205906,"width":0.013962766,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Logout","depth":11,"bounds":{"left":0.10139628,"top":0.94493216,"width":0.065159574,"height":0.035115723},"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Logout","depth":12,"bounds":{"left":0.11968085,"top":0.9557063,"width":0.014295213,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Clear","depth":16,"bounds":{"left":0.69547874,"top":0.07821229,"width":0.008643617,"height":0.015961692},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextField","text":"Filter URLs","depth":16,"bounds":{"left":0.70578456,"top":0.07581804,"width":0.16771941,"height":0.0207502},"help_text":"","role_description":"search text field","subrole":"AXSearchField","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Pause/Resume recording network log","depth":16,"bounds":{"left":0.8871343,"top":0.077813245,"width":0.008643617,"height":0.016759777},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"New Request","depth":16,"bounds":{"left":0.89644283,"top":0.07821229,"width":0.008643617,"height":0.015961692},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Search","depth":16,"bounds":{"left":0.90575135,"top":0.07821229,"width":0.008643617,"height":0.015961692},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Request Blocking","depth":16,"bounds":{"left":0.91505986,"top":0.07821229,"width":0.008643617,"height":0.015961692},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Disable Cache","depth":17,"bounds":{"left":0.92702794,"top":0.080207504,"width":0.004654255,"height":0.011173184},"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Disable Cache","depth":17,"bounds":{"left":0.93267953,"top":0.08100559,"width":0.024933511,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"No Throttling","depth":16,"bounds":{"left":0.96127,"top":0.07940942,"width":0.027094414,"height":0.01396648},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Network Settings","depth":16,"bounds":{"left":0.9900266,"top":0.07821229,"width":0.008643617,"height":0.015961692},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"All","depth":17,"bounds":{"left":0.6978058,"top":0.10175578,"width":0.00831117,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"HTML","depth":17,"bounds":{"left":0.7067819,"top":0.10175578,"width":0.014461436,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"CSS","depth":17,"bounds":{"left":0.7219083,"top":0.10175578,"width":0.011303191,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"JS","depth":17,"bounds":{"left":0.73387635,"top":0.10175578,"width":0.00831117,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"XHR","depth":17,"bounds":{"left":0.7428524,"top":0.10175578,"width":0.011635638,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Fonts","depth":17,"bounds":{"left":0.75515294,"top":0.10175578,"width":0.013630319,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Images","depth":17,"bounds":{"left":0.76944816,"top":0.10175578,"width":0.01662234,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Media","depth":17,"bounds":{"left":0.78673536,"top":0.10175578,"width":0.014461436,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"WS","depth":17,"bounds":{"left":0.8018617,"top":0.10175578,"width":0.009973404,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Other","depth":17,"bounds":{"left":0.8125,"top":0.10175578,"width":0.013796543,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Status","depth":24,"bounds":{"left":0.69414896,"top":0.121308856,"width":0.01861702,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Status","depth":26,"bounds":{"left":0.69581115,"top":0.12609737,"width":0.011136968,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Method","depth":24,"bounds":{"left":0.7130984,"top":0.121308856,"width":0.018284574,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Method","depth":26,"bounds":{"left":0.71476066,"top":0.12609737,"width":0.013297873,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Domain","depth":24,"bounds":{"left":0.73171544,"top":0.121308856,"width":0.04720745,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Domain","depth":26,"bounds":{"left":0.73337764,"top":0.12609737,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"File","depth":24,"bounds":{"left":0.77925533,"top":0.121308856,"width":0.09325133,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"File","depth":26,"bounds":{"left":0.7809175,"top":0.12609737,"width":0.006150266,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Initiator","depth":24,"bounds":{"left":0.8728391,"top":0.121308856,"width":0.03723404,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Initiator","depth":26,"bounds":{"left":0.87450135,"top":0.12609737,"width":0.013297873,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Type","depth":24,"bounds":{"left":0.9104056,"top":0.121308856,"width":0.018284574,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Type","depth":26,"bounds":{"left":0.91206783,"top":0.12609737,"width":0.008477394,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Transferred","depth":24,"bounds":{"left":0.9290226,"top":0.121308856,"width":0.0038231383,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Transferred","depth":26,"bounds":{"left":0.93068486,"top":0.12609737,"width":0.020113032,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Size","depth":24,"bounds":{"left":0.9331782,"top":0.121308856,"width":0.056017287,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Size","depth":26,"bounds":{"left":0.93484044,"top":0.12609737,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"0 ms","depth":24,"bounds":{"left":0.98952794,"top":0.121308856,"width":0.010472059,"height":0.01915403},"help_text":"Timeline","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"0 ms","depth":27,"bounds":{"left":0.9908577,"top":0.12849163,"width":0.0066489363,"height":0.007980846},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.14604948,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"bounds":{"left":0.71476066,"top":0.14565043,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"bounds":{"left":0.73836434,"top":0.14565043,"width":0.022273935,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t","depth":25,"bounds":{"left":0.7809175,"top":0.14565043,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.14565043,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.14565043,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"17.48 kB","depth":24,"bounds":{"left":0.93068486,"top":0.14565043,"width":0.01462766,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"bounds":{"left":0.9822141,"top":0.14565043,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"188 ms","depth":25,"bounds":{"left":0.99119014,"top":0.14644852,"width":0.0088098645,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"204","depth":24,"bounds":{"left":0.69647604,"top":0.16520351,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"OPTIONS","depth":24,"bounds":{"left":0.71476066,"top":0.16480447,"width":0.016456118,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"bounds":{"left":0.73836434,"top":0.16480447,"width":0.022273935,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t","depth":25,"bounds":{"left":0.7809175,"top":0.16480447,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.16480447,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"plain","depth":24,"bounds":{"left":0.91206783,"top":0.16480447,"width":0.00831117,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"752 B","depth":24,"bounds":{"left":0.93068486,"top":0.16480447,"width":0.009973404,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"bounds":{"left":0.9822141,"top":0.16480447,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"138 ms","depth":25,"bounds":{"left":0.99119014,"top":0.16560255,"width":0.0088098645,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.18435754,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"bounds":{"left":0.71476066,"top":0.1839585,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"o36719.ingest.sentry.io","depth":24,"bounds":{"left":0.7436835,"top":0.1839585,"width":0.040724736,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0","depth":25,"bounds":{"left":0.7809175,"top":0.1839585,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"sentry-B6v5fcc5.js","depth":24,"bounds":{"left":0.87450135,"top":0.1839585,"width":0.033410903,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":2","depth":24,"bounds":{"left":0.90791225,"top":0.1839585,"width":0.0033244682,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(fetch)","depth":24,"bounds":{"left":0.9112367,"top":0.1839585,"width":0.012799202,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.1839585,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"500 B","depth":24,"bounds":{"left":0.93068486,"top":0.1839585,"width":0.010305851,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2 B","depth":24,"bounds":{"left":0.9822141,"top":0.1839585,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"37 ms","depth":25,"bounds":{"left":0.9915226,"top":0.18475658,"width":0.00847739,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.20351157,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"bounds":{"left":0.71476066,"top":0.20311253,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"o36719.ingest.sentry.io","depth":24,"bounds":{"left":0.7436835,"top":0.20311253,"width":0.040724736,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0","depth":25,"bounds":{"left":0.7809175,"top":0.20311253,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"sentry-B6v5fcc5.js","depth":24,"bounds":{"left":0.87450135,"top":0.20311253,"width":0.033410903,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":2","depth":24,"bounds":{"left":0.90791225,"top":0.20311253,"width":0.0033244682,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(fetch)","depth":24,"bounds":{"left":0.9112367,"top":0.20311253,"width":0.012799202,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.20311253,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"500 B","depth":24,"bounds":{"left":0.93068486,"top":0.20311253,"width":0.010305851,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2 B","depth":24,"bounds":{"left":0.9822141,"top":0.20311253,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"36 ms","depth":25,"bounds":{"left":0.9915226,"top":0.20391062,"width":0.00847739,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.22266561,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"bounds":{"left":0.71476066,"top":0.22226655,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"bounds":{"left":0.73836434,"top":0.22226655,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"search?status[]=completed&sort_by=dateHeld&sort_direction=desc&exclude[]=stats&only_recorded=1&user_id[]=c4fb084a-b33a-46fe-904b-351b592a4b0f","depth":25,"bounds":{"left":0.7809175,"top":0.22226655,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.22226655,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.22226655,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"6.28 kB","depth":24,"bounds":{"left":0.93068486,"top":0.22226655,"width":0.013297873,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"24.21 kB","depth":24,"bounds":{"left":0.9730718,"top":0.22226655,"width":0.014793883,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"719 ms","depth":25,"bounds":{"left":0.9915226,"top":0.22306465,"width":0.00847739,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.24181964,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"bounds":{"left":0.71476066,"top":0.2414206,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"bounds":{"left":0.73836434,"top":0.2414206,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"automated-reports","depth":25,"bounds":{"left":0.7809175,"top":0.2414206,"width":0.03307846,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.2414206,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.2414206,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4.03 kB","depth":24,"bounds":{"left":0.93068486,"top":0.2414206,"width":0.013297873,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"6.13 kB","depth":24,"bounds":{"left":0.9752327,"top":0.2414206,"width":0.012632979,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"688 ms","depth":25,"bounds":{"left":0.9915226,"top":0.24221867,"width":0.00847739,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.26097366,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"bounds":{"left":0.71476066,"top":0.2605746,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"bounds":{"left":0.73836434,"top":0.2605746,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"recent","depth":25,"bounds":{"left":0.7809175,"top":0.2605746,"width":0.011136968,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.2605746,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.2605746,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"5.65 kB","depth":24,"bounds":{"left":0.93068486,"top":0.2605746,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15.26 kB","depth":24,"bounds":{"left":0.9730718,"top":0.2605746,"width":0.014793883,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"504 ms","depth":25,"bounds":{"left":0.9915226,"top":0.26137272,"width":0.00847739,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.2801277,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"bounds":{"left":0.71476066,"top":0.27972865,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"bounds":{"left":0.73836434,"top":0.27972865,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"integrations","depth":25,"bounds":{"left":0.7809175,"top":0.27972865,"width":0.020777926,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.27972865,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.27972865,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3.83 kB","depth":24,"bounds":{"left":0.93068486,"top":0.27972865,"width":0.013297873,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"5.53 kB","depth":24,"bounds":{"left":0.97473407,"top":0.27972865,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"812 ms","depth":25,"bounds":{"left":0.9915226,"top":0.28052673,"width":0.00847739,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":25,"bounds":{"left":0.69647604,"top":0.29928172,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"bounds":{"left":0.71476066,"top":0.2988827,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"find.userpilot.io","depth":24,"bounds":{"left":0.73836434,"top":0.2988827,"width":0.027260639,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"NX-094be170","depth":25,"bounds":{"left":0.7809175,"top":0.2988827,"width":0.024268618,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.2988827,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.2988827,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"cached","depth":24,"bounds":{"left":0.93068486,"top":0.2988827,"width":0.012632979,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"62 B","depth":24,"bounds":{"left":0.97988695,"top":0.2988827,"width":0.007978723,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 ms","depth":25,"bounds":{"left":0.9915226,"top":0.29968077,"width":0.00731383,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.31843576,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"bounds":{"left":0.71476066,"top":0.3180367,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"bounds":{"left":0.73836434,"top":0.3180367,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"authenticate","depth":25,"bounds":{"left":0.7809175,"top":0.3180367,"width":0.021775266,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.3180367,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.3180367,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3.11 kB","depth":24,"bounds":{"left":0.93068486,"top":0.3180367,"width":0.011968086,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"96 B","depth":24,"bounds":{"left":0.9797208,"top":0.3180367,"width":0.008144947,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"424 ms","depth":25,"bounds":{"left":0.99168885,"top":0.31883478,"width":0.008311152,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.33758977,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"bounds":{"left":0.71476066,"top":0.33719075,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"bounds":{"left":0.73836434,"top":0.33719075,"width":0.022273935,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t","depth":25,"bounds":{"left":0.7809175,"top":0.33719075,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.33719075,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.33719075,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"553.04 kB","depth":24,"bounds":{"left":0.93068486,"top":0.33719075,"width":0.017785905,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"bounds":{"left":0.9822141,"top":0.33719075,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"485 ms","depth":25,"bounds":{"left":0.9930186,"top":0.33798882,"width":0.006981373,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.3567438,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"bounds":{"left":0.71476066,"top":0.35634476,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"bounds":{"left":0.73836434,"top":0.35634476,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"automated-reports?page=1&sort_column=generated_at&sort_direction=desc&report_type[]=exec_summary","depth":25,"bounds":{"left":0.7809175,"top":0.35634476,"width":0.1896609,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.35634476,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.35634476,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3.71 kB","depth":24,"bounds":{"left":0.93068486,"top":0.35634476,"width":0.012466756,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2.77 kB","depth":24,"bounds":{"left":0.9750665,"top":0.35634476,"width":0.012799202,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"254 ms","depth":25,"bounds":{"left":0.9928524,"top":0.35714287,"width":0.00714761,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.37589785,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"bounds":{"left":0.71476066,"top":0.3754988,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"bounds":{"left":0.73836434,"top":0.3754988,"width":0.022273935,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t","depth":25,"bounds":{"left":0.7809175,"top":0.3754988,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.3754988,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.3754988,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"41.05 kB","depth":24,"bounds":{"left":0.93068486,"top":0.3754988,"width":0.014960106,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"bounds":{"left":0.9822141,"top":0.3754988,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"202 ms","depth":25,"bounds":{"left":0.99401593,"top":0.37629688,"width":0.005984068,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.39505187,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"bounds":{"left":0.71476066,"top":0.39465284,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"bounds":{"left":0.73836434,"top":0.39465284,"width":0.022273935,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t","depth":25,"bounds":{"left":0.7809175,"top":0.39465284,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.39465284,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.39465284,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3.08 kB","depth":24,"bounds":{"left":0.93068486,"top":0.39465284,"width":0.013297873,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"bounds":{"left":0.9822141,"top":0.39465284,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"170 ms","depth":25,"bounds":{"left":0.9953458,"top":0.39545092,"width":0.0046542287,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.4142059,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"bounds":{"left":0.71476066,"top":0.41380686,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"bounds":{"left":0.73836434,"top":0.41380686,"width":0.022273935,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t","depth":25,"bounds":{"left":0.7809175,"top":0.41380686,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.41380686,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.41380686,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3.85 kB","depth":24,"bounds":{"left":0.93068486,"top":0.41380686,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"bounds":{"left":0.9822141,"top":0.41380686,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"156 ms","depth":25,"bounds":{"left":0.9963431,"top":0.41460496,"width":0.0036569238,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Status","depth":23,"bounds":{"left":0.69414896,"top":0.121308856,"width":0.01861702,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Status","depth":25,"bounds":{"left":0.69581115,"top":0.12609737,"width":0.011136968,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":23,"bounds":{"left":0.69647604,"top":0.14604948,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"204","depth":23,"bounds":{"left":0.69647604,"top":0.16520351,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":23,"bounds":{"left":0.69647604,"top":0.18435754,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":23,"bounds":{"left":0.69647604,"top":0.20351157,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":23,"bounds":{"left":0.69647604,"top":0.22266561,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":23,"bounds":{"left":0.69647604,"top":0.24181964,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":23,"bounds":{"left":0.69647604,"top":0.26097366,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":23,"bounds":{"left":0.69647604,"top":0.2801277,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.29928172,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":23,"bounds":{"left":0.69647604,"top":0.31843576,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Method","depth":23,"bounds":{"left":0.7130984,"top":0.121308856,"width":0.018284574,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Method","depth":25,"bounds":{"left":0.71476066,"top":0.12609737,"width":0.013297873,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"bounds":{"left":0.71476066,"top":0.14565043,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"OPTIONS","depth":23,"bounds":{"left":0.71476066,"top":0.16480447,"width":0.016456118,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"bounds":{"left":0.71476066,"top":0.1839585,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"bounds":{"left":0.71476066,"top":0.20311253,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":23,"bounds":{"left":0.71476066,"top":0.22226655,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":23,"bounds":{"left":0.71476066,"top":0.2414206,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":23,"bounds":{"left":0.71476066,"top":0.2605746,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":23,"bounds":{"left":0.71476066,"top":0.27972865,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":23,"bounds":{"left":0.71476066,"top":0.2988827,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"bounds":{"left":0.71476066,"top":0.3180367,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Domain","depth":23,"bounds":{"left":0.73171544,"top":0.121308856,"width":0.04720745,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Domain","depth":25,"bounds":{"left":0.73337764,"top":0.12609737,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":23,"bounds":{"left":0.73836434,"top":0.14565043,"width":0.022273935,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":23,"bounds":{"left":0.73836434,"top":0.16480447,"width":0.022273935,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"o36719.ingest.sentry.io","depth":23,"bounds":{"left":0.7436835,"top":0.1839585,"width":0.040724736,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"o36719.ingest.sentry.io","depth":23,"bounds":{"left":0.7436835,"top":0.20311253,"width":0.040724736,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":23,"bounds":{"left":0.73836434,"top":0.22226655,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":23,"bounds":{"left":0.73836434,"top":0.2414206,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":23,"bounds":{"left":0.73836434,"top":0.2605746,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":23,"bounds":{"left":0.73836434,"top":0.27972865,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"find.userpilot.io","depth":23,"bounds":{"left":0.73836434,"top":0.2988827,"width":0.027260639,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":23,"bounds":{"left":0.73836434,"top":0.3180367,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"File","depth":23,"bounds":{"left":0.77925533,"top":0.121308856,"width":0.09325133,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"File","depth":25,"bounds":{"left":0.7809175,"top":0.12609737,"width":0.006150266,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t","depth":24,"bounds":{"left":0.7809175,"top":0.14565043,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t","depth":24,"bounds":{"left":0.7809175,"top":0.16480447,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0","depth":24,"bounds":{"left":0.7809175,"top":0.1839585,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0","depth":24,"bounds":{"left":0.7809175,"top":0.20311253,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"search?status[]=completed&sort_by=dateHeld&sort_direction=desc&exclude[]=stats&only_recorded=1&user_id[]=c4fb084a-b33a-46fe-904b-351b592a4b0f","depth":24,"bounds":{"left":0.7809175,"top":0.22226655,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"automated-reports","depth":24,"bounds":{"left":0.7809175,"top":0.2414206,"width":0.03307846,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"recent","depth":24,"bounds":{"left":0.7809175,"top":0.2605746,"width":0.011136968,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"integrations","depth":24,"bounds":{"left":0.7809175,"top":0.27972865,"width":0.020777926,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"NX-094be170","depth":24,"bounds":{"left":0.7809175,"top":0.2988827,"width":0.024268618,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"authenticate","depth":24,"bounds":{"left":0.7809175,"top":0.3180367,"width":0.021775266,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Initiator","depth":23,"bounds":{"left":0.8728391,"top":0.121308856,"width":0.03723404,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Initiator","depth":25,"bounds":{"left":0.87450135,"top":0.12609737,"width":0.013297873,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":23,"bounds":{"left":0.87450135,"top":0.14565043,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":23,"bounds":{"left":0.87450135,"top":0.16480447,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"sentry-B6v5fcc5.js","depth":23,"bounds":{"left":0.87450135,"top":0.1839585,"width":0.033410903,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
1898905122180032324
|
-5291552779059664571
|
click
|
accessibility
|
NULL
|
Platform Sprint 2 Q2 - Platform Team - Scrum Board Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira
Project Phoenix – Figma
Project Phoenix – Figma
[JY-20372] AI Reports > Empty page design and promotion - Jira
[JY-20372] AI Reports > Empty page design and promotion - Jira
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Jiminny MCP Connector - Product - Confluence
Jiminny MCP Connector - Product - Confluence
Jiminny Mail
Jiminny Mail
[JY-20500] Batch initial sync for Salesforce - Jira
[JY-20500] Batch initial sync for Salesforce - Jira
Feed — jiminny — Sentry
Feed — jiminny — Sentry
Jiminny
Jiminny
Pipelines - jiminny/app
Pipelines - jiminny/app
Formalize
Formalize
[SRD-6793] Les Mills activity types not pulling in - Jira
[SRD-6793] Les Mills activity types not pulling in - Jira
Search results: calendar | Jiminny Help Center
Search results: calendar | Jiminny Help Center
Jiminny
Jiminny
Jiminny
Jiminny
Close tab
Edit - Engineering - Confluence
Edit - Engineering - Confluence
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
JY-18909-automated-reports-ask-jiminny ■ 874667
28
28
AI Reports
AI Reports
Ask Jiminny reports
Ask Jiminny reports
Report name
Period
Exec Summary × Report Type
Exec Summary
×
Report Type
Clear all
NAME
FREQUENCY
SHARED
DATE
ACTIONS
Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Exec Summary Podcast - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
You are currently impersonating Nikolay Yankov
Settings
Settings
Back To My Account
Back To My Account
Kiosk
Kiosk
Organization
Organization
Profile
Profile
Logout
Logout
Clear
Filter URLs
Pause/Resume recording network log
New Request
Search
Request Blocking
Disable Cache
Disable Cache
No Throttling
Network Settings
All
HTML
CSS
JS
XHR
Fonts
Images
Media
WS
Other
Status
Status
Method
Method
Domain
Domain
File
File
Initiator
Initiator
Type
Type
Transferred
Transferred
Size
Size
0 ms
0 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
17.48 kB
0 B
188 ms
204
OPTIONS
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
plain
752 B
0 B
138 ms
200
POST
o36719.ingest.sentry.io
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
sentry-B6v5fcc5.js
:2
(fetch)
json
500 B
2 B
37 ms
200
POST
o36719.ingest.sentry.io
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
sentry-B6v5fcc5.js
:2
(fetch)
json
500 B
2 B
36 ms
200
GET
app.staging.jiminny.com
search?status[]=completed&sort_by=dateHeld&sort_direction=desc&exclude[]=stats&only_recorded=1&user_id[]=c4fb084a-b33a-46fe-904b-351b592a4b0f
xhr
json
6.28 kB
24.21 kB
719 ms
200
GET
app.staging.jiminny.com
automated-reports
xhr
json
4.03 kB
6.13 kB
688 ms
200
GET
app.staging.jiminny.com
recent
xhr
json
5.65 kB
15.26 kB
504 ms
200
GET
app.staging.jiminny.com
integrations
xhr
json
3.83 kB
5.53 kB
812 ms
200
GET
find.userpilot.io
NX-094be170
xhr
json
cached
62 B
0 ms
200
POST
app.staging.jiminny.com
authenticate
xhr
json
3.11 kB
96 B
424 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
553.04 kB
0 B
485 ms
200
GET
app.staging.jiminny.com
automated-reports?page=1&sort_column=generated_at&sort_direction=desc&report_type[]=exec_summary
xhr
json
3.71 kB
2.77 kB
254 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
41.05 kB
0 B
202 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
3.08 kB
0 B
170 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
3.85 kB
0 B
156 ms
Status
Status
200
204
200
200
200
200
200
200
200
200
Method
Method
POST
OPTIONS
POST
POST
GET
GET
GET
GET
GET
POST
Domain
Domain
r.logr-in.com
r.logr-in.com
o36719.ingest.sentry.io
o36719.ingest.sentry.io
app.staging.jiminny.com
app.staging.jiminny.com
app.staging.jiminny.com
app.staging.jiminny.com
find.userpilot.io
app.staging.jiminny.com
File
File
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
search?status[]=completed&sort_by=dateHeld&sort_direction=desc&exclude[]=stats&only_recorded=1&user_id[]=c4fb084a-b33a-46fe-904b-351b592a4b0f
automated-reports
recent
integrations
NX-094be170
authenticate
Initiator
Initiator
xhr
xhr
sentry-B6v5fcc5.js...
|
67227
|
|
67230
|
1513
|
0
|
2026-04-21T15:29:49.262194+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776785389262_m2.jpg...
|
Firefox
|
Jiminny — Work
|
1
|
app.staging.jiminny.com/ai-reports
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Platform Sprint 2 Q2 - Platform Team - Scrum Board Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira
Project Phoenix – Figma
Project Phoenix – Figma
[JY-20372] AI Reports > Empty page design and promotion - Jira
[JY-20372] AI Reports > Empty page design and promotion - Jira
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Jiminny MCP Connector - Product - Confluence
Jiminny MCP Connector - Product - Confluence
Jiminny Mail
Jiminny Mail
[JY-20500] Batch initial sync for Salesforce - Jira
[JY-20500] Batch initial sync for Salesforce - Jira
Feed — jiminny — Sentry
Feed — jiminny — Sentry
Jiminny
Jiminny
Pipelines - jiminny/app
Pipelines - jiminny/app
Formalize
Formalize
[SRD-6793] Les Mills activity types not pulling in - Jira
[SRD-6793] Les Mills activity types not pulling in - Jira
Search results: calendar | Jiminny Help Center
Search results: calendar | Jiminny Help Center
Jiminny
Jiminny
Jiminny
Jiminny
Close tab
Edit - Engineering - Confluence
Edit - Engineering - Confluence
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
JY-18909-automated-reports-ask-jiminny ■ 874667
28
28
AI Reports
AI Reports
Ask Jiminny reports
Ask Jiminny reports
Report name
Period
Exec Summary × Report Type
Exec Summary
×
Report Type
Clear all
NAME
FREQUENCY
SHARED
DATE
ACTIONS
Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Exec Summary Podcast - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
You are currently impersonating Nikolay Yankov
Settings
Settings
Back To My Account
Back To My Account
Kiosk
Kiosk
Organization
Organization
Profile
Profile
Logout
Logout
app.staging.jiminny.com/kiosk
Clear
Filter URLs
Pause/Resume recording network log
New Request
Search
Request Blocking
Disable Cache
Disable Cache
No Throttling
Network Settings
All
HTML
CSS
JS
XHR
Fonts
Images
Media
WS
Other
Status
Status
Method
Method
Domain
Domain
File
File
Initiator
Initiator
Type
Type
Transferred
Transferred
Size
Size
0 ms
0 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
17.48 kB
0 B
188 ms
204
OPTIONS
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
plain
752 B
0 B
138 ms
200
POST
o36719.ingest.sentry.io
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
sentry-B6v5fcc5.js
:2
(fetch)
json
500 B
2 B
37 ms
200
POST
o36719.ingest.sentry.io
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
sentry-B6v5fcc5.js
:2
(fetch)
json
500 B
2 B
36 ms
200
GET
app.staging.jiminny.com
search?status[]=completed&sort_by=dateHeld&sort_direction=desc&exclude[]=stats&only_recorded=1&user_id[]=c4fb084a-b33a-46fe-904b-351b592a4b0f
xhr
json
6.28 kB
24.21 kB
719 ms
200
GET
app.staging.jiminny.com
automated-reports
xhr
json
4.03 kB
6.13 kB
688 ms
200
GET
app.staging.jiminny.com
recent
xhr
json
5.65 kB
15.26 kB
504 ms
200
GET
app.staging.jiminny.com
integrations
xhr
json
3.83 kB
5.53 kB
812 ms
200
GET
find.userpilot.io
NX-094be170
xhr
json
cached
62 B
0 ms
200
POST
app.staging.jiminny.com
authenticate
xhr
json
3.11 kB
96 B
424 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
553.04 kB
0 B
485 ms
200
GET
app.staging.jiminny.com
automated-reports?page=1&sort_column=generated_at&sort_direction=desc&report_type[]=exec_summary
xhr
json
3.71 kB
2.77 kB
254 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
41.05 kB
0 B
202 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
3.08 kB
0 B
170 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
3.85 kB
0 B
156 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
20.92 kB
0 B
183 ms
Status
Status
200
204
200
200
200
200
200
200
200
200
Method
Method
POST
OPTIONS
POST
POST
GET
GET
GET
GET
GET
POST
Domain
Domain
r.logr-in.com
r.logr-in.com
o36719.ingest.sentry.io
o36719.ingest.sentry.io
app.staging.jiminny.com
app.staging.jiminny.com
app.staging.jiminny.com
app.staging.jiminny.com
find.userpilot.io
app.staging.jiminny.com
File
File
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira","depth":4,"bounds":{"left":0.0018284575,"top":0.0518755,"width":0.07596409,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"bounds":{"left":0.0,"top":0.09497207,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"bounds":{"left":0.013297873,"top":0.10614525,"width":0.041888297,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20372] AI Reports > Empty page design and promotion - Jira","depth":4,"bounds":{"left":0.0,"top":0.12769353,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20372] AI Reports > Empty page design and promotion - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.13886672,"width":0.11319814,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"bounds":{"left":0.0,"top":0.16041501,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"bounds":{"left":0.013297873,"top":0.17158818,"width":0.041888297,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"bounds":{"left":0.0,"top":0.19313647,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"bounds":{"left":0.013297873,"top":0.20430966,"width":0.041888297,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"bounds":{"left":0.0,"top":0.22585794,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"bounds":{"left":0.013297873,"top":0.23703113,"width":0.041888297,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny MCP Connector - Product - Confluence","depth":4,"bounds":{"left":0.0,"top":0.2585794,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny MCP Connector - Product - Confluence","depth":5,"bounds":{"left":0.013297873,"top":0.2697526,"width":0.08294548,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny Mail","depth":4,"bounds":{"left":0.0,"top":0.29130086,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny Mail","depth":5,"bounds":{"left":0.013297873,"top":0.30247405,"width":0.02144282,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20500] Batch initial sync for Salesforce - Jira","depth":4,"bounds":{"left":0.0,"top":0.32402235,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20500] Batch initial sync for Salesforce - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.33519554,"width":0.08610372,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Feed — jiminny — Sentry","depth":4,"bounds":{"left":0.0,"top":0.3567438,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Feed — jiminny — Sentry","depth":5,"bounds":{"left":0.013297873,"top":0.367917,"width":0.042719416,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"bounds":{"left":0.0,"top":0.38946527,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"bounds":{"left":0.013297873,"top":0.40063846,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Pipelines - jiminny/app","depth":4,"bounds":{"left":0.0,"top":0.42218676,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pipelines - jiminny/app","depth":5,"bounds":{"left":0.013297873,"top":0.43335995,"width":0.039228722,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Formalize","depth":4,"bounds":{"left":0.0,"top":0.45490822,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Formalize","depth":5,"bounds":{"left":0.013297873,"top":0.4660814,"width":0.016788565,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[SRD-6793] Les Mills activity types not pulling in - Jira","depth":4,"bounds":{"left":0.0,"top":0.48762968,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[SRD-6793] Les Mills activity types not pulling in - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.49880287,"width":0.09524601,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Search results: calendar | Jiminny Help Center","depth":4,"bounds":{"left":0.0,"top":0.5203512,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Search results: calendar | Jiminny Help Center","depth":5,"bounds":{"left":0.013297873,"top":0.53152436,"width":0.080119684,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"bounds":{"left":0.0,"top":0.55307263,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"bounds":{"left":0.013297873,"top":0.5642458,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"bounds":{"left":0.0,"top":0.5857941,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Jiminny","depth":5,"bounds":{"left":0.013297873,"top":0.5969673,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.06732048,"top":0.59297687,"width":0.007978723,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Edit - Engineering - Confluence","depth":4,"bounds":{"left":0.0,"top":0.61851555,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Edit - Engineering - Confluence","depth":5,"bounds":{"left":0.013297873,"top":0.62968874,"width":0.054853722,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.0028257978,"top":0.6528332,"width":0.07413564,"height":0.025538707},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.0028257978,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.013796543,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Tabs from other devices","depth":6,"bounds":{"left":0.024933511,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.036070477,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.04720745,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-18909-automated-reports-ask-jiminny ■ 874667","depth":9,"bounds":{"left":0.08028591,"top":0.9860335,"width":0.10056516,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"28","depth":12,"bounds":{"left":0.08228058,"top":0.91380686,"width":0.015957447,"height":0.035115723},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"28","depth":14,"bounds":{"left":0.09059176,"top":0.9173983,"width":0.004654255,"height":0.011971269},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"AI Reports","depth":13,"bounds":{"left":0.10887633,"top":0.06943336,"width":0.031416222,"height":0.019553073},"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"AI Reports","depth":14,"bounds":{"left":0.10887633,"top":0.06943336,"width":0.031416222,"height":0.019553073},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Ask Jiminny reports","depth":13,"bounds":{"left":0.62682843,"top":0.06464485,"width":0.059341755,"height":0.028731046},"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ask Jiminny reports","depth":14,"bounds":{"left":0.64045876,"top":0.07222666,"width":0.04105718,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXTextField","text":"Report name","depth":17,"bounds":{"left":0.12167553,"top":0.10933759,"width":0.058011968,"height":0.019952115},"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Period","depth":20,"bounds":{"left":0.19963431,"top":0.114924185,"width":0.012799202,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXComboBox","text":"Exec Summary × Report Type","depth":16,"bounds":{"left":0.26944813,"top":0.10933759,"width":0.06615692,"height":0.028731046},"value":"Exec Summary × Report Type","help_text":"","role_description":"combo box","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Exec Summary","depth":20,"bounds":{"left":0.27177528,"top":0.11691939,"width":0.03025266,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"×","depth":21,"bounds":{"left":0.30435506,"top":0.11652035,"width":0.0028257978,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXTextField","text":"Report Type","depth":18,"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Clear all","depth":13,"bounds":{"left":0.34192154,"top":0.112529926,"width":0.028424202,"height":0.015961692},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"NAME","depth":16,"bounds":{"left":0.10854388,"top":0.17398244,"width":0.012965426,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"FREQUENCY","depth":16,"bounds":{"left":0.35854387,"top":0.17398244,"width":0.026263298,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"SHARED","depth":16,"bounds":{"left":0.4418218,"top":0.17398244,"width":0.017453458,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"DATE","depth":16,"bounds":{"left":0.52509975,"top":0.17398244,"width":0.011136968,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"ACTIONS","depth":16,"bounds":{"left":0.6085439,"top":0.17398244,"width":0.019115692,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All","depth":17,"bounds":{"left":0.12184176,"top":0.22067039,"width":0.0987367,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"bounds":{"left":0.35854387,"top":0.22067039,"width":0.016456118,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.22067039,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exec Summary Podcast - 1 Nov 2024 - 17 Dec 2025 - All","depth":17,"bounds":{"left":0.12184176,"top":0.2677574,"width":0.1165226,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"bounds":{"left":0.35854387,"top":0.2677574,"width":0.016456118,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.2677574,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All","depth":17,"bounds":{"left":0.12184176,"top":0.31484437,"width":0.0987367,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"bounds":{"left":0.35854387,"top":0.31484437,"width":0.016456118,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.31484437,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You are currently impersonating Nikolay Yankov","depth":11,"bounds":{"left":0.33194813,"top":0.053072624,"width":0.09940159,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Settings","depth":10,"bounds":{"left":0.1015625,"top":0.7717478,"width":0.0653258,"height":0.028731046},"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Settings","depth":11,"bounds":{"left":0.10488697,"top":0.77853155,"width":0.019115692,"height":0.01556265},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Back To My Account","depth":11,"bounds":{"left":0.1015625,"top":0.8044693,"width":0.0653258,"height":0.035115723},"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Back To My Account","depth":12,"bounds":{"left":0.119847074,"top":0.8152434,"width":0.042054523,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Kiosk","depth":11,"bounds":{"left":0.1015625,"top":0.839585,"width":0.0653258,"height":0.035115723},"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":true,"is_selected":false},{"role":"AXStaticText","text":"Kiosk","depth":12,"bounds":{"left":0.119847074,"top":0.85035914,"width":0.011635638,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Organization","depth":11,"bounds":{"left":0.1015625,"top":0.8747007,"width":0.0653258,"height":0.035115723},"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Organization","depth":12,"bounds":{"left":0.119847074,"top":0.88547486,"width":0.027260639,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Profile","depth":11,"bounds":{"left":0.1015625,"top":0.90981644,"width":0.0653258,"height":0.035115723},"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Profile","depth":12,"bounds":{"left":0.119847074,"top":0.9205906,"width":0.013962766,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Logout","depth":11,"bounds":{"left":0.1015625,"top":0.94493216,"width":0.0653258,"height":0.035115723},"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Logout","depth":12,"bounds":{"left":0.119847074,"top":0.9557063,"width":0.014461436,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com/kiosk","depth":5,"bounds":{"left":0.0809508,"top":0.9876297,"width":0.05219415,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Clear","depth":16,"bounds":{"left":0.69547874,"top":0.07821229,"width":0.008643617,"height":0.015961692},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextField","text":"Filter URLs","depth":16,"bounds":{"left":0.70578456,"top":0.07581804,"width":0.16771941,"height":0.0207502},"help_text":"","role_description":"search text field","subrole":"AXSearchField","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Pause/Resume recording network log","depth":16,"bounds":{"left":0.8871343,"top":0.077813245,"width":0.008643617,"height":0.016759777},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"New Request","depth":16,"bounds":{"left":0.89644283,"top":0.07821229,"width":0.008643617,"height":0.015961692},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Search","depth":16,"bounds":{"left":0.90575135,"top":0.07821229,"width":0.008643617,"height":0.015961692},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Request Blocking","depth":16,"bounds":{"left":0.91505986,"top":0.07821229,"width":0.008643617,"height":0.015961692},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Disable Cache","depth":17,"bounds":{"left":0.92702794,"top":0.080207504,"width":0.004654255,"height":0.011173184},"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Disable Cache","depth":17,"bounds":{"left":0.93267953,"top":0.08100559,"width":0.024933511,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"No Throttling","depth":16,"bounds":{"left":0.96127,"top":0.07940942,"width":0.027094414,"height":0.01396648},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Network Settings","depth":16,"bounds":{"left":0.9900266,"top":0.07821229,"width":0.008643617,"height":0.015961692},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"All","depth":17,"bounds":{"left":0.6978058,"top":0.10175578,"width":0.00831117,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"HTML","depth":17,"bounds":{"left":0.7067819,"top":0.10175578,"width":0.014461436,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"CSS","depth":17,"bounds":{"left":0.7219083,"top":0.10175578,"width":0.011303191,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"JS","depth":17,"bounds":{"left":0.73387635,"top":0.10175578,"width":0.00831117,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"XHR","depth":17,"bounds":{"left":0.7428524,"top":0.10175578,"width":0.011635638,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Fonts","depth":17,"bounds":{"left":0.75515294,"top":0.10175578,"width":0.013630319,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Images","depth":17,"bounds":{"left":0.76944816,"top":0.10175578,"width":0.01662234,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Media","depth":17,"bounds":{"left":0.78673536,"top":0.10175578,"width":0.014461436,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"WS","depth":17,"bounds":{"left":0.8018617,"top":0.10175578,"width":0.009973404,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Other","depth":17,"bounds":{"left":0.8125,"top":0.10175578,"width":0.013796543,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Status","depth":24,"bounds":{"left":0.69414896,"top":0.121308856,"width":0.01861702,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Status","depth":26,"bounds":{"left":0.69581115,"top":0.12609737,"width":0.011136968,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Method","depth":24,"bounds":{"left":0.7130984,"top":0.121308856,"width":0.018284574,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Method","depth":26,"bounds":{"left":0.71476066,"top":0.12609737,"width":0.013297873,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Domain","depth":24,"bounds":{"left":0.73171544,"top":0.121308856,"width":0.04720745,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Domain","depth":26,"bounds":{"left":0.73337764,"top":0.12609737,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"File","depth":24,"bounds":{"left":0.77925533,"top":0.121308856,"width":0.09325133,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"File","depth":26,"bounds":{"left":0.7809175,"top":0.12609737,"width":0.006150266,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Initiator","depth":24,"bounds":{"left":0.8728391,"top":0.121308856,"width":0.03723404,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Initiator","depth":26,"bounds":{"left":0.87450135,"top":0.12609737,"width":0.013297873,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Type","depth":24,"bounds":{"left":0.9104056,"top":0.121308856,"width":0.018284574,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Type","depth":26,"bounds":{"left":0.91206783,"top":0.12609737,"width":0.008477394,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Transferred","depth":24,"bounds":{"left":0.9290226,"top":0.121308856,"width":0.0038231383,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Transferred","depth":26,"bounds":{"left":0.93068486,"top":0.12609737,"width":0.020113032,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Size","depth":24,"bounds":{"left":0.9331782,"top":0.121308856,"width":0.056017287,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Size","depth":26,"bounds":{"left":0.93484044,"top":0.12609737,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"0 ms","depth":24,"bounds":{"left":0.98952794,"top":0.121308856,"width":0.010472059,"height":0.01915403},"help_text":"Timeline","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"0 ms","depth":27,"bounds":{"left":0.9908577,"top":0.12849163,"width":0.0066489363,"height":0.007980846},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.14604948,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"bounds":{"left":0.71476066,"top":0.14565043,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"bounds":{"left":0.73836434,"top":0.14565043,"width":0.022273935,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t","depth":25,"bounds":{"left":0.7809175,"top":0.14565043,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.14565043,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.14565043,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"17.48 kB","depth":24,"bounds":{"left":0.93068486,"top":0.14565043,"width":0.01462766,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"bounds":{"left":0.9822141,"top":0.14565043,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"188 ms","depth":25,"bounds":{"left":0.99119014,"top":0.14644852,"width":0.0088098645,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"204","depth":24,"bounds":{"left":0.69647604,"top":0.16520351,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"OPTIONS","depth":24,"bounds":{"left":0.71476066,"top":0.16480447,"width":0.016456118,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"bounds":{"left":0.73836434,"top":0.16480447,"width":0.022273935,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t","depth":25,"bounds":{"left":0.7809175,"top":0.16480447,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.16480447,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"plain","depth":24,"bounds":{"left":0.91206783,"top":0.16480447,"width":0.00831117,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"752 B","depth":24,"bounds":{"left":0.93068486,"top":0.16480447,"width":0.009973404,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"bounds":{"left":0.9822141,"top":0.16480447,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"138 ms","depth":25,"bounds":{"left":0.99119014,"top":0.16560255,"width":0.0088098645,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.18435754,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"bounds":{"left":0.71476066,"top":0.1839585,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"o36719.ingest.sentry.io","depth":24,"bounds":{"left":0.7436835,"top":0.1839585,"width":0.040724736,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0","depth":25,"bounds":{"left":0.7809175,"top":0.1839585,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"sentry-B6v5fcc5.js","depth":24,"bounds":{"left":0.87450135,"top":0.1839585,"width":0.033410903,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":2","depth":24,"bounds":{"left":0.90791225,"top":0.1839585,"width":0.0033244682,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(fetch)","depth":24,"bounds":{"left":0.9112367,"top":0.1839585,"width":0.012799202,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.1839585,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"500 B","depth":24,"bounds":{"left":0.93068486,"top":0.1839585,"width":0.010305851,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2 B","depth":24,"bounds":{"left":0.9822141,"top":0.1839585,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"37 ms","depth":25,"bounds":{"left":0.9915226,"top":0.18475658,"width":0.00847739,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.20351157,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"bounds":{"left":0.71476066,"top":0.20311253,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"o36719.ingest.sentry.io","depth":24,"bounds":{"left":0.7436835,"top":0.20311253,"width":0.040724736,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0","depth":25,"bounds":{"left":0.7809175,"top":0.20311253,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"sentry-B6v5fcc5.js","depth":24,"bounds":{"left":0.87450135,"top":0.20311253,"width":0.033410903,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":2","depth":24,"bounds":{"left":0.90791225,"top":0.20311253,"width":0.0033244682,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(fetch)","depth":24,"bounds":{"left":0.9112367,"top":0.20311253,"width":0.012799202,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.20311253,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"500 B","depth":24,"bounds":{"left":0.93068486,"top":0.20311253,"width":0.010305851,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2 B","depth":24,"bounds":{"left":0.9822141,"top":0.20311253,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"36 ms","depth":25,"bounds":{"left":0.9915226,"top":0.20391062,"width":0.00847739,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.22266561,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"bounds":{"left":0.71476066,"top":0.22226655,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"bounds":{"left":0.73836434,"top":0.22226655,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"search?status[]=completed&sort_by=dateHeld&sort_direction=desc&exclude[]=stats&only_recorded=1&user_id[]=c4fb084a-b33a-46fe-904b-351b592a4b0f","depth":25,"bounds":{"left":0.7809175,"top":0.22226655,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.22226655,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.22226655,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"6.28 kB","depth":24,"bounds":{"left":0.93068486,"top":0.22226655,"width":0.013297873,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"24.21 kB","depth":24,"bounds":{"left":0.9730718,"top":0.22226655,"width":0.014793883,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"719 ms","depth":25,"bounds":{"left":0.9915226,"top":0.22306465,"width":0.00847739,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.24181964,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"bounds":{"left":0.71476066,"top":0.2414206,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"bounds":{"left":0.73836434,"top":0.2414206,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"automated-reports","depth":25,"bounds":{"left":0.7809175,"top":0.2414206,"width":0.03307846,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.2414206,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.2414206,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4.03 kB","depth":24,"bounds":{"left":0.93068486,"top":0.2414206,"width":0.013297873,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"6.13 kB","depth":24,"bounds":{"left":0.9752327,"top":0.2414206,"width":0.012632979,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"688 ms","depth":25,"bounds":{"left":0.9915226,"top":0.24221867,"width":0.00847739,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.26097366,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"bounds":{"left":0.71476066,"top":0.2605746,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"bounds":{"left":0.73836434,"top":0.2605746,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"recent","depth":25,"bounds":{"left":0.7809175,"top":0.2605746,"width":0.011136968,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.2605746,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.2605746,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"5.65 kB","depth":24,"bounds":{"left":0.93068486,"top":0.2605746,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15.26 kB","depth":24,"bounds":{"left":0.9730718,"top":0.2605746,"width":0.014793883,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"504 ms","depth":25,"bounds":{"left":0.9915226,"top":0.26137272,"width":0.00847739,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.2801277,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"bounds":{"left":0.71476066,"top":0.27972865,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"bounds":{"left":0.73836434,"top":0.27972865,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"integrations","depth":25,"bounds":{"left":0.7809175,"top":0.27972865,"width":0.020777926,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.27972865,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.27972865,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3.83 kB","depth":24,"bounds":{"left":0.93068486,"top":0.27972865,"width":0.013297873,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"5.53 kB","depth":24,"bounds":{"left":0.97473407,"top":0.27972865,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"812 ms","depth":25,"bounds":{"left":0.9915226,"top":0.28052673,"width":0.00847739,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":25,"bounds":{"left":0.69647604,"top":0.29928172,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"bounds":{"left":0.71476066,"top":0.2988827,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"find.userpilot.io","depth":24,"bounds":{"left":0.73836434,"top":0.2988827,"width":0.027260639,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"NX-094be170","depth":25,"bounds":{"left":0.7809175,"top":0.2988827,"width":0.024268618,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.2988827,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.2988827,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"cached","depth":24,"bounds":{"left":0.93068486,"top":0.2988827,"width":0.012632979,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"62 B","depth":24,"bounds":{"left":0.97988695,"top":0.2988827,"width":0.007978723,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 ms","depth":25,"bounds":{"left":0.9915226,"top":0.29968077,"width":0.00731383,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.31843576,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"bounds":{"left":0.71476066,"top":0.3180367,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"bounds":{"left":0.73836434,"top":0.3180367,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"authenticate","depth":25,"bounds":{"left":0.7809175,"top":0.3180367,"width":0.021775266,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.3180367,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.3180367,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3.11 kB","depth":24,"bounds":{"left":0.93068486,"top":0.3180367,"width":0.011968086,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"96 B","depth":24,"bounds":{"left":0.9797208,"top":0.3180367,"width":0.008144947,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"424 ms","depth":25,"bounds":{"left":0.99168885,"top":0.31883478,"width":0.008311152,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.33758977,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"bounds":{"left":0.71476066,"top":0.33719075,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"bounds":{"left":0.73836434,"top":0.33719075,"width":0.022273935,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t","depth":25,"bounds":{"left":0.7809175,"top":0.33719075,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.33719075,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.33719075,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"553.04 kB","depth":24,"bounds":{"left":0.93068486,"top":0.33719075,"width":0.017785905,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"bounds":{"left":0.9822141,"top":0.33719075,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"485 ms","depth":25,"bounds":{"left":0.9930186,"top":0.33798882,"width":0.006981373,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.3567438,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"bounds":{"left":0.71476066,"top":0.35634476,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"bounds":{"left":0.73836434,"top":0.35634476,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"automated-reports?page=1&sort_column=generated_at&sort_direction=desc&report_type[]=exec_summary","depth":25,"bounds":{"left":0.7809175,"top":0.35634476,"width":0.1896609,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.35634476,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.35634476,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3.71 kB","depth":24,"bounds":{"left":0.93068486,"top":0.35634476,"width":0.012466756,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2.77 kB","depth":24,"bounds":{"left":0.9750665,"top":0.35634476,"width":0.012799202,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"254 ms","depth":25,"bounds":{"left":0.9928524,"top":0.35714287,"width":0.00714761,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.37589785,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"bounds":{"left":0.71476066,"top":0.3754988,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"bounds":{"left":0.73836434,"top":0.3754988,"width":0.022273935,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t","depth":25,"bounds":{"left":0.7809175,"top":0.3754988,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.3754988,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.3754988,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"41.05 kB","depth":24,"bounds":{"left":0.93068486,"top":0.3754988,"width":0.014960106,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"bounds":{"left":0.9822141,"top":0.3754988,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"202 ms","depth":25,"bounds":{"left":0.99401593,"top":0.37629688,"width":0.005984068,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.39505187,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"bounds":{"left":0.71476066,"top":0.39465284,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"bounds":{"left":0.73836434,"top":0.39465284,"width":0.022273935,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t","depth":25,"bounds":{"left":0.7809175,"top":0.39465284,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.39465284,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.39465284,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3.08 kB","depth":24,"bounds":{"left":0.93068486,"top":0.39465284,"width":0.013297873,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"bounds":{"left":0.9822141,"top":0.39465284,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"170 ms","depth":25,"bounds":{"left":0.9953458,"top":0.39545092,"width":0.0046542287,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.4142059,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"bounds":{"left":0.71476066,"top":0.41380686,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"bounds":{"left":0.73836434,"top":0.41380686,"width":0.022273935,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t","depth":25,"bounds":{"left":0.7809175,"top":0.41380686,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.41380686,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.41380686,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3.85 kB","depth":24,"bounds":{"left":0.93068486,"top":0.41380686,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"bounds":{"left":0.9822141,"top":0.41380686,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"156 ms","depth":25,"bounds":{"left":0.9963431,"top":0.41460496,"width":0.0036569238,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.43335995,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"bounds":{"left":0.71476066,"top":0.4329609,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"bounds":{"left":0.73836434,"top":0.4329609,"width":0.022273935,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t","depth":25,"bounds":{"left":0.7809175,"top":0.4329609,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.4329609,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.4329609,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"20.92 kB","depth":24,"bounds":{"left":0.93068486,"top":0.4329609,"width":0.015292553,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"bounds":{"left":0.9822141,"top":0.4329609,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"183 ms","depth":25,"bounds":{"left":0.99767286,"top":0.43375897,"width":0.0023271441,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Status","depth":23,"bounds":{"left":0.69414896,"top":0.121308856,"width":0.01861702,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Status","depth":25,"bounds":{"left":0.69581115,"top":0.12609737,"width":0.011136968,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":23,"bounds":{"left":0.69647604,"top":0.14604948,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"204","depth":23,"bounds":{"left":0.69647604,"top":0.16520351,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":23,"bounds":{"left":0.69647604,"top":0.18435754,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":23,"bounds":{"left":0.69647604,"top":0.20351157,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":23,"bounds":{"left":0.69647604,"top":0.22266561,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":23,"bounds":{"left":0.69647604,"top":0.24181964,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":23,"bounds":{"left":0.69647604,"top":0.26097366,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":23,"bounds":{"left":0.69647604,"top":0.2801277,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.29928172,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":23,"bounds":{"left":0.69647604,"top":0.31843576,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Method","depth":23,"bounds":{"left":0.7130984,"top":0.121308856,"width":0.018284574,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Method","depth":25,"bounds":{"left":0.71476066,"top":0.12609737,"width":0.013297873,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"bounds":{"left":0.71476066,"top":0.14565043,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"OPTIONS","depth":23,"bounds":{"left":0.71476066,"top":0.16480447,"width":0.016456118,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"bounds":{"left":0.71476066,"top":0.1839585,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"bounds":{"left":0.71476066,"top":0.20311253,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":23,"bounds":{"left":0.71476066,"top":0.22226655,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":23,"bounds":{"left":0.71476066,"top":0.2414206,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":23,"bounds":{"left":0.71476066,"top":0.2605746,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":23,"bounds":{"left":0.71476066,"top":0.27972865,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":23,"bounds":{"left":0.71476066,"top":0.2988827,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"bounds":{"left":0.71476066,"top":0.3180367,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Domain","depth":23,"bounds":{"left":0.73171544,"top":0.121308856,"width":0.04720745,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Domain","depth":25,"bounds":{"left":0.73337764,"top":0.12609737,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":23,"bounds":{"left":0.73836434,"top":0.14565043,"width":0.022273935,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":23,"bounds":{"left":0.73836434,"top":0.16480447,"width":0.022273935,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"o36719.ingest.sentry.io","depth":23,"bounds":{"left":0.7436835,"top":0.1839585,"width":0.040724736,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"o36719.ingest.sentry.io","depth":23,"bounds":{"left":0.7436835,"top":0.20311253,"width":0.040724736,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":23,"bounds":{"left":0.73836434,"top":0.22226655,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":23,"bounds":{"left":0.73836434,"top":0.2414206,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":23,"bounds":{"left":0.73836434,"top":0.2605746,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":23,"bounds":{"left":0.73836434,"top":0.27972865,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"find.userpilot.io","depth":23,"bounds":{"left":0.73836434,"top":0.2988827,"width":0.027260639,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":23,"bounds":{"left":0.73836434,"top":0.3180367,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"File","depth":23,"bounds":{"left":0.77925533,"top":0.121308856,"width":0.09325133,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"File","depth":25,"bounds":{"left":0.7809175,"top":0.12609737,"width":0.006150266,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t","depth":24,"bounds":{"left":0.7809175,"top":0.14565043,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
-723541273168396710
|
-5291550476957193915
|
click
|
accessibility
|
NULL
|
Platform Sprint 2 Q2 - Platform Team - Scrum Board Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira
Project Phoenix – Figma
Project Phoenix – Figma
[JY-20372] AI Reports > Empty page design and promotion - Jira
[JY-20372] AI Reports > Empty page design and promotion - Jira
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Jiminny MCP Connector - Product - Confluence
Jiminny MCP Connector - Product - Confluence
Jiminny Mail
Jiminny Mail
[JY-20500] Batch initial sync for Salesforce - Jira
[JY-20500] Batch initial sync for Salesforce - Jira
Feed — jiminny — Sentry
Feed — jiminny — Sentry
Jiminny
Jiminny
Pipelines - jiminny/app
Pipelines - jiminny/app
Formalize
Formalize
[SRD-6793] Les Mills activity types not pulling in - Jira
[SRD-6793] Les Mills activity types not pulling in - Jira
Search results: calendar | Jiminny Help Center
Search results: calendar | Jiminny Help Center
Jiminny
Jiminny
Jiminny
Jiminny
Close tab
Edit - Engineering - Confluence
Edit - Engineering - Confluence
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
JY-18909-automated-reports-ask-jiminny ■ 874667
28
28
AI Reports
AI Reports
Ask Jiminny reports
Ask Jiminny reports
Report name
Period
Exec Summary × Report Type
Exec Summary
×
Report Type
Clear all
NAME
FREQUENCY
SHARED
DATE
ACTIONS
Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Exec Summary Podcast - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
You are currently impersonating Nikolay Yankov
Settings
Settings
Back To My Account
Back To My Account
Kiosk
Kiosk
Organization
Organization
Profile
Profile
Logout
Logout
app.staging.jiminny.com/kiosk
Clear
Filter URLs
Pause/Resume recording network log
New Request
Search
Request Blocking
Disable Cache
Disable Cache
No Throttling
Network Settings
All
HTML
CSS
JS
XHR
Fonts
Images
Media
WS
Other
Status
Status
Method
Method
Domain
Domain
File
File
Initiator
Initiator
Type
Type
Transferred
Transferred
Size
Size
0 ms
0 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
17.48 kB
0 B
188 ms
204
OPTIONS
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
plain
752 B
0 B
138 ms
200
POST
o36719.ingest.sentry.io
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
sentry-B6v5fcc5.js
:2
(fetch)
json
500 B
2 B
37 ms
200
POST
o36719.ingest.sentry.io
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
sentry-B6v5fcc5.js
:2
(fetch)
json
500 B
2 B
36 ms
200
GET
app.staging.jiminny.com
search?status[]=completed&sort_by=dateHeld&sort_direction=desc&exclude[]=stats&only_recorded=1&user_id[]=c4fb084a-b33a-46fe-904b-351b592a4b0f
xhr
json
6.28 kB
24.21 kB
719 ms
200
GET
app.staging.jiminny.com
automated-reports
xhr
json
4.03 kB
6.13 kB
688 ms
200
GET
app.staging.jiminny.com
recent
xhr
json
5.65 kB
15.26 kB
504 ms
200
GET
app.staging.jiminny.com
integrations
xhr
json
3.83 kB
5.53 kB
812 ms
200
GET
find.userpilot.io
NX-094be170
xhr
json
cached
62 B
0 ms
200
POST
app.staging.jiminny.com
authenticate
xhr
json
3.11 kB
96 B
424 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
553.04 kB
0 B
485 ms
200
GET
app.staging.jiminny.com
automated-reports?page=1&sort_column=generated_at&sort_direction=desc&report_type[]=exec_summary
xhr
json
3.71 kB
2.77 kB
254 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
41.05 kB
0 B
202 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
3.08 kB
0 B
170 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
3.85 kB
0 B
156 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
20.92 kB
0 B
183 ms
Status
Status
200
204
200
200
200
200
200
200
200
200
Method
Method
POST
OPTIONS
POST
POST
GET
GET
GET
GET
GET
POST
Domain
Domain
r.logr-in.com
r.logr-in.com
o36719.ingest.sentry.io
o36719.ingest.sentry.io
app.staging.jiminny.com
app.staging.jiminny.com
app.staging.jiminny.com
app.staging.jiminny.com
find.userpilot.io
app.staging.jiminny.com
File
File
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t...
|
NULL
|
|
67252
|
NULL
|
0
|
2026-04-21T15:30:33.831047+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776785433831_m1.jpg...
|
Firefox
|
Jiminny — Work
|
1
|
app.staging.jiminny.com/ai-reports
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Platform Sprint 2 Q2 - Platform Team - Scrum Board Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira
Project Phoenix – Figma
Project Phoenix – Figma
[JY-20372] AI Reports > Empty page design and promotion - Jira
[JY-20372] AI Reports > Empty page design and promotion - Jira
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Jiminny MCP Connector - Product - Confluence
Jiminny MCP Connector - Product - Confluence
Jiminny Mail
Jiminny Mail
[JY-20500] Batch initial sync for Salesforce - Jira
[JY-20500] Batch initial sync for Salesforce - Jira
Feed — jiminny — Sentry
Feed — jiminny — Sentry
Jiminny
Jiminny
Pipelines - jiminny/app
Pipelines - jiminny/app
Formalize
Formalize
[SRD-6793] Les Mills activity types not pulling in - Jira
[SRD-6793] Les Mills activity types not pulling in - Jira
Search results: calendar | Jiminny Help Center
Search results: calendar | Jiminny Help Center
Jiminny
Jiminny
Jiminny
Jiminny
Close tab
Edit - Engineering - Confluence
Edit - Engineering - Confluence
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
JY-18909-automated-reports-ask-jiminny ■ 874667
28
28
AI Reports
AI Reports
Ask Jiminny reports
Ask Jiminny reports
Report name
Period
Report Type Report Type
Report Type
Report Type
Clear all
NAME
FREQUENCY
SHARED
DATE
ACTIONS
Test 6 - 15 Apr 2026
Daily
16/04/2026
Test 7 - 15 Apr 2026
Daily
16/04/2026
Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Exec Summary Podcast - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Test 6 - 13 Apr 2026
Daily
14/04/2026
You are currently impersonating Nikolay Yankov
Clear
Filter URLs
Pause/Resume recording network log
New Request
Search
Request Blocking
Disable Cache
Disable Cache
No Throttling
Network Settings
All
HTML
CSS
JS
XHR
Fonts
Images
Media
WS
Other
Status
Status
Method
Method
Domain
Domain
File
File
Initiator
Initiator
Type
Type
Transferred
Transferred
Size
Size
0 ms
0 ms
200
POST
o36719.ingest.sentry.io
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
fetch
json
500 B
2 B
36 ms
200
POST
o36719.ingest.sentry.io
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
sentry-B6v5fcc5.js
:2
(fetch)
json
500 B
2 B
36 ms
200
GET
app.staging.jiminny.com
search?status[]=completed&sort_by=dateHeld&sort_direction=desc&exclude[]=stats&only_recorded=1&user_id[]=c4fb084a-b33a-46fe-904b-351b592a4b0f
xhr
json
6.28 kB
24.21 kB
786 ms
200
GET
app.staging.jiminny.com
automated-reports
xhr
json
4.03 kB
6.13 kB
733 ms
200
GET
app.staging.jiminny.com
recent
xhr
json
5.65 kB
15.26 kB
549 ms
200
GET
app.staging.jiminny.com
integrations
xhr
json
3.83 kB
5.53 kB
867 ms
200
GET
find.userpilot.io
NX-094be170
xhr
json
cached
62 B
0 ms
200
POST
app.staging.jiminny.com
authenticate
xhr
json
3.11 kB
96 B
470 ms
200
GET
app.staging.jiminny.com
automated-reports?page=1&sort_column=generated_at&sort_direction=desc&report_type[]=exec_summary
xhr
json
3.71 kB
2.77 kB...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20372] AI Reports > Empty page design and promotion - Jira","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20372] AI Reports > Empty page design and promotion - Jira","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny MCP Connector - Product - Confluence","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny MCP Connector - Product - Confluence","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny Mail","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny Mail","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20500] Batch initial sync for Salesforce - Jira","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20500] Batch initial sync for Salesforce - Jira","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Feed — jiminny — Sentry","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Feed — jiminny — Sentry","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Pipelines - jiminny/app","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pipelines - jiminny/app","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Formalize","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Formalize","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[SRD-6793] Les Mills activity types not pulling in - Jira","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[SRD-6793] Les Mills activity types not pulling in - Jira","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Search results: calendar | Jiminny Help Center","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Search results: calendar | Jiminny Help Center","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Jiminny","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Edit - Engineering - Confluence","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Edit - Engineering - Confluence","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Tabs from other devices","depth":6,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-18909-automated-reports-ask-jiminny ■ 874667","depth":9,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"28","depth":12,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"28","depth":14,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"AI Reports","depth":13,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"AI Reports","depth":14,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Ask Jiminny reports","depth":13,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ask Jiminny reports","depth":14,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXTextField","text":"Report name","depth":17,"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Period","depth":20,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXComboBox","text":"Report Type Report Type","depth":16,"value":"Report Type Report Type","help_text":"","role_description":"combo box","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Report Type","depth":18,"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Report Type","depth":19,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Clear all","depth":13,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"NAME","depth":16,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"FREQUENCY","depth":16,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"SHARED","depth":16,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"DATE","depth":16,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"ACTIONS","depth":16,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Test 6 - 15 Apr 2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Daily","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"16/04/2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Test 7 - 15 Apr 2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Daily","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"16/04/2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15/04/2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exec Summary Podcast - 1 Nov 2024 - 17 Dec 2025 - All","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15/04/2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15/04/2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Test 6 - 13 Apr 2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Daily","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"14/04/2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You are currently impersonating Nikolay Yankov","depth":11,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Clear","depth":16,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextField","text":"Filter URLs","depth":16,"help_text":"","role_description":"search text field","subrole":"AXSearchField","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Pause/Resume recording network log","depth":16,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"New Request","depth":16,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Search","depth":16,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Request Blocking","depth":16,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Disable Cache","depth":17,"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Disable Cache","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"No Throttling","depth":16,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Network Settings","depth":16,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"All","depth":17,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"HTML","depth":17,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"CSS","depth":17,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"JS","depth":17,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"XHR","depth":17,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Fonts","depth":17,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Images","depth":17,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Media","depth":17,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"WS","depth":17,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Other","depth":17,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Status","depth":24,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Status","depth":26,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Method","depth":24,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Method","depth":26,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Domain","depth":24,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Domain","depth":26,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"File","depth":24,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"File","depth":26,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Initiator","depth":24,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Initiator","depth":26,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Type","depth":24,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Type","depth":26,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Transferred","depth":24,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Transferred","depth":26,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Size","depth":24,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Size","depth":26,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"0 ms","depth":24,"help_text":"Timeline","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"0 ms","depth":27,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"o36719.ingest.sentry.io","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"fetch","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"500 B","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2 B","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"36 ms","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"o36719.ingest.sentry.io","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"sentry-B6v5fcc5.js","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":2","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(fetch)","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"500 B","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2 B","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"36 ms","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"search?status[]=completed&sort_by=dateHeld&sort_direction=desc&exclude[]=stats&only_recorded=1&user_id[]=c4fb084a-b33a-46fe-904b-351b592a4b0f","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"6.28 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"24.21 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"786 ms","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"automated-reports","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4.03 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"6.13 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"733 ms","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"recent","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"5.65 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15.26 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"549 ms","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"integrations","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3.83 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"5.53 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"867 ms","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"find.userpilot.io","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"NX-094be170","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"cached","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"62 B","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 ms","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"authenticate","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3.11 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"96 B","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"470 ms","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"automated-reports?page=1&sort_column=generated_at&sort_direction=desc&report_type[]=exec_summary","depth":25,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3.71 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2.77 kB","depth":24,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
9183553931811064266
|
-4750204273710928617
|
click
|
accessibility
|
NULL
|
Platform Sprint 2 Q2 - Platform Team - Scrum Board Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira
Project Phoenix – Figma
Project Phoenix – Figma
[JY-20372] AI Reports > Empty page design and promotion - Jira
[JY-20372] AI Reports > Empty page design and promotion - Jira
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Jiminny MCP Connector - Product - Confluence
Jiminny MCP Connector - Product - Confluence
Jiminny Mail
Jiminny Mail
[JY-20500] Batch initial sync for Salesforce - Jira
[JY-20500] Batch initial sync for Salesforce - Jira
Feed — jiminny — Sentry
Feed — jiminny — Sentry
Jiminny
Jiminny
Pipelines - jiminny/app
Pipelines - jiminny/app
Formalize
Formalize
[SRD-6793] Les Mills activity types not pulling in - Jira
[SRD-6793] Les Mills activity types not pulling in - Jira
Search results: calendar | Jiminny Help Center
Search results: calendar | Jiminny Help Center
Jiminny
Jiminny
Jiminny
Jiminny
Close tab
Edit - Engineering - Confluence
Edit - Engineering - Confluence
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
JY-18909-automated-reports-ask-jiminny ■ 874667
28
28
AI Reports
AI Reports
Ask Jiminny reports
Ask Jiminny reports
Report name
Period
Report Type Report Type
Report Type
Report Type
Clear all
NAME
FREQUENCY
SHARED
DATE
ACTIONS
Test 6 - 15 Apr 2026
Daily
16/04/2026
Test 7 - 15 Apr 2026
Daily
16/04/2026
Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Exec Summary Podcast - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Test 6 - 13 Apr 2026
Daily
14/04/2026
You are currently impersonating Nikolay Yankov
Clear
Filter URLs
Pause/Resume recording network log
New Request
Search
Request Blocking
Disable Cache
Disable Cache
No Throttling
Network Settings
All
HTML
CSS
JS
XHR
Fonts
Images
Media
WS
Other
Status
Status
Method
Method
Domain
Domain
File
File
Initiator
Initiator
Type
Type
Transferred
Transferred
Size
Size
0 ms
0 ms
200
POST
o36719.ingest.sentry.io
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
fetch
json
500 B
2 B
36 ms
200
POST
o36719.ingest.sentry.io
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
sentry-B6v5fcc5.js
:2
(fetch)
json
500 B
2 B
36 ms
200
GET
app.staging.jiminny.com
search?status[]=completed&sort_by=dateHeld&sort_direction=desc&exclude[]=stats&only_recorded=1&user_id[]=c4fb084a-b33a-46fe-904b-351b592a4b0f
xhr
json
6.28 kB
24.21 kB
786 ms
200
GET
app.staging.jiminny.com
automated-reports
xhr
json
4.03 kB
6.13 kB
733 ms
200
GET
app.staging.jiminny.com
recent
xhr
json
5.65 kB
15.26 kB
549 ms
200
GET
app.staging.jiminny.com
integrations
xhr
json
3.83 kB
5.53 kB
867 ms
200
GET
find.userpilot.io
NX-094be170
xhr
json
cached
62 B
0 ms
200
POST
app.staging.jiminny.com
authenticate
xhr
json
3.11 kB
96 B
470 ms
200
GET
app.staging.jiminny.com
automated-reports?page=1&sort_column=generated_at&sort_direction=desc&report_type[]=exec_summary
xhr
json
3.71 kB
2.77 kB...
|
NULL
|
|
67253
|
NULL
|
0
|
2026-04-21T15:30:33.831012+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776785433831_m2.jpg...
|
Firefox
|
Jiminny — Work
|
1
|
app.staging.jiminny.com/ai-reports
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Platform Sprint 2 Q2 - Platform Team - Scrum Board Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira
Project Phoenix – Figma
Project Phoenix – Figma
[JY-20372] AI Reports > Empty page design and promotion - Jira
[JY-20372] AI Reports > Empty page design and promotion - Jira
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Jiminny MCP Connector - Product - Confluence
Jiminny MCP Connector - Product - Confluence
Jiminny Mail
Jiminny Mail
[JY-20500] Batch initial sync for Salesforce - Jira
[JY-20500] Batch initial sync for Salesforce - Jira
Feed — jiminny — Sentry
Feed — jiminny — Sentry
Jiminny
Jiminny
Pipelines - jiminny/app
Pipelines - jiminny/app
Formalize
Formalize
[SRD-6793] Les Mills activity types not pulling in - Jira
[SRD-6793] Les Mills activity types not pulling in - Jira
Search results: calendar | Jiminny Help Center
Search results: calendar | Jiminny Help Center
Jiminny
Jiminny
Jiminny
Jiminny
Close tab
Edit - Engineering - Confluence
Edit - Engineering - Confluence
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
JY-18909-automated-reports-ask-jiminny ■ 874667
28
28
AI Reports
AI Reports
Ask Jiminny reports
Ask Jiminny reports
Report name
Period
Report Type Report Type
Report Type
Report Type
Clear all
NAME
FREQUENCY
SHARED
DATE
ACTIONS
Test 6 - 15 Apr 2026
Daily
16/04/2026
Test 7 - 15 Apr 2026
Daily
16/04/2026
Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Exec Summary Podcast - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Test 6 - 13 Apr 2026
Daily
14/04/2026
You are currently impersonating Nikolay Yankov
Clear
Filter URLs
Pause/Resume recording network log
New Request
Search
Request Blocking
Disable Cache
Disable Cache
No Throttling
Network Settings
All
HTML
CSS
JS
XHR
Fonts
Images
Media
WS
Other
Status
Status
Method
Method
Domain
Domain
File
File
Initiator
Initiator
Type
Type
Transferred
Transferred
Size
Size
0 ms
0 ms
200
POST
o36719.ingest.sentry.io
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
fetch
json
500 B
2 B
36 ms
200
POST
o36719.ingest.sentry.io
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
sentry-B6v5fcc5.js
:2
(fetch)
json
500 B
2 B
36 ms
200
GET
app.staging.jiminny.com
search?status[]=completed&sort_by=dateHeld&sort_direction=desc&exclude[]=stats&only_recorded=1&user_id[]=c4fb084a-b33a-46fe-904b-351b592a4b0f
xhr
json
6.28 kB
24.21 kB
786 ms
200
GET
app.staging.jiminny.com
automated-reports
xhr
json
4.03 kB
6.13 kB
733 ms
200
GET
app.staging.jiminny.com
recent
xhr
json
5.65 kB
15.26 kB
549 ms
200
GET
app.staging.jiminny.com
integrations
xhr
json
3.83 kB
5.53 kB
867 ms
200
GET
find.userpilot.io
NX-094be170
xhr
json
cached
62 B
0 ms
200
POST
app.staging.jiminny.com
authenticate
xhr
json
3.11 kB
96 B
470 ms
200
GET
app.staging.jiminny.com
automated-reports?page=1&sort_column=generated_at&sort_direction=desc&report_type[]=exec_summary
xhr
json
3.71 kB
2.77 kB
248 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
587.01 kB
0 B
559 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
3.44 kB
0 B
152 ms
200
GET
app.staging.jiminny.com
automated-reports?page=1&sort_column=generated_at&sort_direction=desc
xhr
json
4.03 kB
6.13 kB
507 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
6.14 kB
0 B
174 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
227.95 kB
0 B
418 ms
Status
Status
200
200
200
200
200
200
200
200
Method
Method
POST
POST
GET
GET
GET
GET
GET
POST
Domain
Domain
o36719.ingest.sentry.io
o36719.ingest.sentry.io
app.staging.jiminny.com
app.staging.jiminny.com
app.staging.jiminny.com
app.staging.jiminny.com
find.userpilot.io
app.staging.jiminny.com
File
File
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
search?status[]=completed&sort_by=dateHeld&sort_direction=desc&exclude[]=stats&only_recorded=1&user_id[]=c4fb084a-b33a-46fe-904b-351b592a4b0f
automated-reports
recent
integrations...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira","depth":4,"bounds":{"left":0.0018284575,"top":0.0518755,"width":0.07596409,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"bounds":{"left":0.0,"top":0.09497207,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"bounds":{"left":0.013297873,"top":0.10614525,"width":0.041888297,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20372] AI Reports > Empty page design and promotion - Jira","depth":4,"bounds":{"left":0.0,"top":0.12769353,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20372] AI Reports > Empty page design and promotion - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.13886672,"width":0.11319814,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"bounds":{"left":0.0,"top":0.16041501,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"bounds":{"left":0.013297873,"top":0.17158818,"width":0.041888297,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"bounds":{"left":0.0,"top":0.19313647,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"bounds":{"left":0.013297873,"top":0.20430966,"width":0.041888297,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"bounds":{"left":0.0,"top":0.22585794,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"bounds":{"left":0.013297873,"top":0.23703113,"width":0.041888297,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny MCP Connector - Product - Confluence","depth":4,"bounds":{"left":0.0,"top":0.2585794,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny MCP Connector - Product - Confluence","depth":5,"bounds":{"left":0.013297873,"top":0.2697526,"width":0.08294548,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny Mail","depth":4,"bounds":{"left":0.0,"top":0.29130086,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny Mail","depth":5,"bounds":{"left":0.013297873,"top":0.30247405,"width":0.02144282,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20500] Batch initial sync for Salesforce - Jira","depth":4,"bounds":{"left":0.0,"top":0.32402235,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20500] Batch initial sync for Salesforce - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.33519554,"width":0.08610372,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Feed — jiminny — Sentry","depth":4,"bounds":{"left":0.0,"top":0.3567438,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Feed — jiminny — Sentry","depth":5,"bounds":{"left":0.013297873,"top":0.367917,"width":0.042719416,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"bounds":{"left":0.0,"top":0.38946527,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"bounds":{"left":0.013297873,"top":0.40063846,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Pipelines - jiminny/app","depth":4,"bounds":{"left":0.0,"top":0.42218676,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pipelines - jiminny/app","depth":5,"bounds":{"left":0.013297873,"top":0.43335995,"width":0.039228722,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Formalize","depth":4,"bounds":{"left":0.0,"top":0.45490822,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Formalize","depth":5,"bounds":{"left":0.013297873,"top":0.4660814,"width":0.016788565,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[SRD-6793] Les Mills activity types not pulling in - Jira","depth":4,"bounds":{"left":0.0,"top":0.48762968,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[SRD-6793] Les Mills activity types not pulling in - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.49880287,"width":0.09524601,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Search results: calendar | Jiminny Help Center","depth":4,"bounds":{"left":0.0,"top":0.5203512,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Search results: calendar | Jiminny Help Center","depth":5,"bounds":{"left":0.013297873,"top":0.53152436,"width":0.080119684,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"bounds":{"left":0.0,"top":0.55307263,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"bounds":{"left":0.013297873,"top":0.5642458,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"bounds":{"left":0.0,"top":0.5857941,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Jiminny","depth":5,"bounds":{"left":0.013297873,"top":0.5969673,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.06732048,"top":0.59297687,"width":0.007978723,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Edit - Engineering - Confluence","depth":4,"bounds":{"left":0.0,"top":0.61851555,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Edit - Engineering - Confluence","depth":5,"bounds":{"left":0.013297873,"top":0.62968874,"width":0.054853722,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.0028257978,"top":0.6528332,"width":0.07413564,"height":0.025538707},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.0028257978,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.013796543,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Tabs from other devices","depth":6,"bounds":{"left":0.024933511,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.036070477,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.04720745,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-18909-automated-reports-ask-jiminny ■ 874667","depth":9,"bounds":{"left":0.08028591,"top":0.9860335,"width":0.10056516,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"28","depth":12,"bounds":{"left":0.08228058,"top":0.91380686,"width":0.015957447,"height":0.035115723},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"28","depth":14,"bounds":{"left":0.09059176,"top":0.9173983,"width":0.004654255,"height":0.011971269},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"AI Reports","depth":13,"bounds":{"left":0.10887633,"top":0.06943336,"width":0.031416222,"height":0.019553073},"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"AI Reports","depth":14,"bounds":{"left":0.10887633,"top":0.06943336,"width":0.031416222,"height":0.019553073},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Ask Jiminny reports","depth":13,"bounds":{"left":0.62682843,"top":0.06464485,"width":0.059341755,"height":0.028731046},"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ask Jiminny reports","depth":14,"bounds":{"left":0.64045876,"top":0.07222666,"width":0.04105718,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXTextField","text":"Report name","depth":17,"bounds":{"left":0.12167553,"top":0.10933759,"width":0.058011968,"height":0.019952115},"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Period","depth":20,"bounds":{"left":0.19963431,"top":0.114924185,"width":0.012799202,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXComboBox","text":"Report Type Report Type","depth":16,"bounds":{"left":0.26944813,"top":0.10933759,"width":0.06615692,"height":0.019952115},"value":"Report Type Report Type","help_text":"","role_description":"combo box","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Report Type","depth":18,"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Report Type","depth":19,"bounds":{"left":0.26944813,"top":0.11292897,"width":0.023603724,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Clear all","depth":13,"bounds":{"left":0.34192154,"top":0.112529926,"width":0.028424202,"height":0.015961692},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"NAME","depth":16,"bounds":{"left":0.10854388,"top":0.1660016,"width":0.012965426,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"FREQUENCY","depth":16,"bounds":{"left":0.35854387,"top":0.1660016,"width":0.026263298,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"SHARED","depth":16,"bounds":{"left":0.4418218,"top":0.1660016,"width":0.017453458,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"DATE","depth":16,"bounds":{"left":0.52509975,"top":0.1660016,"width":0.011136968,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"ACTIONS","depth":16,"bounds":{"left":0.6085439,"top":0.1660016,"width":0.019115692,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Test 6 - 15 Apr 2026","depth":17,"bounds":{"left":0.12184176,"top":0.21268955,"width":0.042386968,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Daily","depth":17,"bounds":{"left":0.35854387,"top":0.21268955,"width":0.010139627,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"16/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.21268955,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Test 7 - 15 Apr 2026","depth":17,"bounds":{"left":0.12184176,"top":0.25977653,"width":0.042386968,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Daily","depth":17,"bounds":{"left":0.35854387,"top":0.25977653,"width":0.010139627,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"16/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.25977653,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All","depth":17,"bounds":{"left":0.12184176,"top":0.30686352,"width":0.0987367,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"bounds":{"left":0.35854387,"top":0.30686352,"width":0.016456118,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.30686352,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exec Summary Podcast - 1 Nov 2024 - 17 Dec 2025 - All","depth":17,"bounds":{"left":0.12184176,"top":0.35395053,"width":0.1165226,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"bounds":{"left":0.35854387,"top":0.35395053,"width":0.016456118,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.35395053,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All","depth":17,"bounds":{"left":0.12184176,"top":0.4010375,"width":0.0987367,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"bounds":{"left":0.35854387,"top":0.4010375,"width":0.016456118,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.4010375,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Test 6 - 13 Apr 2026","depth":17,"bounds":{"left":0.12184176,"top":0.4481245,"width":0.042386968,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Daily","depth":17,"bounds":{"left":0.35854387,"top":0.4481245,"width":0.010139627,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"14/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.4481245,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You are currently impersonating Nikolay Yankov","depth":11,"bounds":{"left":0.33194813,"top":0.053072624,"width":0.09940159,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Clear","depth":16,"bounds":{"left":0.69547874,"top":0.07821229,"width":0.008643617,"height":0.015961692},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextField","text":"Filter URLs","depth":16,"bounds":{"left":0.70578456,"top":0.07581804,"width":0.16771941,"height":0.0207502},"help_text":"","role_description":"search text field","subrole":"AXSearchField","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Pause/Resume recording network log","depth":16,"bounds":{"left":0.8871343,"top":0.077813245,"width":0.008643617,"height":0.016759777},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"New Request","depth":16,"bounds":{"left":0.89644283,"top":0.07821229,"width":0.008643617,"height":0.015961692},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Search","depth":16,"bounds":{"left":0.90575135,"top":0.07821229,"width":0.008643617,"height":0.015961692},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Request Blocking","depth":16,"bounds":{"left":0.91505986,"top":0.07821229,"width":0.008643617,"height":0.015961692},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Disable Cache","depth":17,"bounds":{"left":0.92702794,"top":0.080207504,"width":0.004654255,"height":0.011173184},"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Disable Cache","depth":17,"bounds":{"left":0.93267953,"top":0.08100559,"width":0.024933511,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"No Throttling","depth":16,"bounds":{"left":0.96127,"top":0.07940942,"width":0.027094414,"height":0.01396648},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Network Settings","depth":16,"bounds":{"left":0.9900266,"top":0.07821229,"width":0.008643617,"height":0.015961692},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"All","depth":17,"bounds":{"left":0.6978058,"top":0.10175578,"width":0.00831117,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"HTML","depth":17,"bounds":{"left":0.7067819,"top":0.10175578,"width":0.014461436,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"CSS","depth":17,"bounds":{"left":0.7219083,"top":0.10175578,"width":0.011303191,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"JS","depth":17,"bounds":{"left":0.73387635,"top":0.10175578,"width":0.00831117,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"XHR","depth":17,"bounds":{"left":0.7428524,"top":0.10175578,"width":0.011635638,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Fonts","depth":17,"bounds":{"left":0.75515294,"top":0.10175578,"width":0.013630319,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Images","depth":17,"bounds":{"left":0.76944816,"top":0.10175578,"width":0.01662234,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Media","depth":17,"bounds":{"left":0.78673536,"top":0.10175578,"width":0.014461436,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"WS","depth":17,"bounds":{"left":0.8018617,"top":0.10175578,"width":0.009973404,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Other","depth":17,"bounds":{"left":0.8125,"top":0.10175578,"width":0.013796543,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Status","depth":24,"bounds":{"left":0.69414896,"top":0.121308856,"width":0.01861702,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Status","depth":26,"bounds":{"left":0.69581115,"top":0.12609737,"width":0.011136968,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Method","depth":24,"bounds":{"left":0.7130984,"top":0.121308856,"width":0.018284574,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Method","depth":26,"bounds":{"left":0.71476066,"top":0.12609737,"width":0.013297873,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Domain","depth":24,"bounds":{"left":0.73171544,"top":0.121308856,"width":0.04720745,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Domain","depth":26,"bounds":{"left":0.73337764,"top":0.12609737,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"File","depth":24,"bounds":{"left":0.77925533,"top":0.121308856,"width":0.09325133,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"File","depth":26,"bounds":{"left":0.7809175,"top":0.12609737,"width":0.006150266,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Initiator","depth":24,"bounds":{"left":0.8728391,"top":0.121308856,"width":0.03723404,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Initiator","depth":26,"bounds":{"left":0.87450135,"top":0.12609737,"width":0.013297873,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Type","depth":24,"bounds":{"left":0.9104056,"top":0.121308856,"width":0.018284574,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Type","depth":26,"bounds":{"left":0.91206783,"top":0.12609737,"width":0.008477394,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Transferred","depth":24,"bounds":{"left":0.9290226,"top":0.121308856,"width":0.0038231383,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Transferred","depth":26,"bounds":{"left":0.93068486,"top":0.12609737,"width":0.020113032,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Size","depth":24,"bounds":{"left":0.9331782,"top":0.121308856,"width":0.056017287,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Size","depth":26,"bounds":{"left":0.93484044,"top":0.12609737,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"0 ms","depth":24,"bounds":{"left":0.98952794,"top":0.121308856,"width":0.010472059,"height":0.01915403},"help_text":"Timeline","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"0 ms","depth":27,"bounds":{"left":0.9908577,"top":0.12849163,"width":0.0066489363,"height":0.007980846},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.14604948,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"bounds":{"left":0.71476066,"top":0.14565043,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"o36719.ingest.sentry.io","depth":24,"bounds":{"left":0.7436835,"top":0.14565043,"width":0.040724736,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0","depth":25,"bounds":{"left":0.7809175,"top":0.14565043,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"fetch","depth":24,"bounds":{"left":0.87450135,"top":0.14565043,"width":0.008976064,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.14565043,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"500 B","depth":24,"bounds":{"left":0.93068486,"top":0.14565043,"width":0.010305851,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2 B","depth":24,"bounds":{"left":0.9822141,"top":0.14565043,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"36 ms","depth":25,"bounds":{"left":0.9913564,"top":0.14644852,"width":0.008643627,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.16520351,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"bounds":{"left":0.71476066,"top":0.16480447,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"o36719.ingest.sentry.io","depth":24,"bounds":{"left":0.7436835,"top":0.16480447,"width":0.040724736,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0","depth":25,"bounds":{"left":0.7809175,"top":0.16480447,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"sentry-B6v5fcc5.js","depth":24,"bounds":{"left":0.87450135,"top":0.16480447,"width":0.033410903,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":":2","depth":24,"bounds":{"left":0.90791225,"top":0.16480447,"width":0.0033244682,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"(fetch)","depth":24,"bounds":{"left":0.9112367,"top":0.16480447,"width":0.012799202,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.16480447,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"500 B","depth":24,"bounds":{"left":0.93068486,"top":0.16480447,"width":0.010305851,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2 B","depth":24,"bounds":{"left":0.9822141,"top":0.16480447,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"36 ms","depth":25,"bounds":{"left":0.9913564,"top":0.16560255,"width":0.008643627,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.18435754,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"bounds":{"left":0.71476066,"top":0.1839585,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"bounds":{"left":0.73836434,"top":0.1839585,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"search?status[]=completed&sort_by=dateHeld&sort_direction=desc&exclude[]=stats&only_recorded=1&user_id[]=c4fb084a-b33a-46fe-904b-351b592a4b0f","depth":25,"bounds":{"left":0.7809175,"top":0.1839585,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.1839585,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.1839585,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"6.28 kB","depth":24,"bounds":{"left":0.93068486,"top":0.1839585,"width":0.013297873,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"24.21 kB","depth":24,"bounds":{"left":0.9730718,"top":0.1839585,"width":0.014793883,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"786 ms","depth":25,"bounds":{"left":0.9913564,"top":0.18475658,"width":0.008643627,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.20351157,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"bounds":{"left":0.71476066,"top":0.20311253,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"bounds":{"left":0.73836434,"top":0.20311253,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"automated-reports","depth":25,"bounds":{"left":0.7809175,"top":0.20311253,"width":0.03307846,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.20311253,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.20311253,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4.03 kB","depth":24,"bounds":{"left":0.93068486,"top":0.20311253,"width":0.013297873,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"6.13 kB","depth":24,"bounds":{"left":0.9752327,"top":0.20311253,"width":0.012632979,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"733 ms","depth":25,"bounds":{"left":0.9913564,"top":0.20391062,"width":0.008643627,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.22266561,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"bounds":{"left":0.71476066,"top":0.22226655,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"bounds":{"left":0.73836434,"top":0.22226655,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"recent","depth":25,"bounds":{"left":0.7809175,"top":0.22226655,"width":0.011136968,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.22226655,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.22226655,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"5.65 kB","depth":24,"bounds":{"left":0.93068486,"top":0.22226655,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15.26 kB","depth":24,"bounds":{"left":0.9730718,"top":0.22226655,"width":0.014793883,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"549 ms","depth":25,"bounds":{"left":0.9913564,"top":0.22306465,"width":0.008643627,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.24181964,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"bounds":{"left":0.71476066,"top":0.2414206,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"bounds":{"left":0.73836434,"top":0.2414206,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"integrations","depth":25,"bounds":{"left":0.7809175,"top":0.2414206,"width":0.020777926,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.2414206,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.2414206,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3.83 kB","depth":24,"bounds":{"left":0.93068486,"top":0.2414206,"width":0.013297873,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"5.53 kB","depth":24,"bounds":{"left":0.97473407,"top":0.2414206,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"867 ms","depth":25,"bounds":{"left":0.9913564,"top":0.24221867,"width":0.008643627,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":25,"bounds":{"left":0.69647604,"top":0.26097366,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"bounds":{"left":0.71476066,"top":0.2605746,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"find.userpilot.io","depth":24,"bounds":{"left":0.73836434,"top":0.2605746,"width":0.027260639,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"NX-094be170","depth":25,"bounds":{"left":0.7809175,"top":0.2605746,"width":0.024268618,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.2605746,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.2605746,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"cached","depth":24,"bounds":{"left":0.93068486,"top":0.2605746,"width":0.012632979,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"62 B","depth":24,"bounds":{"left":0.97988695,"top":0.2605746,"width":0.007978723,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 ms","depth":25,"bounds":{"left":0.9915226,"top":0.26137272,"width":0.0071476065,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.2801277,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"bounds":{"left":0.71476066,"top":0.27972865,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"bounds":{"left":0.73836434,"top":0.27972865,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"authenticate","depth":25,"bounds":{"left":0.7809175,"top":0.27972865,"width":0.021775266,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.27972865,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.27972865,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3.11 kB","depth":24,"bounds":{"left":0.93068486,"top":0.27972865,"width":0.011968086,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"96 B","depth":24,"bounds":{"left":0.9797208,"top":0.27972865,"width":0.008144947,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"470 ms","depth":25,"bounds":{"left":0.9915226,"top":0.28052673,"width":0.00847739,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.29928172,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"bounds":{"left":0.71476066,"top":0.2988827,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"bounds":{"left":0.73836434,"top":0.2988827,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"automated-reports?page=1&sort_column=generated_at&sort_direction=desc&report_type[]=exec_summary","depth":25,"bounds":{"left":0.7809175,"top":0.2988827,"width":0.1896609,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.2988827,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.2988827,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3.71 kB","depth":24,"bounds":{"left":0.93068486,"top":0.2988827,"width":0.012466756,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2.77 kB","depth":24,"bounds":{"left":0.9750665,"top":0.2988827,"width":0.012799202,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"248 ms","depth":25,"bounds":{"left":0.99235374,"top":0.29968077,"width":0.0076462626,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.31843576,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"bounds":{"left":0.71476066,"top":0.3180367,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"bounds":{"left":0.73836434,"top":0.3180367,"width":0.022273935,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t","depth":25,"bounds":{"left":0.7809175,"top":0.3180367,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.3180367,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.3180367,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"587.01 kB","depth":24,"bounds":{"left":0.93068486,"top":0.3180367,"width":0.016788565,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"bounds":{"left":0.9822141,"top":0.3180367,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"559 ms","depth":25,"bounds":{"left":0.9930186,"top":0.31883478,"width":0.006981373,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.33758977,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"bounds":{"left":0.71476066,"top":0.33719075,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"bounds":{"left":0.73836434,"top":0.33719075,"width":0.022273935,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t","depth":25,"bounds":{"left":0.7809175,"top":0.33719075,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.33719075,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.33719075,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"3.44 kB","depth":24,"bounds":{"left":0.93068486,"top":0.33719075,"width":0.013297873,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"bounds":{"left":0.9822141,"top":0.33719075,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"152 ms","depth":25,"bounds":{"left":0.99401593,"top":0.33798882,"width":0.005984068,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.3567438,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":24,"bounds":{"left":0.71476066,"top":0.35634476,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":24,"bounds":{"left":0.73836434,"top":0.35634476,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"automated-reports?page=1&sort_column=generated_at&sort_direction=desc","depth":25,"bounds":{"left":0.7809175,"top":0.35634476,"width":0.13513963,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.35634476,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.35634476,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"4.03 kB","depth":24,"bounds":{"left":0.93068486,"top":0.35634476,"width":0.013297873,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"6.13 kB","depth":24,"bounds":{"left":0.9752327,"top":0.35634476,"width":0.012632979,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"507 ms","depth":25,"bounds":{"left":0.99517953,"top":0.35714287,"width":0.004820466,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.37589785,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"bounds":{"left":0.71476066,"top":0.3754988,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"bounds":{"left":0.73836434,"top":0.3754988,"width":0.022273935,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t","depth":25,"bounds":{"left":0.7809175,"top":0.3754988,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.3754988,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.3754988,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"6.14 kB","depth":24,"bounds":{"left":0.93068486,"top":0.3754988,"width":0.012799202,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"bounds":{"left":0.9822141,"top":0.3754988,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"174 ms","depth":25,"bounds":{"left":0.9953458,"top":0.37629688,"width":0.0046542287,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.39505187,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"bounds":{"left":0.71476066,"top":0.39465284,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"r.logr-in.com","depth":24,"bounds":{"left":0.73836434,"top":0.39465284,"width":0.022273935,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t","depth":25,"bounds":{"left":0.7809175,"top":0.39465284,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"xhr","depth":24,"bounds":{"left":0.87450135,"top":0.39465284,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.39465284,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"227.95 kB","depth":24,"bounds":{"left":0.93068486,"top":0.39465284,"width":0.017121011,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"0 B","depth":24,"bounds":{"left":0.9822141,"top":0.39465284,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"418 ms","depth":25,"bounds":{"left":0.99700797,"top":0.39545092,"width":0.002992034,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Status","depth":23,"bounds":{"left":0.69414896,"top":0.121308856,"width":0.01861702,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Status","depth":25,"bounds":{"left":0.69581115,"top":0.12609737,"width":0.011136968,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":23,"bounds":{"left":0.69647604,"top":0.14604948,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":23,"bounds":{"left":0.69647604,"top":0.16520351,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":23,"bounds":{"left":0.69647604,"top":0.18435754,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":23,"bounds":{"left":0.69647604,"top":0.20351157,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":23,"bounds":{"left":0.69647604,"top":0.22266561,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":23,"bounds":{"left":0.69647604,"top":0.24181964,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.26097366,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":23,"bounds":{"left":0.69647604,"top":0.2801277,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Method","depth":23,"bounds":{"left":0.7130984,"top":0.121308856,"width":0.018284574,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Method","depth":25,"bounds":{"left":0.71476066,"top":0.12609737,"width":0.013297873,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"bounds":{"left":0.71476066,"top":0.14565043,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"bounds":{"left":0.71476066,"top":0.16480447,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":23,"bounds":{"left":0.71476066,"top":0.1839585,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":23,"bounds":{"left":0.71476066,"top":0.20311253,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":23,"bounds":{"left":0.71476066,"top":0.22226655,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":23,"bounds":{"left":0.71476066,"top":0.2414206,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"GET","depth":23,"bounds":{"left":0.71476066,"top":0.2605746,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":23,"bounds":{"left":0.71476066,"top":0.27972865,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Domain","depth":23,"bounds":{"left":0.73171544,"top":0.121308856,"width":0.04720745,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Domain","depth":25,"bounds":{"left":0.73337764,"top":0.12609737,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"o36719.ingest.sentry.io","depth":23,"bounds":{"left":0.7436835,"top":0.14565043,"width":0.040724736,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"o36719.ingest.sentry.io","depth":23,"bounds":{"left":0.7436835,"top":0.16480447,"width":0.040724736,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":23,"bounds":{"left":0.73836434,"top":0.1839585,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":23,"bounds":{"left":0.73836434,"top":0.20311253,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":23,"bounds":{"left":0.73836434,"top":0.22226655,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":23,"bounds":{"left":0.73836434,"top":0.2414206,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"find.userpilot.io","depth":23,"bounds":{"left":0.73836434,"top":0.2605746,"width":0.027260639,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"app.staging.jiminny.com","depth":23,"bounds":{"left":0.73836434,"top":0.27972865,"width":0.042054523,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"File","depth":23,"bounds":{"left":0.77925533,"top":0.121308856,"width":0.09325133,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"File","depth":25,"bounds":{"left":0.7809175,"top":0.12609737,"width":0.006150266,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0","depth":24,"bounds":{"left":0.7809175,"top":0.14565043,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0","depth":24,"bounds":{"left":0.7809175,"top":0.16480447,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"search?status[]=completed&sort_by=dateHeld&sort_direction=desc&exclude[]=stats&only_recorded=1&user_id[]=c4fb084a-b33a-46fe-904b-351b592a4b0f","depth":24,"bounds":{"left":0.7809175,"top":0.1839585,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"automated-reports","depth":24,"bounds":{"left":0.7809175,"top":0.20311253,"width":0.03307846,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"recent","depth":24,"bounds":{"left":0.7809175,"top":0.22226655,"width":0.011136968,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"integrations","depth":24,"bounds":{"left":0.7809175,"top":0.2414206,"width":0.020777926,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
2601008638200880674
|
-4714456956769080233
|
click
|
accessibility
|
NULL
|
Platform Sprint 2 Q2 - Platform Team - Scrum Board Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira
Project Phoenix – Figma
Project Phoenix – Figma
[JY-20372] AI Reports > Empty page design and promotion - Jira
[JY-20372] AI Reports > Empty page design and promotion - Jira
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Jiminny MCP Connector - Product - Confluence
Jiminny MCP Connector - Product - Confluence
Jiminny Mail
Jiminny Mail
[JY-20500] Batch initial sync for Salesforce - Jira
[JY-20500] Batch initial sync for Salesforce - Jira
Feed — jiminny — Sentry
Feed — jiminny — Sentry
Jiminny
Jiminny
Pipelines - jiminny/app
Pipelines - jiminny/app
Formalize
Formalize
[SRD-6793] Les Mills activity types not pulling in - Jira
[SRD-6793] Les Mills activity types not pulling in - Jira
Search results: calendar | Jiminny Help Center
Search results: calendar | Jiminny Help Center
Jiminny
Jiminny
Jiminny
Jiminny
Close tab
Edit - Engineering - Confluence
Edit - Engineering - Confluence
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
JY-18909-automated-reports-ask-jiminny ■ 874667
28
28
AI Reports
AI Reports
Ask Jiminny reports
Ask Jiminny reports
Report name
Period
Report Type Report Type
Report Type
Report Type
Clear all
NAME
FREQUENCY
SHARED
DATE
ACTIONS
Test 6 - 15 Apr 2026
Daily
16/04/2026
Test 7 - 15 Apr 2026
Daily
16/04/2026
Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Exec Summary Podcast - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Test 6 - 13 Apr 2026
Daily
14/04/2026
You are currently impersonating Nikolay Yankov
Clear
Filter URLs
Pause/Resume recording network log
New Request
Search
Request Blocking
Disable Cache
Disable Cache
No Throttling
Network Settings
All
HTML
CSS
JS
XHR
Fonts
Images
Media
WS
Other
Status
Status
Method
Method
Domain
Domain
File
File
Initiator
Initiator
Type
Type
Transferred
Transferred
Size
Size
0 ms
0 ms
200
POST
o36719.ingest.sentry.io
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
fetch
json
500 B
2 B
36 ms
200
POST
o36719.ingest.sentry.io
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
sentry-B6v5fcc5.js
:2
(fetch)
json
500 B
2 B
36 ms
200
GET
app.staging.jiminny.com
search?status[]=completed&sort_by=dateHeld&sort_direction=desc&exclude[]=stats&only_recorded=1&user_id[]=c4fb084a-b33a-46fe-904b-351b592a4b0f
xhr
json
6.28 kB
24.21 kB
786 ms
200
GET
app.staging.jiminny.com
automated-reports
xhr
json
4.03 kB
6.13 kB
733 ms
200
GET
app.staging.jiminny.com
recent
xhr
json
5.65 kB
15.26 kB
549 ms
200
GET
app.staging.jiminny.com
integrations
xhr
json
3.83 kB
5.53 kB
867 ms
200
GET
find.userpilot.io
NX-094be170
xhr
json
cached
62 B
0 ms
200
POST
app.staging.jiminny.com
authenticate
xhr
json
3.11 kB
96 B
470 ms
200
GET
app.staging.jiminny.com
automated-reports?page=1&sort_column=generated_at&sort_direction=desc&report_type[]=exec_summary
xhr
json
3.71 kB
2.77 kB
248 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
587.01 kB
0 B
559 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
3.44 kB
0 B
152 ms
200
GET
app.staging.jiminny.com
automated-reports?page=1&sort_column=generated_at&sort_direction=desc
xhr
json
4.03 kB
6.13 kB
507 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
6.14 kB
0 B
174 ms
200
POST
r.logr-in.com
i?a=ponxaf/platform-staging&r=6-019db076-935d-752f-a86a-815df5ba66f7&t=acafc3b4-a7db-4547-8fb4-64f393c9c62e&s=0&hr=t&u=c4fb084a-b33a-46fe-904b-351b592a4b0f&is=IDENTIFIED&rs=0,t
xhr
json
227.95 kB
0 B
418 ms
Status
Status
200
200
200
200
200
200
200
200
Method
Method
POST
POST
GET
GET
GET
GET
GET
POST
Domain
Domain
o36719.ingest.sentry.io
o36719.ingest.sentry.io
app.staging.jiminny.com
app.staging.jiminny.com
app.staging.jiminny.com
app.staging.jiminny.com
find.userpilot.io
app.staging.jiminny.com
File
File
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
search?status[]=completed&sort_by=dateHeld&sort_direction=desc&exclude[]=stats&only_recorded=1&user_id[]=c4fb084a-b33a-46fe-904b-351b592a4b0f
automated-reports
recent
integrations...
|
67250
|
|
67254
|
1514
|
0
|
2026-04-21T15:30:35.258702+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776785435258_m1.jpg...
|
Firefox
|
Jiminny — Work
|
1
|
app.staging.jiminny.com/ai-reports
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Platform Sprint 2 Q2 - Platform Team - Scrum Board Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira
Project Phoenix – Figma
Project Phoenix – Figma
[JY-20372] AI Reports > Empty page design and promotion - Jira
[JY-20372] AI Reports > Empty page design and promotion - Jira
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Jiminny MCP Connector - Product - Confluence
Jiminny MCP Connector - Product - Confluence
Jiminny Mail
Jiminny Mail
[JY-20500] Batch initial sync for Salesforce - Jira
[JY-20500] Batch initial sync for Salesforce - Jira
Feed — jiminny — Sentry
Feed — jiminny — Sentry
Jiminny
Jiminny
Pipelines - jiminny/app
Pipelines - jiminny/app
Formalize
Formalize
[SRD-6793] Les Mills activity types not pulling in - Jira
[SRD-6793] Les Mills activity types not pulling in - Jira
Search results: calendar | Jiminny Help Center
Search results: calendar | Jiminny Help Center
Jiminny
Jiminny
Jiminny
Jiminny
Close tab
Edit - Engineering - Confluence
Edit - Engineering - Confluence
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
JY-18909-automated-reports-ask-jiminny ■ 874667
28
28
AI Reports
AI Reports
Ask Jiminny reports
Ask Jiminny reports
Report name
Period
Report Type Report Type
Report Type
Report Type
Clear all
NAME
FREQUENCY
SHARED
DATE
ACTIONS
Test 6 - 15 Apr 2026
Daily
16/04/2026
Test 7 - 15 Apr 2026
Daily
16/04/2026
Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Exec Summary Podcast - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Test 6 - 13 Apr 2026
Daily...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20372] AI Reports > Empty page design and promotion - Jira","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20372] AI Reports > Empty page design and promotion - Jira","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny MCP Connector - Product - Confluence","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny MCP Connector - Product - Confluence","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny Mail","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny Mail","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20500] Batch initial sync for Salesforce - Jira","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20500] Batch initial sync for Salesforce - Jira","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Feed — jiminny — Sentry","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Feed — jiminny — Sentry","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Pipelines - jiminny/app","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pipelines - jiminny/app","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Formalize","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Formalize","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[SRD-6793] Les Mills activity types not pulling in - Jira","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[SRD-6793] Les Mills activity types not pulling in - Jira","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Search results: calendar | Jiminny Help Center","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Search results: calendar | Jiminny Help Center","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Jiminny","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Edit - Engineering - Confluence","depth":4,"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Edit - Engineering - Confluence","depth":5,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Tabs from other devices","depth":6,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-18909-automated-reports-ask-jiminny ■ 874667","depth":9,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"28","depth":12,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"28","depth":14,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"AI Reports","depth":13,"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"AI Reports","depth":14,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Ask Jiminny reports","depth":13,"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ask Jiminny reports","depth":14,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXTextField","text":"Report name","depth":17,"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Period","depth":20,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXComboBox","text":"Report Type Report Type","depth":16,"value":"Report Type Report Type","help_text":"","role_description":"combo box","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Report Type","depth":18,"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Report Type","depth":19,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Clear all","depth":13,"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"NAME","depth":16,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"FREQUENCY","depth":16,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"SHARED","depth":16,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"DATE","depth":16,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"ACTIONS","depth":16,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Test 6 - 15 Apr 2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Daily","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"16/04/2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Test 7 - 15 Apr 2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Daily","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"16/04/2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15/04/2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exec Summary Podcast - 1 Nov 2024 - 17 Dec 2025 - All","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15/04/2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15/04/2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Test 6 - 13 Apr 2026","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Daily","depth":17,"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
5350772623293693273
|
-7054894965512803067
|
visual_change
|
accessibility
|
NULL
|
Platform Sprint 2 Q2 - Platform Team - Scrum Board Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira
Project Phoenix – Figma
Project Phoenix – Figma
[JY-20372] AI Reports > Empty page design and promotion - Jira
[JY-20372] AI Reports > Empty page design and promotion - Jira
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Jiminny MCP Connector - Product - Confluence
Jiminny MCP Connector - Product - Confluence
Jiminny Mail
Jiminny Mail
[JY-20500] Batch initial sync for Salesforce - Jira
[JY-20500] Batch initial sync for Salesforce - Jira
Feed — jiminny — Sentry
Feed — jiminny — Sentry
Jiminny
Jiminny
Pipelines - jiminny/app
Pipelines - jiminny/app
Formalize
Formalize
[SRD-6793] Les Mills activity types not pulling in - Jira
[SRD-6793] Les Mills activity types not pulling in - Jira
Search results: calendar | Jiminny Help Center
Search results: calendar | Jiminny Help Center
Jiminny
Jiminny
Jiminny
Jiminny
Close tab
Edit - Engineering - Confluence
Edit - Engineering - Confluence
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
JY-18909-automated-reports-ask-jiminny ■ 874667
28
28
AI Reports
AI Reports
Ask Jiminny reports
Ask Jiminny reports
Report name
Period
Report Type Report Type
Report Type
Report Type
Clear all
NAME
FREQUENCY
SHARED
DATE
ACTIONS
Test 6 - 15 Apr 2026
Daily
16/04/2026
Test 7 - 15 Apr 2026
Daily
16/04/2026
Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Exec Summary Podcast - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Test 6 - 13 Apr 2026
Daily...
|
67252
|
|
67255
|
1515
|
0
|
2026-04-21T15:30:36.520689+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776785436520_m2.jpg...
|
Firefox
|
Jiminny — Work
|
1
|
app.staging.jiminny.com/ai-reports
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Platform Sprint 2 Q2 - Platform Team - Scrum Board Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira
Project Phoenix – Figma
Project Phoenix – Figma
[JY-20372] AI Reports > Empty page design and promotion - Jira
[JY-20372] AI Reports > Empty page design and promotion - Jira
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Jiminny MCP Connector - Product - Confluence
Jiminny MCP Connector - Product - Confluence
Jiminny Mail
Jiminny Mail
[JY-20500] Batch initial sync for Salesforce - Jira
[JY-20500] Batch initial sync for Salesforce - Jira
Feed — jiminny — Sentry
Feed — jiminny — Sentry
Jiminny
Jiminny
Pipelines - jiminny/app
Pipelines - jiminny/app
Formalize
Formalize
[SRD-6793] Les Mills activity types not pulling in - Jira
[SRD-6793] Les Mills activity types not pulling in - Jira
Search results: calendar | Jiminny Help Center
Search results: calendar | Jiminny Help Center
Jiminny
Jiminny
Jiminny
Jiminny
Close tab
Edit - Engineering - Confluence
Edit - Engineering - Confluence
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
JY-18909-automated-reports-ask-jiminny ■ 874667
28
28
AI Reports
AI Reports
Ask Jiminny reports
Ask Jiminny reports
Report name
Period
Report Type Report Type
Report Type
Report Type
Clear all
NAME
FREQUENCY
SHARED
DATE
ACTIONS
Test 6 - 15 Apr 2026
Daily
16/04/2026
Test 7 - 15 Apr 2026
Daily
16/04/2026
Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Exec Summary Podcast - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Test 6 - 13 Apr 2026
Daily
14/04/2026
You are currently impersonating Nikolay Yankov
Settings
Settings
Back To My Account
Back To My Account
Kiosk
Kiosk
Organization
Organization
Profile
Profile
Logout
Logout
Clear
Filter URLs
Pause/Resume recording network log
New Request
Search
Request Blocking
Disable Cache
Disable Cache
No Throttling
Network Settings
All
HTML
CSS
JS
XHR
Fonts
Images
Media
WS
Other
Status
Status
Method
Method
Domain
Domain
File
File
Initiator
Initiator
Type
Type
Transferred
Transferred
Size
Size
0 ms
0 ms
200
POST
o36719.ingest.sentry.io
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
fetch
json
500 B
2 B
36 ms
200
POST
o36719.ingest.sentry.io
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0...
|
[{"role":"AXRadioButton","text [{"role":"AXRadioButton","text":"Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira","depth":4,"bounds":{"left":0.0018284575,"top":0.0518755,"width":0.07596409,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"bounds":{"left":0.0,"top":0.09497207,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"bounds":{"left":0.013297873,"top":0.10614525,"width":0.041888297,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20372] AI Reports > Empty page design and promotion - Jira","depth":4,"bounds":{"left":0.0,"top":0.12769353,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20372] AI Reports > Empty page design and promotion - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.13886672,"width":0.11319814,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"bounds":{"left":0.0,"top":0.16041501,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"bounds":{"left":0.013297873,"top":0.17158818,"width":0.041888297,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"bounds":{"left":0.0,"top":0.19313647,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"bounds":{"left":0.013297873,"top":0.20430966,"width":0.041888297,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Project Phoenix – Figma","depth":4,"bounds":{"left":0.0,"top":0.22585794,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Project Phoenix – Figma","depth":5,"bounds":{"left":0.013297873,"top":0.23703113,"width":0.041888297,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny MCP Connector - Product - Confluence","depth":4,"bounds":{"left":0.0,"top":0.2585794,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny MCP Connector - Product - Confluence","depth":5,"bounds":{"left":0.013297873,"top":0.2697526,"width":0.08294548,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny Mail","depth":4,"bounds":{"left":0.0,"top":0.29130086,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny Mail","depth":5,"bounds":{"left":0.013297873,"top":0.30247405,"width":0.02144282,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[JY-20500] Batch initial sync for Salesforce - Jira","depth":4,"bounds":{"left":0.0,"top":0.32402235,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[JY-20500] Batch initial sync for Salesforce - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.33519554,"width":0.08610372,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Feed — jiminny — Sentry","depth":4,"bounds":{"left":0.0,"top":0.3567438,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Feed — jiminny — Sentry","depth":5,"bounds":{"left":0.013297873,"top":0.367917,"width":0.042719416,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"bounds":{"left":0.0,"top":0.38946527,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"bounds":{"left":0.013297873,"top":0.40063846,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Pipelines - jiminny/app","depth":4,"bounds":{"left":0.0,"top":0.42218676,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Pipelines - jiminny/app","depth":5,"bounds":{"left":0.013297873,"top":0.43335995,"width":0.039228722,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Formalize","depth":4,"bounds":{"left":0.0,"top":0.45490822,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Formalize","depth":5,"bounds":{"left":0.013297873,"top":0.4660814,"width":0.016788565,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"[SRD-6793] Les Mills activity types not pulling in - Jira","depth":4,"bounds":{"left":0.0,"top":0.48762968,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"[SRD-6793] Les Mills activity types not pulling in - Jira","depth":5,"bounds":{"left":0.013297873,"top":0.49880287,"width":0.09524601,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Search results: calendar | Jiminny Help Center","depth":4,"bounds":{"left":0.0,"top":0.5203512,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Search results: calendar | Jiminny Help Center","depth":5,"bounds":{"left":0.013297873,"top":0.53152436,"width":0.080119684,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"bounds":{"left":0.0,"top":0.55307263,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Jiminny","depth":5,"bounds":{"left":0.013297873,"top":0.5642458,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXRadioButton","text":"Jiminny","depth":4,"bounds":{"left":0.0,"top":0.5857941,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true},{"role":"AXStaticText","text":"Jiminny","depth":5,"bounds":{"left":0.013297873,"top":0.5969673,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Close tab","depth":5,"bounds":{"left":0.06732048,"top":0.59297687,"width":0.007978723,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXRadioButton","text":"Edit - Engineering - Confluence","depth":4,"bounds":{"left":0.0,"top":0.61851555,"width":0.07962101,"height":0.032721467},"help_text":"","role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Edit - Engineering - Confluence","depth":5,"bounds":{"left":0.013297873,"top":0.62968874,"width":0.054853722,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"New Tab","depth":4,"bounds":{"left":0.0028257978,"top":0.6528332,"width":0.07413564,"height":0.025538707},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Customize sidebar","depth":6,"bounds":{"left":0.0028257978,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open Google Gemini (⌃X)","depth":6,"bounds":{"left":0.013796543,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Tabs from other devices","depth":6,"bounds":{"left":0.024933511,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open history (⇧⌘H)","depth":6,"bounds":{"left":0.036070477,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Open bookmarks (⌘B)","depth":6,"bounds":{"left":0.04720745,"top":0.97007185,"width":0.010638298,"height":0.025538707},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"JY-18909-automated-reports-ask-jiminny ■ 874667","depth":9,"bounds":{"left":0.08028591,"top":0.9860335,"width":0.10056516,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"28","depth":12,"bounds":{"left":0.08228058,"top":0.91380686,"width":0.015957447,"height":0.035115723},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"28","depth":14,"bounds":{"left":0.09059176,"top":0.9173983,"width":0.004654255,"height":0.011971269},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"AI Reports","depth":13,"bounds":{"left":0.10887633,"top":0.06943336,"width":0.031416222,"height":0.019553073},"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"AI Reports","depth":14,"bounds":{"left":0.10887633,"top":0.06943336,"width":0.031416222,"height":0.019553073},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Ask Jiminny reports","depth":13,"bounds":{"left":0.62682843,"top":0.06464485,"width":0.059341755,"height":0.028731046},"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Ask Jiminny reports","depth":14,"bounds":{"left":0.64045876,"top":0.07222666,"width":0.04105718,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXTextField","text":"Report name","depth":17,"bounds":{"left":0.12167553,"top":0.10933759,"width":0.058011968,"height":0.019952115},"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Period","depth":20,"bounds":{"left":0.19963431,"top":0.114924185,"width":0.012799202,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXComboBox","text":"Report Type Report Type","depth":16,"bounds":{"left":0.26944813,"top":0.10933759,"width":0.06615692,"height":0.019952115},"value":"Report Type Report Type","help_text":"","role_description":"combo box","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Report Type","depth":18,"help_text":"","role_description":"text field","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Report Type","depth":19,"bounds":{"left":0.26944813,"top":0.11292897,"width":0.023603724,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Clear all","depth":13,"bounds":{"left":0.34192154,"top":0.112529926,"width":0.028424202,"height":0.015961692},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"NAME","depth":16,"bounds":{"left":0.10854388,"top":0.1660016,"width":0.012965426,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"FREQUENCY","depth":16,"bounds":{"left":0.35854387,"top":0.1660016,"width":0.026263298,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"SHARED","depth":16,"bounds":{"left":0.4418218,"top":0.1660016,"width":0.017453458,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"DATE","depth":16,"bounds":{"left":0.52509975,"top":0.1660016,"width":0.011136968,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"ACTIONS","depth":16,"bounds":{"left":0.6085439,"top":0.1660016,"width":0.019115692,"height":0.012769354},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Test 6 - 15 Apr 2026","depth":17,"bounds":{"left":0.12184176,"top":0.21268955,"width":0.042386968,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Daily","depth":17,"bounds":{"left":0.35854387,"top":0.21268955,"width":0.010139627,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"16/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.21268955,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Test 7 - 15 Apr 2026","depth":17,"bounds":{"left":0.12184176,"top":0.25977653,"width":0.042386968,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Daily","depth":17,"bounds":{"left":0.35854387,"top":0.25977653,"width":0.010139627,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"16/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.25977653,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All","depth":17,"bounds":{"left":0.12184176,"top":0.30686352,"width":0.0987367,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"bounds":{"left":0.35854387,"top":0.30686352,"width":0.016456118,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.30686352,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exec Summary Podcast - 1 Nov 2024 - 17 Dec 2025 - All","depth":17,"bounds":{"left":0.12184176,"top":0.35395053,"width":0.1165226,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"bounds":{"left":0.35854387,"top":0.35395053,"width":0.016456118,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.35395053,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All","depth":17,"bounds":{"left":0.12184176,"top":0.4010375,"width":0.0987367,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"One-Off","depth":17,"bounds":{"left":0.35854387,"top":0.4010375,"width":0.016456118,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"15/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.4010375,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Test 6 - 13 Apr 2026","depth":17,"bounds":{"left":0.12184176,"top":0.4481245,"width":0.042386968,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Daily","depth":17,"bounds":{"left":0.35854387,"top":0.4481245,"width":0.010139627,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"14/04/2026","depth":17,"bounds":{"left":0.52509975,"top":0.4481245,"width":0.024268618,"height":0.0131683955},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"You are currently impersonating Nikolay Yankov","depth":11,"bounds":{"left":0.33194813,"top":0.053072624,"width":0.09940159,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXHeading","text":"Settings","depth":10,"bounds":{"left":0.1015625,"top":0.7717478,"width":0.0653258,"height":0.028731046},"help_text":"","role_description":"heading","subrole":"AXUnknown"},{"role":"AXStaticText","text":"Settings","depth":11,"bounds":{"left":0.10488697,"top":0.77853155,"width":0.019115692,"height":0.01556265},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Back To My Account","depth":11,"bounds":{"left":0.1015625,"top":0.8044693,"width":0.0653258,"height":0.035115723},"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Back To My Account","depth":12,"bounds":{"left":0.119847074,"top":0.8152434,"width":0.042054523,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Kiosk","depth":11,"bounds":{"left":0.1015625,"top":0.839585,"width":0.0653258,"height":0.035115723},"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Kiosk","depth":12,"bounds":{"left":0.119847074,"top":0.85035914,"width":0.011635638,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Organization","depth":11,"bounds":{"left":0.1015625,"top":0.8747007,"width":0.0653258,"height":0.035115723},"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Organization","depth":12,"bounds":{"left":0.119847074,"top":0.88547486,"width":0.027260639,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Profile","depth":11,"bounds":{"left":0.1015625,"top":0.90981644,"width":0.0653258,"height":0.035115723},"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Profile","depth":12,"bounds":{"left":0.119847074,"top":0.9205906,"width":0.013962766,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXLink","text":"Logout","depth":11,"bounds":{"left":0.1015625,"top":0.94493216,"width":0.0653258,"height":0.035115723},"help_text":"","role_description":"link","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Logout","depth":12,"bounds":{"left":0.119847074,"top":0.9557063,"width":0.014461436,"height":0.013567438},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Clear","depth":16,"bounds":{"left":0.69547874,"top":0.07821229,"width":0.008643617,"height":0.015961692},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXTextField","text":"Filter URLs","depth":16,"bounds":{"left":0.70578456,"top":0.07581804,"width":0.16771941,"height":0.0207502},"help_text":"","role_description":"search text field","subrole":"AXSearchField","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Pause/Resume recording network log","depth":16,"bounds":{"left":0.8871343,"top":0.077813245,"width":0.008643617,"height":0.016759777},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"New Request","depth":16,"bounds":{"left":0.89644283,"top":0.07821229,"width":0.008643617,"height":0.015961692},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Search","depth":16,"bounds":{"left":0.90575135,"top":0.07821229,"width":0.008643617,"height":0.015961692},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Request Blocking","depth":16,"bounds":{"left":0.91505986,"top":0.07821229,"width":0.008643617,"height":0.015961692},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Disable Cache","depth":17,"bounds":{"left":0.92702794,"top":0.080207504,"width":0.004654255,"height":0.011173184},"help_text":"","role_description":"checkbox","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Disable Cache","depth":17,"bounds":{"left":0.93267953,"top":0.08100559,"width":0.024933511,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"No Throttling","depth":16,"bounds":{"left":0.96127,"top":0.07940942,"width":0.027094414,"height":0.01396648},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Network Settings","depth":16,"bounds":{"left":0.9900266,"top":0.07821229,"width":0.008643617,"height":0.015961692},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"All","depth":17,"bounds":{"left":0.6978058,"top":0.10175578,"width":0.00831117,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"HTML","depth":17,"bounds":{"left":0.7067819,"top":0.10175578,"width":0.014461436,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"CSS","depth":17,"bounds":{"left":0.7219083,"top":0.10175578,"width":0.011303191,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"JS","depth":17,"bounds":{"left":0.73387635,"top":0.10175578,"width":0.00831117,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"XHR","depth":17,"bounds":{"left":0.7428524,"top":0.10175578,"width":0.011635638,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Fonts","depth":17,"bounds":{"left":0.75515294,"top":0.10175578,"width":0.013630319,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Images","depth":17,"bounds":{"left":0.76944816,"top":0.10175578,"width":0.01662234,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Media","depth":17,"bounds":{"left":0.78673536,"top":0.10175578,"width":0.014461436,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"WS","depth":17,"bounds":{"left":0.8018617,"top":0.10175578,"width":0.009973404,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXCheckBox","text":"Other","depth":17,"bounds":{"left":0.8125,"top":0.10175578,"width":0.013796543,"height":0.01556265},"help_text":"","role_description":"toggle button","subrole":"AXToggle","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXButton","text":"Status","depth":24,"bounds":{"left":0.69414896,"top":0.121308856,"width":0.01861702,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Status","depth":26,"bounds":{"left":0.69581115,"top":0.12609737,"width":0.011136968,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Method","depth":24,"bounds":{"left":0.7130984,"top":0.121308856,"width":0.018284574,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Method","depth":26,"bounds":{"left":0.71476066,"top":0.12609737,"width":0.013297873,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Domain","depth":24,"bounds":{"left":0.73171544,"top":0.121308856,"width":0.04720745,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Domain","depth":26,"bounds":{"left":0.73337764,"top":0.12609737,"width":0.013131649,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"File","depth":24,"bounds":{"left":0.77925533,"top":0.121308856,"width":0.09325133,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"File","depth":26,"bounds":{"left":0.7809175,"top":0.12609737,"width":0.006150266,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Initiator","depth":24,"bounds":{"left":0.8728391,"top":0.121308856,"width":0.03723404,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Initiator","depth":26,"bounds":{"left":0.87450135,"top":0.12609737,"width":0.013297873,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Type","depth":24,"bounds":{"left":0.9104056,"top":0.121308856,"width":0.018284574,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Type","depth":26,"bounds":{"left":0.91206783,"top":0.12609737,"width":0.008477394,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Transferred","depth":24,"bounds":{"left":0.9290226,"top":0.121308856,"width":0.0038231383,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Transferred","depth":26,"bounds":{"left":0.93068486,"top":0.12609737,"width":0.020113032,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"Size","depth":24,"bounds":{"left":0.9331782,"top":0.121308856,"width":0.056017287,"height":0.01915403},"help_text":"","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"Size","depth":26,"bounds":{"left":0.93484044,"top":0.12609737,"width":0.00731383,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXButton","text":"0 ms","depth":24,"bounds":{"left":0.98952794,"top":0.121308856,"width":0.010472059,"height":0.01915403},"help_text":"Timeline","role_description":"button","subrole":"AXUnknown","is_enabled":true,"is_focused":false,"is_selected":false},{"role":"AXStaticText","text":"0 ms","depth":27,"bounds":{"left":0.9908577,"top":0.12849163,"width":0.0066489363,"height":0.007980846},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.14604948,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"bounds":{"left":0.71476066,"top":0.14565043,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"o36719.ingest.sentry.io","depth":24,"bounds":{"left":0.7436835,"top":0.14565043,"width":0.040724736,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0","depth":25,"bounds":{"left":0.7809175,"top":0.14565043,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"fetch","depth":24,"bounds":{"left":0.87450135,"top":0.14565043,"width":0.008976064,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"json","depth":24,"bounds":{"left":0.91206783,"top":0.14565043,"width":0.0071476065,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"500 B","depth":24,"bounds":{"left":0.93068486,"top":0.14565043,"width":0.010305851,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"2 B","depth":24,"bounds":{"left":0.9822141,"top":0.14565043,"width":0.0056515955,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"36 ms","depth":25,"bounds":{"left":0.9913564,"top":0.14644852,"width":0.008643627,"height":0.008778931},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"200","depth":24,"bounds":{"left":0.69647604,"top":0.16520351,"width":0.006482713,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"POST","depth":24,"bounds":{"left":0.71476066,"top":0.16480447,"width":0.009807181,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"o36719.ingest.sentry.io","depth":24,"bounds":{"left":0.7436835,"top":0.16480447,"width":0.040724736,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"},{"role":"AXStaticText","text":"/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0","depth":25,"bounds":{"left":0.7809175,"top":0.16480447,"width":0.21908247,"height":0.010774142},"help_text":"","role_description":"text","subrole":"AXUnknown"}]...
|
8471453117031955726
|
-4750265852552878843
|
click
|
accessibility
|
NULL
|
Platform Sprint 2 Q2 - Platform Team - Scrum Board Platform Sprint 2 Q2 - Platform Team - Scrum Board - Jira
Project Phoenix – Figma
Project Phoenix – Figma
[JY-20372] AI Reports > Empty page design and promotion - Jira
[JY-20372] AI Reports > Empty page design and promotion - Jira
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Project Phoenix – Figma
Jiminny MCP Connector - Product - Confluence
Jiminny MCP Connector - Product - Confluence
Jiminny Mail
Jiminny Mail
[JY-20500] Batch initial sync for Salesforce - Jira
[JY-20500] Batch initial sync for Salesforce - Jira
Feed — jiminny — Sentry
Feed — jiminny — Sentry
Jiminny
Jiminny
Pipelines - jiminny/app
Pipelines - jiminny/app
Formalize
Formalize
[SRD-6793] Les Mills activity types not pulling in - Jira
[SRD-6793] Les Mills activity types not pulling in - Jira
Search results: calendar | Jiminny Help Center
Search results: calendar | Jiminny Help Center
Jiminny
Jiminny
Jiminny
Jiminny
Close tab
Edit - Engineering - Confluence
Edit - Engineering - Confluence
New Tab
Customize sidebar
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
JY-18909-automated-reports-ask-jiminny ■ 874667
28
28
AI Reports
AI Reports
Ask Jiminny reports
Ask Jiminny reports
Report name
Period
Report Type Report Type
Report Type
Report Type
Clear all
NAME
FREQUENCY
SHARED
DATE
ACTIONS
Test 6 - 15 Apr 2026
Daily
16/04/2026
Test 7 - 15 Apr 2026
Daily
16/04/2026
Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Exec Summary Podcast - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Exec Summary - 1 Nov 2024 - 17 Dec 2025 - All
One-Off
15/04/2026
Test 6 - 13 Apr 2026
Daily
14/04/2026
You are currently impersonating Nikolay Yankov
Settings
Settings
Back To My Account
Back To My Account
Kiosk
Kiosk
Organization
Organization
Profile
Profile
Logout
Logout
Clear
Filter URLs
Pause/Resume recording network log
New Request
Search
Request Blocking
Disable Cache
Disable Cache
No Throttling
Network Settings
All
HTML
CSS
JS
XHR
Fonts
Images
Media
WS
Other
Status
Status
Method
Method
Domain
Domain
File
File
Initiator
Initiator
Type
Type
Transferred
Transferred
Size
Size
0 ms
0 ms
200
POST
o36719.ingest.sentry.io
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0
fetch
json
500 B
2 B
36 ms
200
POST
o36719.ingest.sentry.io
/api/5627310/envelope/?sentry_version=7&sentry_key=8cba05ef3e3f4f68a86d3a6d31465998&sentry_client=sentry.javascript.vue/10.43.0...
|
NULL
|
|
67394
|
NULL
|
0
|
2026-04-21T15:35:26.471690+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776785726471_m2.jpg...
|
Slack
|
Aneliya Angelova, Nikolay Yankov, Steliyan Georgie Aneliya Angelova, Nikolay Yankov, Steliyan Georgiev (DM) - Jiminny Inc - 1 new item - Slack...
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Aneliya Angelova
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Nikolay Yankov
Today at 5:55:21 PM
5:55 PM
kiosk-нах се с Аделина да видя за
Shared By
и ми направи впечатление, че тя като user, с когото е шернато, тя вижда и всички останли с които е шернато (в response-a на request-a, не в UI)
Мисля си, че ще е добре да го запечатаме това да не expose-ва информация за всички с които е шернато
какво мислите?
Untitled.png
Toggle file
Untitled.png
Download Untitled.png
Share file: Untitled.png
View canvas details
More actions
Aneliya Angelova
Today at 6:15:00 PM
6:15 PM
съгласна съм с Ники
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:18:27 PM
6:18 PM
аз няма претенции, мога да ги пропусна ако user не е creator
1 reaction, react with +1 emoji
1
Add reaction…
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Nikolay Yankov
Today at 6:21:15 PM
6:21 PM
обаче не знам дали Галя ще го иска това, преди колоната се казваше recipients
и показваше всички които получават..
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:22:26 PM
6:22 PM
при репорти които не са Ask Jiminny там никога няма да е creator
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
New
Aneliya Angelova
Today at 6:26:59 PM
6:26 PM
pitah Galq - според нея нямало нужда да се крие
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:27:04 PM
6:27
от рекуеста
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:27:11 PM
6:27
не било конфиденциално
1 reaction, react with +1 emoji
1
Add reaction…
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:35:01 PM
6:35 PM
качено е
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Todor Stamatov, Direct Message, 1 of 15 suggestions
Aneliya Angelova is typing...
|
[{"role":"AXPopUpButton","text [{"role":"AXPopUpButton","text":"Switch workspaces… (Jiminny Inc) Has new messages","depth":14,"bounds":{"left":0.0056515955,"top":0.058260176,"width":0.011968086,"height":0.028731046},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"Home","depth":14,"bounds":{"left":0.0029920214,"top":0.10055866,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Home","depth":16,"bounds":{"left":0.0066489363,"top":0.13806863,"width":0.009973404,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"DMs","depth":14,"bounds":{"left":0.0029920214,"top":0.15482841,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"DMs","depth":16,"bounds":{"left":0.0076462766,"top":0.19233839,"width":0.007978723,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Activity","depth":14,"bounds":{"left":0.0029920214,"top":0.20909816,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Activity","depth":16,"bounds":{"left":0.004986702,"top":0.24660814,"width":0.012965426,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":14,"bounds":{"left":0.0029920214,"top":0.26336792,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":16,"bounds":{"left":0.0076462766,"top":0.3008779,"width":0.0076462766,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Later","depth":14,"bounds":{"left":0.0029920214,"top":0.31763768,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Later","depth":16,"bounds":{"left":0.00731383,"top":0.35514766,"width":0.008643617,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"More…","depth":14,"bounds":{"left":0.0029920214,"top":0.3719074,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More","depth":16,"bounds":{"left":0.006981383,"top":0.4094174,"width":0.008976064,"height":0.0103751},"role_description":"text"},{"role":"AXStaticText","text":"Unreads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Threads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Huddles","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Drafts & sent","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Directories","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-x-integration-app","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-inner-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"ai-chapter","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"alerts","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"backend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"c-learning-people","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"confusion-clinic","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"curiosity_lab","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"engineering","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"frontend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"general","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"infra-changes","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-bg","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-copilot-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-zoom-phone-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-tickets","depth":23,"bounds":{"left":0.042220745,"top":0.09736632,"width":0.034906916,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"product_launches","depth":23,"bounds":{"left":0.042220745,"top":0.11971269,"width":0.03856383,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"random","depth":23,"bounds":{"left":0.042220745,"top":0.14205906,"width":0.01662234,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"releases","depth":23,"bounds":{"left":0.042220745,"top":0.16440542,"width":0.01761968,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"support","depth":23,"bounds":{"left":0.042220745,"top":0.1867518,"width":0.016954787,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"thank-yous","depth":23,"bounds":{"left":0.042220745,"top":0.20909816,"width":0.024268618,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"the_people_of_jiminny","depth":23,"bounds":{"left":0.042220745,"top":0.23144454,"width":0.04488032,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"bounds":{"left":0.042220745,"top":0.28411812,"width":0.03756649,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"bounds":{"left":0.07945479,"top":0.28411812,"width":0.0063164895,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"bounds":{"left":0.08211436,"top":0.28411812,"width":0.014295213,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"bounds":{"left":0.09607713,"top":0.30167598,"width":0.0003324468,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Steliyan Georgiev","depth":23,"bounds":{"left":0.09607713,"top":0.30167598,"width":0.0003324468,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"bounds":{"left":0.042220745,"top":0.3064645,"width":0.03756649,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Mario Georgiev","depth":23,"bounds":{"left":0.042220745,"top":0.32881084,"width":0.033909574,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"bounds":{"left":0.042220745,"top":0.35115722,"width":0.032912236,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Todor Stamatov","depth":23,"bounds":{"left":0.042220745,"top":0.3735036,"width":0.034242023,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Gabriela Dureva","depth":23,"bounds":{"left":0.042220745,"top":0.39584997,"width":0.03523936,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Petko Kashinski","depth":23,"bounds":{"left":0.042220745,"top":0.41819632,"width":0.034242023,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Vasil Vasilev","depth":23,"bounds":{"left":0.042220745,"top":0.4405427,"width":0.026263298,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Nikolov","depth":23,"bounds":{"left":0.042220745,"top":0.46288908,"width":0.034242023,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Galya Dimitrova","depth":23,"bounds":{"left":0.042220745,"top":0.48523542,"width":0.034906916,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Stefka Stoyanova","depth":23,"bounds":{"left":0.042220745,"top":0.50758183,"width":0.03756649,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tomov","depth":23,"bounds":{"left":0.042220745,"top":0.52992815,"width":0.030585106,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tanev","depth":23,"bounds":{"left":0.042220745,"top":0.5522745,"width":0.028922873,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Ivanov","depth":23,"bounds":{"left":0.042220745,"top":0.5746209,"width":0.031914894,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Ves","depth":23,"bounds":{"left":0.042220745,"top":0.5969673,"width":0.0076462766,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Jira Cloud","depth":23,"bounds":{"left":0.042220745,"top":0.64964086,"width":0.022273935,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Toast","depth":23,"bounds":{"left":0.042220745,"top":0.67198724,"width":0.011635638,"height":0.014365523},"role_description":"text"},{"role":"AXRadioButton","text":"Messages","depth":17,"bounds":{"left":0.10206117,"top":0.09177973,"width":0.030585106,"height":0.030327214},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Messages","depth":19,"bounds":{"left":0.111369684,"top":0.10055866,"width":0.01861702,"height":0.012769354},"role_description":"text"},{"role":"AXRadioButton","text":"Add canvas","depth":18,"bounds":{"left":0.13397606,"top":0.09177973,"width":0.033909574,"height":0.030327214},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Add canvas","depth":20,"bounds":{"left":0.14328457,"top":0.10055866,"width":0.021941489,"height":0.012769354},"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":17,"bounds":{"left":0.16921543,"top":0.09177973,"width":0.020944148,"height":0.030327214},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":19,"bounds":{"left":0.17852394,"top":0.10055866,"width":0.008976064,"height":0.012769354},"role_description":"text"},{"role":"AXPopUpButton","text":"Add and Edit Channel Tabs","depth":17,"bounds":{"left":0.19115691,"top":0.09177973,"width":0.010970744,"height":0.030327214},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Canvas","depth":17,"bounds":{"left":0.096409574,"top":0.0518755,"width":0.015625,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"List","depth":17,"bounds":{"left":0.096409574,"top":0.0518755,"width":0.0076462766,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Folder","depth":17,"bounds":{"left":0.096409574,"top":0.0518755,"width":0.013962766,"height":0.0007980846},"role_description":"text"},{"role":"AXPopUpButton","text":"Jump to date","depth":23,"bounds":{"left":0.15026596,"top":0.12689546,"width":0.025265958,"height":0.022346368},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Nikolay Yankov","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:55:21 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:55 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"kiosk-нах се с Аделина да видя за","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"Shared By","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"и ми направи впечатление, че тя като user, с когото е шернато, тя вижда и всички останли с които е шернато (в response-a на request-a, не в UI)","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"Мисля си, че ще е добре да го запечатаме това да не expose-ва информация за всички с които е шернато","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"какво мислите?","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"Untitled.png","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"","depth":25,"role_description":"text"},{"role":"AXButton","text":"Toggle file","depth":25,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXLink","text":"Untitled.png","depth":27,"bounds":{"left":0.11801862,"top":0.11572227,"width":0.1043883,"height":0.05586592},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Download Untitled.png","depth":28,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Share file: Untitled.png","depth":28,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View canvas details","depth":28,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":28,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"bounds":{"left":0.11801862,"top":0.18036711,"width":0.038896278,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.15658244,"top":0.1819633,"width":0.0029920214,"height":0.015163607},"role_description":"text"},{"role":"AXLink","text":"Today at 6:15:00 PM","depth":24,"bounds":{"left":0.15924202,"top":0.18435754,"width":0.015292553,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:15 PM","depth":25,"bounds":{"left":0.15924202,"top":0.18435754,"width":0.015292553,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"съгласна съм с Ники","depth":25,"bounds":{"left":0.11801862,"top":0.19952115,"width":0.04720745,"height":0.015163607},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.16679968,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.16679968,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.16679968,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.16679968,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.16679968,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.16679968,"width":0.0003324468,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.16679968,"width":0.0003324468,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.16679968,"width":0.0003324468,"height":0.026336791},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"bounds":{"left":0.11801862,"top":0.22186752,"width":0.030917553,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.14860372,"top":0.22346368,"width":0.0029920214,"height":0.015163607},"role_description":"text"},{"role":"AXLink","text":"Today at 6:18:27 PM","depth":24,"bounds":{"left":0.1512633,"top":0.22585794,"width":0.015292553,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:18 PM","depth":25,"bounds":{"left":0.1512633,"top":0.22585794,"width":0.015292553,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"аз няма претенции, мога да ги пропусна ако user не е creator","depth":25,"bounds":{"left":0.11801862,"top":0.24102154,"width":0.10139628,"height":0.032721467},"role_description":"text"},{"role":"AXCheckBox","text":"1 reaction, react with +1 emoji","depth":25,"bounds":{"left":0.11801862,"top":0.27773345,"width":0.014295213,"height":0.019952115},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"1","depth":26,"bounds":{"left":0.12732713,"top":0.28172386,"width":0.0023271276,"height":0.011971269},"role_description":"text"},{"role":"AXButton","text":"Add reaction…","depth":25,"bounds":{"left":0.13331117,"top":0.27773345,"width":0.011635638,"height":0.019952115},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.20830008,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.20830008,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.20830008,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.20830008,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.20830008,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.20830008,"width":0.0003324468,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.20830008,"width":0.0003324468,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.20830008,"width":0.0003324468,"height":0.026336791},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Nikolay Yankov","depth":24,"bounds":{"left":0.11801862,"top":0.3064645,"width":0.034242023,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.15226063,"top":0.30806065,"width":0.0026595744,"height":0.015163607},"role_description":"text"},{"role":"AXLink","text":"Today at 6:21:15 PM","depth":24,"bounds":{"left":0.1549202,"top":0.3104549,"width":0.014960106,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:21 PM","depth":25,"bounds":{"left":0.1549202,"top":0.3104549,"width":0.014960106,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"обаче не знам дали Галя ще го иска това, преди колоната се казваше recipients","depth":25,"bounds":{"left":0.11801862,"top":0.3256185,"width":0.0944149,"height":0.032721467},"role_description":"text"},{"role":"AXStaticText","text":"и показваше всички които получават..","depth":25,"bounds":{"left":0.11801862,"top":0.36073422,"width":0.08743351,"height":0.015163607},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.29289705,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.29289705,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.29289705,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.29289705,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.29289705,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.29289705,"width":0.0003324468,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.29289705,"width":0.0003324468,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.29289705,"width":0.0003324468,"height":0.026336791},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"bounds":{"left":0.11801862,"top":0.3830806,"width":0.030917553,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.14860372,"top":0.38467678,"width":0.0029920214,"height":0.015163607},"role_description":"text"},{"role":"AXLink","text":"Today at 6:22:26 PM","depth":24,"bounds":{"left":0.1512633,"top":0.38707104,"width":0.015292553,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:22 PM","depth":25,"bounds":{"left":0.1512633,"top":0.38707104,"width":0.015292553,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"при репорти които не са Ask Jiminny там никога няма да е creator","depth":25,"bounds":{"left":0.11801862,"top":0.40223464,"width":0.0930851,"height":0.032721467},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.36951315,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.36951315,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.36951315,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.36951315,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.36951315,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.36951315,"width":0.0003324468,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.36951315,"width":0.0003324468,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.36951315,"width":0.0003324468,"height":0.026336791},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"New","depth":22,"bounds":{"left":0.21343085,"top":0.43256184,"width":0.00930851,"height":0.012769354},"role_description":"text"},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"bounds":{"left":0.11801862,"top":0.44213888,"width":0.038896278,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.15658244,"top":0.44373503,"width":0.0029920214,"height":0.015163607},"role_description":"text"},{"role":"AXLink","text":"Today at 6:26:59 PM","depth":24,"bounds":{"left":0.15924202,"top":0.4461293,"width":0.015292553,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:26 PM","depth":25,"bounds":{"left":0.15924202,"top":0.4461293,"width":0.015292553,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"pitah Galq - според нея нямало нужда да се крие","depth":25,"bounds":{"left":0.11801862,"top":0.4612929,"width":0.10006649,"height":0.032721467},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.42857143,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.42857143,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.42857143,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.42857143,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.42857143,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.42857143,"width":0.0003324468,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.42857143,"width":0.0003324468,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.42857143,"width":0.0003324468,"height":0.026336791},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 6:27:04 PM","depth":25,"bounds":{"left":0.107380316,"top":0.5051876,"width":0.007978723,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:27","depth":26,"bounds":{"left":0.107380316,"top":0.5051876,"width":0.007978723,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"от рекуеста","depth":25,"bounds":{"left":0.11801862,"top":0.5027933,"width":0.026928192,"height":0.015163607},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.47805268,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.47805268,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.47805268,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.47805268,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.47805268,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.47805268,"width":0.0003324468,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.47805268,"width":0.0003324468,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.47805268,"width":0.0003324468,"height":0.026336791},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 6:27:11 PM","depth":25,"bounds":{"left":0.107380316,"top":0.5291301,"width":0.007978723,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:27","depth":26,"bounds":{"left":0.107380316,"top":0.5291301,"width":0.007978723,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"не било конфиденциално","depth":25,"bounds":{"left":0.11801862,"top":0.52673584,"width":0.059507977,"height":0.015163607},"role_description":"text"},{"role":"AXCheckBox","text":"1 reaction, react with +1 emoji","depth":25,"bounds":{"left":0.11801862,"top":0.54588985,"width":0.014295213,"height":0.019952115},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"1","depth":26,"bounds":{"left":0.12732713,"top":0.54988027,"width":0.0023271276,"height":0.011971269},"role_description":"text"},{"role":"AXButton","text":"Add reaction…","depth":25,"bounds":{"left":0.13331117,"top":0.54588985,"width":0.011635638,"height":0.019952115},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.5019952,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.5019952,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.5019952,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.5019952,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.5019952,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.5019952,"width":0.0003324468,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.5019952,"width":0.0003324468,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.5019952,"width":0.0003324468,"height":0.026336791},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"bounds":{"left":0.11801862,"top":0.5746209,"width":0.030917553,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.14860372,"top":0.57621706,"width":0.0029920214,"height":0.015163607},"role_description":"text"},{"role":"AXLink","text":"Today at 6:35:01 PM","depth":24,"bounds":{"left":0.1512633,"top":0.5786113,"width":0.015292553,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:35 PM","depth":25,"bounds":{"left":0.1512633,"top":0.5786113,"width":0.015292553,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"качено е","depth":25,"bounds":{"left":0.11801862,"top":0.5937749,"width":0.019946808,"height":0.015163607},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.56105345,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.56105345,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.56105345,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.56105345,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.56105345,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.56105345,"width":0.0003324468,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.56105345,"width":0.0003324468,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.56105345,"width":0.0003324468,"height":0.026336791},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"","depth":23,"bounds":{"left":0.10372341,"top":0.6272945,"width":0.118351065,"height":0.030327214},"value":"","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Todor Stamatov, Direct Message, 1 of 15 suggestions","depth":11,"bounds":{"left":0.0,"top":0.7126895,"width":0.026263298,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova is typing","depth":11,"bounds":{"left":0.0,"top":0.7126895,"width":0.019614361,"height":0.0007980846},"role_description":"text"}]...
|
-4442207626456299371
|
-1280968573201252272
|
idle
|
hybrid
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Aneliya Angelova
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Nikolay Yankov
Today at 5:55:21 PM
5:55 PM
kiosk-нах се с Аделина да видя за
Shared By
и ми направи впечатление, че тя като user, с когото е шернато, тя вижда и всички останли с които е шернато (в response-a на request-a, не в UI)
Мисля си, че ще е добре да го запечатаме това да не expose-ва информация за всички с които е шернато
какво мислите?
Untitled.png
Toggle file
Untitled.png
Download Untitled.png
Share file: Untitled.png
View canvas details
More actions
Aneliya Angelova
Today at 6:15:00 PM
6:15 PM
съгласна съм с Ники
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:18:27 PM
6:18 PM
аз няма претенции, мога да ги пропусна ако user не е creator
1 reaction, react with +1 emoji
1
Add reaction…
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Nikolay Yankov
Today at 6:21:15 PM
6:21 PM
обаче не знам дали Галя ще го иска това, преди колоната се казваше recipients
и показваше всички които получават..
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:22:26 PM
6:22 PM
при репорти които не са Ask Jiminny там никога няма да е creator
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
New
Aneliya Angelova
Today at 6:26:59 PM
6:26 PM
pitah Galq - според нея нямало нужда да се крие
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:27:04 PM
6:27
от рекуеста
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:27:11 PM
6:27
не било конфиденциално
1 reaction, react with +1 emoji
1
Add reaction…
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:35:01 PM
6:35 PM
качено е
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Todor Stamatov, Direct Message, 1 of 15 suggestions
Aneliya Angelova is typing
ActivityMoreslackcalVIewmistonWindowJiminny ...# platform-tickets# product launches# random# releases# support# thank-yous# the_people_of jimi...ó Direct messagesE Aneliya Angelova,...P. Aneliya Angelova8. Mario Georgiev• Nikolav Yankov%: Todor StamatovP Gabriela Dureval. Petko Kashinski€. Vasil VasilevNikolav NikolovP. Galya DimitrovafR. Stefka Stoyanovaa Stoyan Tomov2. Stoyan Tanev E. Nikolay Ivanov8. Vesit: AppsG Jira CloudToasthelp& Aneliya Angelova, ...84MessagesAdd canva:Ur FilesAneliva Angelova 6:15 PMсъгласна съм с НикиLukas Kovalik 6:18 PMаз няма претенции, мога да ги пропусна акоuser He e creatorde 1Nikolav Yankov 6.21 PMобаче не знам дали Галя ще го иска това,прели колоната се казваше recivientswlOXscir ewuKKoMuroTleVeleneLukas Kovallik 6:22 PMпри репорти които не са Ask Jiminny тамникога няма лa e creatorAnelliva Angelova 6:26 PMnitah Cala - спорел нея нямало нужла ла секриеот Dekvecтaне оило конфиленциалноd 1Lukas Kovalnk 6:35 PMMessage Aneliya Angelova, Nikolay Yankov, Steli...+ AalAsk Jiminny Test Report - 13 Apr 2026Shared With Groun - 1 Jul 2025 - 15 Aor 2026Product Feedback - 1 Feb - 31 Mar 2026 - Alliminny Recinient - 1 Dec 2025 - 14 Mav 2026Jiminny Recipient - 1 Dec 2025 - 14 May 2026liminny Recinient - 1 Der 2025 - 14 Mav 2026JY-18909-automated-reports-ask-You are currently impersonating Aneliya Angelova +)• © Clear all.FREQUENCY #MonthlyMonthlyMonthlyMonthlyMonthlyWeeklyDailyDailyDailyDailyDailyDailyOne-OffOne-OffOne-OffOne-OffOne-OffSHAREDDATE21/04/202620/04/202620/04/202620/04/202620/04/202616/04/202616/04/202616/04/202616/04/202614/04/202614/04/202614/04/202631/03/202631/03/202631/03/202631/03/202631/03/2026{03 Ask Jiminny reportsACTIONSСрР.Con100% L2Tue 21 Apr 18:35:26#- InspectonConsoleDebuaaerT.. Network{? Stule Editor(PerformanceE MemorvE Storage > 099+••X.• Disable Cache No Throttling : dAll HTMI POSTIPOSTPOSTPOSTPOSTPOSTPOSTPOSTPOSTPOSTPOSTPOSTPOSTPOSTPOSTPOSTPOSTPOSTPOSTJS XHR'13 036719.ingest.se...A F 036719.ingestes....A app. staging fjiminny...app.staging.jiminny..A app.staging jiminny.A app.staging jiminny...Ar.logr-in.comA app.staging, jiminny....Ar.logr-in.comAr.logr-in.comAr.logr-in.comAr.logr-in.comr.loar-in.comapi/5627310/envelope/?sentry version=/&sentry_ke sentry-B6v5tcc5...../api/5627310/envelope/?sentry_version=7&sentry_ke sentry-B6v5fcc5...automated-reports?page=1&sort column=generated xhiiPa=ponxaf/platform-staging&r=6-019db076-93 +a xhri?a=ponxaf/platform-staging&r=6-019db076-935d-7 xhr•A xhi?a=ponxat/platform-staginq&r=6-019db076-935d-7 xhii?a=ponxaf/platform-staging&r=6-019db076-935d-7 xhri?a=ponxaf/platform-staging&r=6-019db076-935d-7 xhri?a=ponxaf/platform-staging&r=6-019db076-935d-7 xhr?a=ponxat/olatform-staqinq&r=6-019db076-935d-7 xhii?a=ponxaf/platform-staging&r=6-019db076-935d-7 xhri?a=ponxaf/platform-staging&r=6-019db076-935d-7 xhrMasponxat/olattorm-staqina&r=6-019db076-935d- xhii?a=ponxaf/platform-staging&r=6-019db076-935d-7 xhrOR | 181г28 | 36 m2B | 36 m12.94 kB 87014.84 kB 198г5.53 KB | 87762 B 0ms96 B | 4764.56 kB 273OB | 622OB 17527.02 kRГРоr22 raauocte02 07 48 12 00 MP trancforrodCinich. 1 61 minlnoucantontt nadod, 210 md...
|
67392
|
|
67395
|
NULL
|
0
|
2026-04-21T15:35:26.759818+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776785726759_m1.jpg...
|
Slack
|
Aneliya Angelova, Nikolay Yankov, Steliyan Georgie Aneliya Angelova, Nikolay Yankov, Steliyan Georgiev (DM) - Jiminny Inc - 1 new item - Slack...
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Aneliya Angelova
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Nikolay Yankov
Today at 5:55:21 PM
5:55 PM
kiosk-нах се с Аделина да видя за
Shared By
и ми направи впечатление, че тя като user, с когото е шернато, тя вижда и всички останли с които е шернато (в response-a на request-a, не в UI)
Мисля си, че ще е добре да го запечатаме това да не expose-ва информация за всички с които е шернато
какво мислите?
Untitled.png
Toggle file
Untitled.png
Download Untitled.png
Share file: Untitled.png
View canvas details
More actions
Aneliya Angelova
Today at 6:15:00 PM
6:15 PM
съгласна съм с Ники
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:18:27 PM
6:18 PM
аз няма претенции, мога да ги пропусна ако user не е creator
1 reaction, react with +1 emoji
1
Add reaction…
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Nikolay Yankov
Today at 6:21:15 PM
6:21 PM
обаче не знам дали Галя ще го иска това, преди колоната се казваше recipients
и показваше всички които получават..
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:22:26 PM
6:22 PM
при репорти които не са Ask Jiminny там никога няма да е creator
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
New
Aneliya Angelova
Today at 6:26:59 PM
6:26 PM
pitah Galq - според нея нямало нужда да се крие
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:27:04 PM
6:27
от рекуеста
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:27:11 PM
6:27
не било конфиденциално
1 reaction, react with +1 emoji
1
Add reaction…
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:35:01 PM
6:35 PM
качено е
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Todor Stamatov, Direct Message, 1 of 15 suggestions
Aneliya Angelova is typing...
|
[{"role":"AXPopUpButton","text [{"role":"AXPopUpButton","text":"Switch workspaces… (Jiminny Inc) Has new messages","depth":14,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"Home","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Home","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"DMs","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"DMs","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"Activity","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Activity","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"Later","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Later","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"More…","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More","depth":16,"role_description":"text"},{"role":"AXStaticText","text":"Unreads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Threads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Huddles","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Drafts & sent","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Directories","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-x-integration-app","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-inner-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"ai-chapter","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"alerts","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"backend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"c-learning-people","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"confusion-clinic","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"curiosity_lab","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"engineering","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"frontend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"general","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"infra-changes","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-bg","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-copilot-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-zoom-phone-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-tickets","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"product_launches","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"random","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"releases","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"support","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"thank-yous","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"the_people_of_jiminny","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Steliyan Georgiev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Mario Georgiev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Todor Stamatov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Gabriela Dureva","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Petko Kashinski","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Vasil Vasilev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Nikolov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Galya Dimitrova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Stefka Stoyanova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tomov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tanev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Ivanov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Ves","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Jira Cloud","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Toast","depth":23,"role_description":"text"},{"role":"AXRadioButton","text":"Messages","depth":17,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Messages","depth":19,"role_description":"text"},{"role":"AXRadioButton","text":"Add canvas","depth":18,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Add canvas","depth":20,"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":17,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":19,"role_description":"text"},{"role":"AXPopUpButton","text":"Add and Edit Channel Tabs","depth":17,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Canvas","depth":17,"role_description":"text"},{"role":"AXStaticText","text":"List","depth":17,"role_description":"text"},{"role":"AXStaticText","text":"Folder","depth":17,"role_description":"text"},{"role":"AXPopUpButton","text":"Jump to date","depth":23,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Nikolay Yankov","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:55:21 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:55 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"kiosk-нах се с Аделина да видя за","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"Shared By","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"и ми направи впечатление, че тя като user, с когото е шернато, тя вижда и всички останли с които е шернато (в response-a на request-a, не в UI)","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"Мисля си, че ще е добре да го запечатаме това да не expose-ва информация за всички с които е шернато","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"какво мислите?","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"Untitled.png","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"","depth":25,"role_description":"text"},{"role":"AXButton","text":"Toggle file","depth":25,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXLink","text":"Untitled.png","depth":27,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Download Untitled.png","depth":28,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Share file: Untitled.png","depth":28,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View canvas details","depth":28,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":28,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:15:00 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:15 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"съгласна съм с Ники","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:18:27 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:18 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"аз няма претенции, мога да ги пропусна ако user не е creator","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"1 reaction, react with +1 emoji","depth":25,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"1","depth":26,"role_description":"text"},{"role":"AXButton","text":"Add reaction…","depth":25,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Nikolay Yankov","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:21:15 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:21 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"обаче не знам дали Галя ще го иска това, преди колоната се казваше recipients","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"и показваше всички които получават..","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:22:26 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:22 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"при репорти които не са Ask Jiminny там никога няма да е creator","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"New","depth":22,"role_description":"text"},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:26:59 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:26 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"pitah Galq - според нея нямало нужда да се крие","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 6:27:04 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:27","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"от рекуеста","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 6:27:11 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:27","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"не било конфиденциално","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"1 reaction, react with +1 emoji","depth":25,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"1","depth":26,"role_description":"text"},{"role":"AXButton","text":"Add reaction…","depth":25,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:35:01 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:35 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"качено е","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"","depth":23,"value":"","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Todor Stamatov, Direct Message, 1 of 15 suggestions","depth":11,"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova is typing","depth":11,"role_description":"text"}]...
|
-4442207626456299371
|
-1280968573201252272
|
idle
|
hybrid
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Aneliya Angelova
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Nikolay Yankov
Today at 5:55:21 PM
5:55 PM
kiosk-нах се с Аделина да видя за
Shared By
и ми направи впечатление, че тя като user, с когото е шернато, тя вижда и всички останли с които е шернато (в response-a на request-a, не в UI)
Мисля си, че ще е добре да го запечатаме това да не expose-ва информация за всички с които е шернато
какво мислите?
Untitled.png
Toggle file
Untitled.png
Download Untitled.png
Share file: Untitled.png
View canvas details
More actions
Aneliya Angelova
Today at 6:15:00 PM
6:15 PM
съгласна съм с Ники
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:18:27 PM
6:18 PM
аз няма претенции, мога да ги пропусна ако user не е creator
1 reaction, react with +1 emoji
1
Add reaction…
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Nikolay Yankov
Today at 6:21:15 PM
6:21 PM
обаче не знам дали Галя ще го иска това, преди колоната се казваше recipients
и показваше всички които получават..
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:22:26 PM
6:22 PM
при репорти които не са Ask Jiminny там никога няма да е creator
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
New
Aneliya Angelova
Today at 6:26:59 PM
6:26 PM
pitah Galq - според нея нямало нужда да се крие
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:27:04 PM
6:27
от рекуеста
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:27:11 PM
6:27
не било конфиденциално
1 reaction, react with +1 emoji
1
Add reaction…
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:35:01 PM
6:35 PM
качено е
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Todor Stamatov, Direct Message, 1 of 15 suggestions
Aneliya Angelova is typing
iTerm2ShellEditViewSessionScriptsProfilesWindowHelpБГ100% <78-zsh* Build full day activity...• *4|DOCKERO ₴1-zshworker-nudges:worker-nudges_00: started₴2-zshscreenpipe*What's next:Try Docker Debug for seamless, persistent debugging tools in any container or image + docker debug docker_lamp_1Learn moreat [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-18909-automated-reports-ask-jiminny) $ csfixdockerexec -it docker_lamp_1./vendor/bin/php-cs-fixer fix--config=.php-cs-fixer.dist.php -v --using-cache=no --diffPHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.PHPruntime:8.3.30Running analysis on 7 cores with 10 files per process.Parallel runner is an experimental feature and may be unstable, use it at your own risk. Feedback highly appreciated!Loadedconfigdefault from-php-cs-fixer.dist.php".5609/5609100%• ₴5-zsh86Tue 21 Apr 18:35:27APP (-zsh)T₴1+Fixed 0 of 5609 files in 36.627 seconds, 60.00 MB memory usedWhat's next:Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-18909-automated-reports-ask-jiminny) $ ||...
|
NULL
|
|
67396
|
1517
|
0
|
2026-04-21T15:35:57.538617+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776785757538_m2.jpg...
|
Slack
|
Aneliya Angelova, Nikolay Yankov, Steliyan Georgie Aneliya Angelova, Nikolay Yankov, Steliyan Georgiev (DM) - Jiminny Inc - 1 new item - Slack...
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Aneliya Angelova
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas...
|
[{"role":"AXPopUpButton","text [{"role":"AXPopUpButton","text":"Switch workspaces… (Jiminny Inc) Has new messages","depth":14,"bounds":{"left":0.0056515955,"top":0.058260176,"width":0.011968086,"height":0.028731046},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"Home","depth":14,"bounds":{"left":0.0029920214,"top":0.10055866,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Home","depth":16,"bounds":{"left":0.0066489363,"top":0.13806863,"width":0.009973404,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"DMs","depth":14,"bounds":{"left":0.0029920214,"top":0.15482841,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"DMs","depth":16,"bounds":{"left":0.0076462766,"top":0.19233839,"width":0.007978723,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Activity","depth":14,"bounds":{"left":0.0029920214,"top":0.20909816,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Activity","depth":16,"bounds":{"left":0.004986702,"top":0.24660814,"width":0.012965426,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":14,"bounds":{"left":0.0029920214,"top":0.26336792,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":16,"bounds":{"left":0.0076462766,"top":0.3008779,"width":0.0076462766,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Later","depth":14,"bounds":{"left":0.0029920214,"top":0.31763768,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Later","depth":16,"bounds":{"left":0.00731383,"top":0.35514766,"width":0.008643617,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"More…","depth":14,"bounds":{"left":0.0029920214,"top":0.3719074,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More","depth":16,"bounds":{"left":0.006981383,"top":0.4094174,"width":0.008976064,"height":0.0103751},"role_description":"text"},{"role":"AXStaticText","text":"Unreads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Threads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Huddles","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Drafts & sent","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Directories","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-x-integration-app","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-inner-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"ai-chapter","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"alerts","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"backend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"c-learning-people","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"confusion-clinic","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"curiosity_lab","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"engineering","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"frontend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"general","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"infra-changes","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-bg","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-copilot-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-zoom-phone-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-tickets","depth":23,"bounds":{"left":0.042220745,"top":0.09736632,"width":0.034906916,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"product_launches","depth":23,"bounds":{"left":0.042220745,"top":0.11971269,"width":0.03856383,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"random","depth":23,"bounds":{"left":0.042220745,"top":0.14205906,"width":0.01662234,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"releases","depth":23,"bounds":{"left":0.042220745,"top":0.16440542,"width":0.01761968,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"support","depth":23,"bounds":{"left":0.042220745,"top":0.1867518,"width":0.016954787,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"thank-yous","depth":23,"bounds":{"left":0.042220745,"top":0.20909816,"width":0.024268618,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"the_people_of_jiminny","depth":23,"bounds":{"left":0.042220745,"top":0.23144454,"width":0.04488032,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"bounds":{"left":0.042220745,"top":0.28411812,"width":0.03756649,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"bounds":{"left":0.07945479,"top":0.28411812,"width":0.0063164895,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"bounds":{"left":0.08211436,"top":0.28411812,"width":0.014295213,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"bounds":{"left":0.09607713,"top":0.30167598,"width":0.0003324468,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Steliyan Georgiev","depth":23,"bounds":{"left":0.09607713,"top":0.30167598,"width":0.0003324468,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"bounds":{"left":0.042220745,"top":0.3064645,"width":0.03756649,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Mario Georgiev","depth":23,"bounds":{"left":0.042220745,"top":0.32881084,"width":0.033909574,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"bounds":{"left":0.042220745,"top":0.35115722,"width":0.032912236,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Todor Stamatov","depth":23,"bounds":{"left":0.042220745,"top":0.3735036,"width":0.034242023,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Gabriela Dureva","depth":23,"bounds":{"left":0.042220745,"top":0.39584997,"width":0.03523936,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Petko Kashinski","depth":23,"bounds":{"left":0.042220745,"top":0.41819632,"width":0.034242023,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Vasil Vasilev","depth":23,"bounds":{"left":0.042220745,"top":0.4405427,"width":0.026263298,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Nikolov","depth":23,"bounds":{"left":0.042220745,"top":0.46288908,"width":0.034242023,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Galya Dimitrova","depth":23,"bounds":{"left":0.042220745,"top":0.48523542,"width":0.034906916,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Stefka Stoyanova","depth":23,"bounds":{"left":0.042220745,"top":0.50758183,"width":0.03756649,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tomov","depth":23,"bounds":{"left":0.042220745,"top":0.52992815,"width":0.030585106,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tanev","depth":23,"bounds":{"left":0.042220745,"top":0.5522745,"width":0.028922873,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Ivanov","depth":23,"bounds":{"left":0.042220745,"top":0.5746209,"width":0.031914894,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Ves","depth":23,"bounds":{"left":0.042220745,"top":0.5969673,"width":0.0076462766,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Jira Cloud","depth":23,"bounds":{"left":0.042220745,"top":0.64964086,"width":0.022273935,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Toast","depth":23,"bounds":{"left":0.042220745,"top":0.67198724,"width":0.011635638,"height":0.014365523},"role_description":"text"},{"role":"AXRadioButton","text":"Messages","depth":17,"bounds":{"left":0.10206117,"top":0.09177973,"width":0.030585106,"height":0.030327214},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Messages","depth":19,"bounds":{"left":0.111369684,"top":0.10055866,"width":0.01861702,"height":0.012769354},"role_description":"text"},{"role":"AXRadioButton","text":"Add canvas","depth":18,"bounds":{"left":0.13397606,"top":0.09177973,"width":0.033909574,"height":0.030327214},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Add canvas","depth":20,"bounds":{"left":0.14328457,"top":0.10055866,"width":0.021941489,"height":0.012769354},"role_description":"text"}]...
|
1880384799149335015
|
-1178361394083520864
|
idle
|
hybrid
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Aneliya Angelova
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
ActivityMoreslackcalVIewMistonWindowJiminny ...# platform-tickets# product launches# random# releases# support# thank-yous# the_people_of jimi...ó Direct messagesE Aneliya Angelova,...P. Aneliya Angelova8. Mario Georgiev• Nikolav Yankov%: Todor StamatovGabriela Dureva. Petko Kashinski€. Vasil VasilevNikolav NikolovP. Galya DimitrovafR. Stefka Stoyanovaa Stoyan Tomov2. Stoyan Tanev E. Nikolay Ivanov8. Vesit: AppsG Jira CloudToasthelp& Aneliya Angelova, ...84MessagesL Add canva:Ur FilesAneliva Angelova 6:15 PMсъгласна съм с НикиLukas Kovalik 6:18 PMаз няма претенции, мога да ги пропусна акоuser He e creatorde 1Nikolav Yankov 6:21 PMобаче не знам дали Галя ще го иска това,прели колоната се казваше recivientswlOXscir ewuKKoMuroTleVeleneLukas Kovallik 6:22 PMпри репорти които не са Ask Jiminny тамникога няма лa e creatorAnelliva Angelova 6:26 PMnitah Cala - спорел нея нямало нужла ла секриеот Dekvecтaне оило конфиленциалноd 1Lukas Kovalnk 6:35 PMMessage Aneliya Angelova, Nikolay Yankov, Steli...+ AalAsk Jiminny Test Report - 13 Apr 2026Shared With Groun - 1 Jul 2025 - 15 Aor 2026Product Feedback - 1 Feb - 31 Mar 2026 - Alliminny Recinient - 1 Dec 2025 - 14 Mav 2026Jiminny Recipient - 1 Dec 2025 - 14 May 2026liminny Recinient - 1 Der 2025 - 14 Mav 2026JY-18909-automated-reports-ask-You are currently impersonating Aneliya Angelova +)• © Clear allFREQUENCY #MonthlyMonthlyMonthlyMonthlyMonthlyWeeklyDailyDailyDailyDailyDailyDailyOne-OffOne-OffOne-OffOne-OffOne-OffSHAREDDATE21/04/202620/04/202620/04/202620/04/202620/04/202616/04/202616/04/202616/04/202616/04/202614/04/202614/04/202614/04/202631/03/202631/03/202631/03/202631/03/202631/03/2026{03 Ask Jiminny reportsACTIONSСрР.Con100% S2Tue 21 Apr 18:35:57#- InspectonConsoleDebuaaerT.. Networkf? Stule Editor(PerformanceE Memorv& Storage. 099+••X.• Disable Cache No Throttling : dAll HTMI POSTPOSTPOSTPOSTPOSTPOSTPOSTPOSTPOSTPOSTPOSTPOSTDOST''13 036719.ingest.se.A F 036719.ingestes..../api/5627310/envelope/?sentry_version=7&sentry_ke sentry-B6v5fcc5...A app. staging fjiminny...A app.staging.jiminny...A app.staging jiminny.Ar.logr-in.comautomated-reports?page=1&sort column=generated xhii?a=ponxaf/platform-staging&r=6-019db076-93 + xhrA app.staging, jiminny..•A xhAr.logr-in.comi?a=ponxaf/platform-staging&r=6-019db076-935d-7 xhrAr.logr-in.comi?a=ponxaf/platform-staging&r=6-019db076-935d-7 xhrAr.logr-in.comi?a=ponxaf/platform-staging&r=6-019db076-935d-7 xhrAr.logr-in.comi?a=ponxaf/platform-staging&r=6-019db076-935d-7 xhrr.loar-in.comMazponxat/olatform-stagina&r=6-019d6076-935d- xhi-rloar-in.com2a-nonyaflniatform-ctadina?r=6.010dh076.026d. yh.OR | 181г28 | 36 m2B | 36 m14.84 kB 198г5.53 KB | 87762 B 0ms96 B | 4764.56 kB 273OB | 62227.02 kRГРоr© 35 requests02 07 4p 12 MP teoncforrodCinich, 2.05 min MoOuCantonti codod, 240 me Miinad, 520 ml...
|
NULL
|
|
67397
|
1516
|
0
|
2026-04-21T15:35:57.797155+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776785757797_m1.jpg...
|
Slack
|
Aneliya Angelova, Nikolay Yankov, Steliyan Georgie Aneliya Angelova, Nikolay Yankov, Steliyan Georgiev (DM) - Jiminny Inc - 1 new item - Slack...
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Aneliya Angelova
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Nikolay Yankov
Today at 5:55:21 PM
5:55 PM
kiosk-нах се с Аделина да видя за
Shared By
и ми направи впечатление, че тя като user, с когото е шернато, тя вижда и всички останли с които е шернато (в response-a на request-a, не в UI)
Мисля си, че ще е добре да го запечатаме това да не expose-ва информация за всички с които е шернато
какво мислите?
Untitled.png
Toggle file
Untitled.png
Download Untitled.png
Share file: Untitled.png
View canvas details
More actions
Aneliya Angelova
Today at 6:15:00 PM
6:15 PM
съгласна съм с Ники
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:18:27 PM
6:18 PM
аз няма претенции, мога да ги пропусна ако user не е creator
1 reaction, react with +1 emoji
1
Add reaction…
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Nikolay Yankov
Today at 6:21:15 PM
6:21 PM
обаче не знам дали Галя ще го иска това, преди колоната се казваше recipients
и показваше всички които получават..
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:22:26 PM
6:22 PM
при репорти които не са Ask Jiminny там никога няма да е creator
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
New
Aneliya Angelova
Today at 6:26:59 PM
6:26 PM
pitah Galq - според нея нямало нужда да се крие
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:27:04 PM
6:27
от рекуеста
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:27:11 PM
6:27
не било конфиденциално
1 reaction, react with +1 emoji
1
Add reaction…
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:35:01 PM
6:35 PM
качено е
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Todor Stamatov, Direct Message, 1 of 15 suggestions
Aneliya Angelova is typing...
|
[{"role":"AXPopUpButton","text [{"role":"AXPopUpButton","text":"Switch workspaces… (Jiminny Inc) Has new messages","depth":14,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"Home","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Home","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"DMs","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"DMs","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"Activity","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Activity","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"Later","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Later","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"More…","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More","depth":16,"role_description":"text"},{"role":"AXStaticText","text":"Unreads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Threads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Huddles","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Drafts & sent","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Directories","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-x-integration-app","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-inner-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"ai-chapter","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"alerts","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"backend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"c-learning-people","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"confusion-clinic","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"curiosity_lab","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"engineering","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"frontend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"general","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"infra-changes","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-bg","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-copilot-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-zoom-phone-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-tickets","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"product_launches","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"random","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"releases","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"support","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"thank-yous","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"the_people_of_jiminny","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Steliyan Georgiev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Mario Georgiev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Todor Stamatov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Gabriela Dureva","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Petko Kashinski","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Vasil Vasilev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Nikolov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Galya Dimitrova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Stefka Stoyanova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tomov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tanev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Ivanov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Ves","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Jira Cloud","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Toast","depth":23,"role_description":"text"},{"role":"AXRadioButton","text":"Messages","depth":17,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Messages","depth":19,"role_description":"text"},{"role":"AXRadioButton","text":"Add canvas","depth":18,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Add canvas","depth":20,"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":17,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":19,"role_description":"text"},{"role":"AXPopUpButton","text":"Add and Edit Channel Tabs","depth":17,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Canvas","depth":17,"role_description":"text"},{"role":"AXStaticText","text":"List","depth":17,"role_description":"text"},{"role":"AXStaticText","text":"Folder","depth":17,"role_description":"text"},{"role":"AXPopUpButton","text":"Jump to date","depth":23,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Nikolay Yankov","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:55:21 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:55 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"kiosk-нах се с Аделина да видя за","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"Shared By","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"и ми направи впечатление, че тя като user, с когото е шернато, тя вижда и всички останли с които е шернато (в response-a на request-a, не в UI)","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"Мисля си, че ще е добре да го запечатаме това да не expose-ва информация за всички с които е шернато","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"какво мислите?","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"Untitled.png","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"","depth":25,"role_description":"text"},{"role":"AXButton","text":"Toggle file","depth":25,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXLink","text":"Untitled.png","depth":27,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Download Untitled.png","depth":28,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Share file: Untitled.png","depth":28,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View canvas details","depth":28,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":28,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:15:00 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:15 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"съгласна съм с Ники","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:18:27 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:18 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"аз няма претенции, мога да ги пропусна ако user не е creator","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"1 reaction, react with +1 emoji","depth":25,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"1","depth":26,"role_description":"text"},{"role":"AXButton","text":"Add reaction…","depth":25,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Nikolay Yankov","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:21:15 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:21 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"обаче не знам дали Галя ще го иска това, преди колоната се казваше recipients","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"и показваше всички които получават..","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:22:26 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:22 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"при репорти които не са Ask Jiminny там никога няма да е creator","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"New","depth":22,"role_description":"text"},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:26:59 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:26 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"pitah Galq - според нея нямало нужда да се крие","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 6:27:04 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:27","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"от рекуеста","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 6:27:11 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:27","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"не било конфиденциално","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"1 reaction, react with +1 emoji","depth":25,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"1","depth":26,"role_description":"text"},{"role":"AXButton","text":"Add reaction…","depth":25,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:35:01 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:35 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"качено е","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"","depth":23,"value":"","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Todor Stamatov, Direct Message, 1 of 15 suggestions","depth":11,"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova is typing","depth":11,"role_description":"text"}]...
|
-4442207626456299371
|
-1280968573201252272
|
idle
|
hybrid
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Aneliya Angelova
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Nikolay Yankov
Today at 5:55:21 PM
5:55 PM
kiosk-нах се с Аделина да видя за
Shared By
и ми направи впечатление, че тя като user, с когото е шернато, тя вижда и всички останли с които е шернато (в response-a на request-a, не в UI)
Мисля си, че ще е добре да го запечатаме това да не expose-ва информация за всички с които е шернато
какво мислите?
Untitled.png
Toggle file
Untitled.png
Download Untitled.png
Share file: Untitled.png
View canvas details
More actions
Aneliya Angelova
Today at 6:15:00 PM
6:15 PM
съгласна съм с Ники
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:18:27 PM
6:18 PM
аз няма претенции, мога да ги пропусна ако user не е creator
1 reaction, react with +1 emoji
1
Add reaction…
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Nikolay Yankov
Today at 6:21:15 PM
6:21 PM
обаче не знам дали Галя ще го иска това, преди колоната се казваше recipients
и показваше всички които получават..
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:22:26 PM
6:22 PM
при репорти които не са Ask Jiminny там никога няма да е creator
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
New
Aneliya Angelova
Today at 6:26:59 PM
6:26 PM
pitah Galq - според нея нямало нужда да се крие
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:27:04 PM
6:27
от рекуеста
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:27:11 PM
6:27
не било конфиденциално
1 reaction, react with +1 emoji
1
Add reaction…
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:35:01 PM
6:35 PM
качено е
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Todor Stamatov, Direct Message, 1 of 15 suggestions
Aneliya Angelova is typing
iTerm2ShellEditViewSessionScriptsProfilesWindowHelpБГ-zsh* Build full day activity...• *4|DOCKERO ₴1-zshworker-nudges:worker-nudges_00: started₴2-zshscreenpipe*What's next:Try Docker Debug for seamless, persistent debugging tools in any container or image + docker debug docker_lamp_1Learn moreat [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-18909-automated-reports-ask-jiminny) $ csfixdockerexec -it docker_lamp_1./vendor/bin/php-cs-fixer fix--config=.php-cs-fixer.dist.php -v --using-cache=no --diffPHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.PHPruntime:8.3.30Running analysis on 7 cores with 10 files per process.Parallel runner is an experimental feature and may be unstable, use it at your own risk. Feedback highly appreciated!Loadedconfigdefault from-php-cs-fixer.dist.php".5609/5609100%• ₴5-zsh100% <7886Tue 21 Apr 18:35:58APP (-zsh)T₴1+Fixed 0 of 5609 files in 36.627 seconds, 60.00 MB memory usedWhat's next:Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-18909-automated-reports-ask-jiminny) $ ||...
|
67395
|
|
67442
|
NULL
|
0
|
2026-04-21T15:40:47.288705+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776786047288_m2.jpg...
|
Slack
|
Aneliya Angelova, Nikolay Yankov, Steliyan Georgie Aneliya Angelova, Nikolay Yankov, Steliyan Georgiev (DM) - Jiminny Inc - 2 new items - Slack...
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Aneliya Angelova
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Unread mentions
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Nikolay Yankov
Today at 5:55:21 PM
5:55 PM
kiosk-нах се с Аделина да видя за
Shared By
и ми направи впечатление, че тя като user, с когото е шернато, тя вижда и всички останли с които е шернато (в response-a на request-a, не в UI)
Мисля си, че ще е добре да го запечатаме това да не expose-ва информация за всички с които е шернато
какво мислите?
Untitled.png
Toggle file
Untitled.png
Download Untitled.png
Share file: Untitled.png
View canvas details
More actions
Aneliya Angelova
Today at 6:15:00 PM
6:15 PM
съгласна съм с Ники
Lukas Kovalik
Today at 6:18:27 PM
6:18 PM
аз няма претенции, мога да ги пропусна ако user не е creator
1 reaction, react with +1 emoji
1
Add reaction…
Nikolay Yankov
Today at 6:21:15 PM
6:21 PM
обаче не знам дали Галя ще го иска това, преди колоната се казваше recipients
и показваше всички които получават..
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:22:26 PM
6:22 PM
при репорти които не са Ask Jiminny там никога няма да е creator
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 6:26:59 PM
6:26 PM
pitah Galq - според нея нямало нужда да се крие
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:27:04 PM
6:27
от рекуеста
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:27:11 PM
6:27
не било конфиденциално
1 reaction, react with +1 emoji
1
Add reaction…
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:35:01 PM
6:35 PM
качено е
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 6:39:01 PM
6:39 PM
всичко ли качи - в смисъл това da ne se показва creator-a в shared with
(edited)
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:39:07 PM
6:39
i towa za kiosk reportite
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:39:28 PM
6:39 PM
да
1 reaction, react with raised hands emoji
1
Add reaction…
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
creator не се показва и при два типа и groups показваме само
creator не се показва и при два типа и groups показваме само
Shift + Return to add a new line
Shift + Return
to add a new line
Todor Stamatov, Direct Message, 1 of 15 suggestions
Aneliya Angelova: i towa za kiosk reportite....
|
[{"role":"AXPopUpButton","text [{"role":"AXPopUpButton","text":"Switch workspaces… (Jiminny Inc) Has new messages","depth":14,"bounds":{"left":0.0056515955,"top":0.058260176,"width":0.011968086,"height":0.028731046},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"Home","depth":14,"bounds":{"left":0.0029920214,"top":0.10055866,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Home","depth":16,"bounds":{"left":0.0066489363,"top":0.13806863,"width":0.009973404,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"DMs","depth":14,"bounds":{"left":0.0029920214,"top":0.15482841,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"DMs","depth":16,"bounds":{"left":0.0076462766,"top":0.19233839,"width":0.007978723,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Activity","depth":14,"bounds":{"left":0.0029920214,"top":0.20909816,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Activity","depth":16,"bounds":{"left":0.004986702,"top":0.24660814,"width":0.012965426,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":14,"bounds":{"left":0.0029920214,"top":0.26336792,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":16,"bounds":{"left":0.0076462766,"top":0.3008779,"width":0.0076462766,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Later","depth":14,"bounds":{"left":0.0029920214,"top":0.31763768,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Later","depth":16,"bounds":{"left":0.00731383,"top":0.35514766,"width":0.008643617,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"More…","depth":14,"bounds":{"left":0.0029920214,"top":0.3719074,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More","depth":16,"bounds":{"left":0.006981383,"top":0.4094174,"width":0.008976064,"height":0.0103751},"role_description":"text"},{"role":"AXStaticText","text":"Unreads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Threads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Huddles","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Drafts & sent","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Directories","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-x-integration-app","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-inner-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"ai-chapter","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"alerts","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"backend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"c-learning-people","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"confusion-clinic","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"curiosity_lab","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"engineering","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"frontend","depth":23,"bounds":{"left":0.042220745,"top":0.09177973,"width":0.018949468,"height":0.009577015},"role_description":"text"},{"role":"AXStaticText","text":"general","depth":23,"bounds":{"left":0.042220745,"top":0.10933759,"width":0.015957447,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"infra-changes","depth":23,"bounds":{"left":0.042220745,"top":0.13168396,"width":0.029587766,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"jiminny-bg","depth":23,"bounds":{"left":0.042220745,"top":0.15403032,"width":0.022938829,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"people-with-copilot-licences","depth":23,"bounds":{"left":0.042220745,"top":0.1763767,"width":0.045212764,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"people-with-zoom-phone-licences","depth":23,"bounds":{"left":0.042220745,"top":0.19872306,"width":0.045877658,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"platform-team","depth":23,"bounds":{"left":0.042220745,"top":0.22106944,"width":0.03125,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"platform-tickets","depth":23,"bounds":{"left":0.042220745,"top":0.2434158,"width":0.034906916,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"product_launches","depth":23,"bounds":{"left":0.042220745,"top":0.26576218,"width":0.03856383,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"random","depth":23,"bounds":{"left":0.042220745,"top":0.28810853,"width":0.01662234,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"releases","depth":23,"bounds":{"left":0.042220745,"top":0.3104549,"width":0.01761968,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"support","depth":23,"bounds":{"left":0.042220745,"top":0.33280128,"width":0.016954787,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"thank-yous","depth":23,"bounds":{"left":0.042220745,"top":0.35514766,"width":0.024268618,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"the_people_of_jiminny","depth":23,"bounds":{"left":0.042220745,"top":0.377494,"width":0.04488032,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"bounds":{"left":0.042220745,"top":0.4301676,"width":0.03756649,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"bounds":{"left":0.07945479,"top":0.4301676,"width":0.0063164895,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"bounds":{"left":0.08211436,"top":0.4301676,"width":0.014295213,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"bounds":{"left":0.09607713,"top":0.44772545,"width":0.0003324468,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Steliyan Georgiev","depth":23,"bounds":{"left":0.09607713,"top":0.44772545,"width":0.0003324468,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"bounds":{"left":0.042220745,"top":0.45251396,"width":0.03756649,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Mario Georgiev","depth":23,"bounds":{"left":0.042220745,"top":0.47486034,"width":0.033909574,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"bounds":{"left":0.042220745,"top":0.49720672,"width":0.032912236,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Todor Stamatov","depth":23,"bounds":{"left":0.042220745,"top":0.51955307,"width":0.034242023,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Gabriela Dureva","depth":23,"bounds":{"left":0.042220745,"top":0.54189944,"width":0.03523936,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Petko Kashinski","depth":23,"bounds":{"left":0.042220745,"top":0.5642458,"width":0.034242023,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Vasil Vasilev","depth":23,"bounds":{"left":0.042220745,"top":0.5865922,"width":0.026263298,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Nikolov","depth":23,"bounds":{"left":0.042220745,"top":0.6089386,"width":0.034242023,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Galya Dimitrova","depth":23,"bounds":{"left":0.042220745,"top":0.6312849,"width":0.034906916,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Stefka Stoyanova","depth":23,"bounds":{"left":0.042220745,"top":0.65363127,"width":0.03756649,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tomov","depth":23,"bounds":{"left":0.042220745,"top":0.67597765,"width":0.030585106,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tanev","depth":23,"bounds":{"left":0.042220745,"top":0.698324,"width":0.028922873,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Ivanov","depth":23,"bounds":{"left":0.042220745,"top":0.7086991,"width":0.031914894,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Ves","depth":23,"bounds":{"left":0.042220745,"top":0.7086991,"width":0.0076462766,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Jira Cloud","depth":23,"bounds":{"left":0.042220745,"top":0.7086991,"width":0.022273935,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Toast","depth":23,"bounds":{"left":0.042220745,"top":0.7086991,"width":0.011635638,"height":0.0007980846},"role_description":"text"},{"role":"AXButton","text":"Unread mentions","depth":17,"bounds":{"left":0.035904255,"top":0.68076617,"width":0.048204787,"height":0.022346368},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"Messages","depth":17,"bounds":{"left":0.10206117,"top":0.09177973,"width":0.030585106,"height":0.030327214},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Messages","depth":19,"bounds":{"left":0.111369684,"top":0.10055866,"width":0.01861702,"height":0.012769354},"role_description":"text"},{"role":"AXRadioButton","text":"Add canvas","depth":18,"bounds":{"left":0.13397606,"top":0.09177973,"width":0.033909574,"height":0.030327214},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Add canvas","depth":20,"bounds":{"left":0.14328457,"top":0.10055866,"width":0.021941489,"height":0.012769354},"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":17,"bounds":{"left":0.16921543,"top":0.09177973,"width":0.020944148,"height":0.030327214},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":19,"bounds":{"left":0.17852394,"top":0.10055866,"width":0.008976064,"height":0.012769354},"role_description":"text"},{"role":"AXPopUpButton","text":"Add and Edit Channel Tabs","depth":17,"bounds":{"left":0.19115691,"top":0.09177973,"width":0.010970744,"height":0.030327214},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Canvas","depth":17,"bounds":{"left":0.096409574,"top":0.0518755,"width":0.015625,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"List","depth":17,"bounds":{"left":0.096409574,"top":0.0518755,"width":0.0076462766,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Folder","depth":17,"bounds":{"left":0.096409574,"top":0.0518755,"width":0.013962766,"height":0.0007980846},"role_description":"text"},{"role":"AXPopUpButton","text":"Jump to date","depth":23,"bounds":{"left":0.15026596,"top":0.12689546,"width":0.025265958,"height":0.022346368},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Nikolay Yankov","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:55:21 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:55 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"kiosk-нах се с Аделина да видя за","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"Shared By","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"и ми направи впечатление, че тя като user, с когото е шернато, тя вижда и всички останли с които е шернато (в response-a на request-a, не в UI)","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"Мисля си, че ще е добре да го запечатаме това да не expose-ва информация за всички с които е шернато","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"какво мислите?","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"Untitled.png","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"","depth":25,"role_description":"text"},{"role":"AXButton","text":"Toggle file","depth":25,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXLink","text":"Untitled.png","depth":27,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Download Untitled.png","depth":28,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Share file: Untitled.png","depth":28,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View canvas details","depth":28,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":28,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:15:00 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:15 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"съгласна съм с Ники","depth":25,"role_description":"text"},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:18:27 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:18 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"аз няма претенции, мога да ги пропусна ако user не е creator","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"1 reaction, react with +1 emoji","depth":25,"bounds":{"left":0.11801862,"top":0.11572227,"width":0.014295213,"height":0.014365523},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"1","depth":26,"bounds":{"left":0.12732713,"top":0.11572227,"width":0.0023271276,"height":0.0103751},"role_description":"text"},{"role":"AXButton","text":"Add reaction…","depth":25,"bounds":{"left":0.13331117,"top":0.11572227,"width":0.011635638,"height":0.014365523},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Nikolay Yankov","depth":24,"bounds":{"left":0.11801862,"top":0.13886672,"width":0.034242023,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.15226063,"top":0.14046289,"width":0.0026595744,"height":0.015163607},"role_description":"text"},{"role":"AXLink","text":"Today at 6:21:15 PM","depth":24,"bounds":{"left":0.1549202,"top":0.14285715,"width":0.014960106,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:21 PM","depth":25,"bounds":{"left":0.1549202,"top":0.14285715,"width":0.014960106,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"обаче не знам дали Галя ще го иска това, преди колоната се казваше recipients","depth":25,"bounds":{"left":0.11801862,"top":0.15802075,"width":0.0944149,"height":0.032721467},"role_description":"text"},{"role":"AXStaticText","text":"и показваше всички които получават..","depth":25,"bounds":{"left":0.11801862,"top":0.19313647,"width":0.08743351,"height":0.015163607},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.12529927,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.12529927,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.12529927,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.12529927,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.12529927,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.12529927,"width":0.0003324468,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.12529927,"width":0.0003324468,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.12529927,"width":0.0003324468,"height":0.026336791},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"bounds":{"left":0.11801862,"top":0.21548285,"width":0.030917553,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.14860372,"top":0.21707901,"width":0.0029920214,"height":0.015163607},"role_description":"text"},{"role":"AXLink","text":"Today at 6:22:26 PM","depth":24,"bounds":{"left":0.1512633,"top":0.21947326,"width":0.015292553,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:22 PM","depth":25,"bounds":{"left":0.1512633,"top":0.21947326,"width":0.015292553,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"при репорти които не са Ask Jiminny там никога няма да е creator","depth":25,"bounds":{"left":0.11801862,"top":0.23463687,"width":0.0930851,"height":0.032721467},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.2019154,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.2019154,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.2019154,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.2019154,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.2019154,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.2019154,"width":0.0003324468,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.2019154,"width":0.0003324468,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.2019154,"width":0.0003324468,"height":0.026336791},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"bounds":{"left":0.11801862,"top":0.2745411,"width":0.038896278,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.15658244,"top":0.27613726,"width":0.0029920214,"height":0.015163607},"role_description":"text"},{"role":"AXLink","text":"Today at 6:26:59 PM","depth":24,"bounds":{"left":0.15924202,"top":0.27853152,"width":0.015292553,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:26 PM","depth":25,"bounds":{"left":0.15924202,"top":0.27853152,"width":0.015292553,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"pitah Galq - според нея нямало нужда да се крие","depth":25,"bounds":{"left":0.11801862,"top":0.29369512,"width":0.10006649,"height":0.032721467},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.26097366,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.26097366,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.26097366,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.26097366,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.26097366,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.26097366,"width":0.0003324468,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.26097366,"width":0.0003324468,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.26097366,"width":0.0003324468,"height":0.026336791},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 6:27:04 PM","depth":25,"bounds":{"left":0.107380316,"top":0.33758977,"width":0.007978723,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:27","depth":26,"bounds":{"left":0.107380316,"top":0.33758977,"width":0.007978723,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"от рекуеста","depth":25,"bounds":{"left":0.11801862,"top":0.33519554,"width":0.026928192,"height":0.015163607},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.3104549,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.3104549,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.3104549,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.3104549,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.3104549,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.3104549,"width":0.0003324468,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.3104549,"width":0.0003324468,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.3104549,"width":0.0003324468,"height":0.026336791},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 6:27:11 PM","depth":25,"bounds":{"left":0.107380316,"top":0.36153233,"width":0.007978723,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:27","depth":26,"bounds":{"left":0.107380316,"top":0.36153233,"width":0.007978723,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"не било конфиденциално","depth":25,"bounds":{"left":0.11801862,"top":0.35913807,"width":0.059507977,"height":0.015163607},"role_description":"text"},{"role":"AXCheckBox","text":"1 reaction, react with +1 emoji","depth":25,"bounds":{"left":0.11801862,"top":0.3782921,"width":0.014295213,"height":0.019952115},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"1","depth":26,"bounds":{"left":0.12732713,"top":0.38228253,"width":0.0023271276,"height":0.011971269},"role_description":"text"},{"role":"AXButton","text":"Add reaction…","depth":25,"bounds":{"left":0.13331117,"top":0.3782921,"width":0.011635638,"height":0.019952115},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.33439744,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.33439744,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.33439744,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.33439744,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.33439744,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.33439744,"width":0.0003324468,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.33439744,"width":0.0003324468,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.33439744,"width":0.0003324468,"height":0.026336791},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"bounds":{"left":0.11801862,"top":0.40702313,"width":0.030917553,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.14860372,"top":0.4086193,"width":0.0029920214,"height":0.015163607},"role_description":"text"},{"role":"AXLink","text":"Today at 6:35:01 PM","depth":24,"bounds":{"left":0.1512633,"top":0.41101357,"width":0.015292553,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:35 PM","depth":25,"bounds":{"left":0.1512633,"top":0.41101357,"width":0.015292553,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"качено е","depth":25,"bounds":{"left":0.11801862,"top":0.42617717,"width":0.019946808,"height":0.015163607},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.3934557,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.3934557,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.3934557,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.3934557,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.3934557,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.3934557,"width":0.0003324468,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.3934557,"width":0.0003324468,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.3934557,"width":0.0003324468,"height":0.026336791},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"bounds":{"left":0.11801862,"top":0.44852355,"width":0.038896278,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.15658244,"top":0.4501197,"width":0.0029920214,"height":0.015163607},"role_description":"text"},{"role":"AXLink","text":"Today at 6:39:01 PM","depth":24,"bounds":{"left":0.15924202,"top":0.45251396,"width":0.015292553,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:39 PM","depth":25,"bounds":{"left":0.15924202,"top":0.45251396,"width":0.015292553,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"всичко ли качи - в смисъл това da ne se показва creator-a в shared with","depth":25,"bounds":{"left":0.11801862,"top":0.46767756,"width":0.09042553,"height":0.032721467},"role_description":"text"},{"role":"AXStaticText","text":"","depth":25,"bounds":{"left":0.18716756,"top":0.4868316,"width":0.0013297872,"height":0.013567438},"role_description":"text"},{"role":"AXStaticText","text":"(edited)","depth":25,"bounds":{"left":0.18849733,"top":0.4868316,"width":0.014295213,"height":0.013567438},"role_description":"text"},{"role":"AXStaticText","text":"","depth":25,"bounds":{"left":0.20246011,"top":0.4868316,"width":0.0013297872,"height":0.013567438},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.4349561,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.4349561,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.4349561,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.4349561,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.4349561,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.4349561,"width":0.0003324468,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.4349561,"width":0.0003324468,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.4349561,"width":0.0003324468,"height":0.026336791},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 6:39:07 PM","depth":25,"bounds":{"left":0.107380316,"top":0.51157224,"width":0.007978723,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:39","depth":26,"bounds":{"left":0.107380316,"top":0.51157224,"width":0.007978723,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"i towa za kiosk reportite","depth":25,"bounds":{"left":0.11801862,"top":0.509178,"width":0.052526597,"height":0.015163607},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.48443735,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.48443735,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.48443735,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.48443735,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.48443735,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.48443735,"width":0.0003324468,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.48443735,"width":0.0003324468,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.48443735,"width":0.0003324468,"height":0.026336791},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"bounds":{"left":0.11801862,"top":0.53152436,"width":0.030917553,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.14860372,"top":0.5331205,"width":0.0029920214,"height":0.015163607},"role_description":"text"},{"role":"AXLink","text":"Today at 6:39:28 PM","depth":24,"bounds":{"left":0.1512633,"top":0.5355148,"width":0.015292553,"height":0.011971269},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:39 PM","depth":25,"bounds":{"left":0.1512633,"top":0.5355148,"width":0.015292553,"height":0.011971269},"role_description":"text"},{"role":"AXStaticText","text":"да","depth":25,"bounds":{"left":0.11801862,"top":0.5506784,"width":0.0056515955,"height":0.015163607},"role_description":"text"},{"role":"AXCheckBox","text":"1 reaction, react with raised hands emoji","depth":25,"bounds":{"left":0.11801862,"top":0.5698324,"width":0.014295213,"height":0.019952115},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"1","depth":26,"bounds":{"left":0.12732713,"top":0.5738228,"width":0.0023271276,"height":0.011971269},"role_description":"text"},{"role":"AXButton","text":"Add reaction…","depth":25,"bounds":{"left":0.13331117,"top":0.5698324,"width":0.011635638,"height":0.019952115},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.5179569,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.5179569,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.5179569,"width":0.010638298,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.5179569,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.5179569,"width":0.010638298,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.5179569,"width":0.0003324468,"height":0.026336791},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.5179569,"width":0.0003324468,"height":0.026336791},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.5179569,"width":0.0003324468,"height":0.026336791},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"creator не се показва и при два типа и groups показваме само","depth":23,"bounds":{"left":0.10372341,"top":0.6097366,"width":0.118351065,"height":0.047885075},"value":"creator не се показва и при два типа и groups показваме само","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"creator не се показва и при два типа и groups показваме само","depth":25,"bounds":{"left":0.10771277,"top":0.6177175,"width":0.1043883,"height":0.031923383},"role_description":"text"},{"role":"AXButton","text":"Shift + Return to add a new line","depth":20,"bounds":{"left":0.17121011,"top":0.6935355,"width":0.048537236,"height":0.012769354},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Shift + Return","depth":21,"bounds":{"left":0.17121011,"top":0.6943336,"width":0.021609042,"height":0.0103751},"role_description":"text"},{"role":"AXStaticText","text":"to add a new line","depth":21,"bounds":{"left":0.1924867,"top":0.6943336,"width":0.027260639,"height":0.0103751},"role_description":"text"},{"role":"AXStaticText","text":"Todor Stamatov, Direct Message, 1 of 15 suggestions","depth":11,"bounds":{"left":0.0,"top":0.7126895,"width":0.026263298,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova: i towa za kiosk reportite.","depth":11,"bounds":{"left":0.0,"top":0.7126895,"width":0.020944148,"height":0.0007980846},"role_description":"text"}]...
|
8645564811610918907
|
-1280968573301948336
|
idle
|
hybrid
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Aneliya Angelova
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Unread mentions
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Nikolay Yankov
Today at 5:55:21 PM
5:55 PM
kiosk-нах се с Аделина да видя за
Shared By
и ми направи впечатление, че тя като user, с когото е шернато, тя вижда и всички останли с които е шернато (в response-a на request-a, не в UI)
Мисля си, че ще е добре да го запечатаме това да не expose-ва информация за всички с които е шернато
какво мислите?
Untitled.png
Toggle file
Untitled.png
Download Untitled.png
Share file: Untitled.png
View canvas details
More actions
Aneliya Angelova
Today at 6:15:00 PM
6:15 PM
съгласна съм с Ники
Lukas Kovalik
Today at 6:18:27 PM
6:18 PM
аз няма претенции, мога да ги пропусна ако user не е creator
1 reaction, react with +1 emoji
1
Add reaction…
Nikolay Yankov
Today at 6:21:15 PM
6:21 PM
обаче не знам дали Галя ще го иска това, преди колоната се казваше recipients
и показваше всички които получават..
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:22:26 PM
6:22 PM
при репорти които не са Ask Jiminny там никога няма да е creator
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 6:26:59 PM
6:26 PM
pitah Galq - според нея нямало нужда да се крие
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:27:04 PM
6:27
от рекуеста
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:27:11 PM
6:27
не било конфиденциално
1 reaction, react with +1 emoji
1
Add reaction…
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:35:01 PM
6:35 PM
качено е
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 6:39:01 PM
6:39 PM
всичко ли качи - в смисъл това da ne se показва creator-a в shared with
(edited)
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:39:07 PM
6:39
i towa za kiosk reportite
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:39:28 PM
6:39 PM
да
1 reaction, react with raised hands emoji
1
Add reaction…
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
creator не се показва и при два типа и groups показваме само
creator не се показва и при два типа и groups показваме само
Shift + Return to add a new line
Shift + Return
to add a new line
Todor Stamatov, Direct Message, 1 of 15 suggestions
Aneliya Angelova: i towa za kiosk reportite.
ActivityLaterMoreSlackVIewMistonWindowhelp@ Describe what you are looking forJiminny …..y# trontend# general# infra-changes#jiminny-bg8 people-with-copilo...8 people-with-zoom-..# platform-team# platform-tickets# product_launches# random# releases# support# thank-yous# the_people_of jimi...• Direct messagesE Aneliya Angelova, .... Aneliya Angelova&. Mario GeorgievFP. Nikolay YankovS. Todor StamatovP. Gabriela Dureva. Petko Kashinski€. Vasil VasilevNikolav NikolovGalya Dimitrovaa. Stefka Stoyanova& Aneliya Angelova, ...84MessagesAdd canvaUr Filesnikolav yankov owzобаче не знам дали Галя ще го иска това,поели колоната се казваше recivientsи показваше всички които получават..Lukas Kovalik 6:22 PMпри репорти които не са Ask Jiminny тамникога няма лa e creatorAneliva Angelova 6:26 PMpitah cala - спорел нея нямало нужла ла секриеот рекуестане оило конфиденциалноLukas Kovalik 6:35 PMAneliva Angelova 6:39 PMвсичко ли качи - в смисьл това da ne seIrowa za Kiosk revornteLukas Kovalik 6:39 PM#1creatoг не се показва и при два типа и groupsпоказваме само|Aа €Shift + Return to add a new lingQ Searchspaces /Jiminny (New) / # sY-19240 / [] JY-1890908-230648t=nJK629FloDyaWRYR-1 Connect your Figma accountIf no one is selected then the report will onlv be shared with the person who created it• ensure the reports has a proper structure and formatting - headings, bold etc. - take examples from the Exec Reports• ensure the report has links to playback when examples are used• in the beginning of each report have a brief section for 'Data Srouce' and 'Objective' - take the Exec summary report for exampleo data source should cover what data has been analysed• obiective should be a short paragranh that explains the aoalShow the reports in Jiminny.• show the report in the AI Reports page with a special logo - Project Phoenix• only the creator of the reporis and the users it is shared with should be able to see it in the list• users should be able to preview the report and download it• the creator of the report should be able to delete it - deleting it will delete only this specific pdf• 'Ask Jiminny Report' should be added as an option to the Report type filter so users can filter the list for such reports• when a report is shared with a user then show who shared it in the 'Shared' column -x?node-id=14369-40078&t=We33fyQzIUfHuXVR-4 Connect your Figma accouhttps://www.figma.com/design/jXcUe1y9mx5Fiz8KosLAUn/Project-PhoeniSubtasks... II +89% DonePrio...StOry….$ JY-20570 [FE] Prepare HTML Template for PDF report= MeIh JY-20571 |ATl Create PDF from Panorama results= MєDONE8 JY-20572 (BE] Send email for generated report (check design)& JY-20573 [BE] Manage recipients for email sending& JY-20574 [AI] Ensure PDF formatting is good$ JY-20575 [AI) Make links to Playback in PDF workJY-20576 [FE] Add new generated report in the AI reports page$ JY-20577 (BE] Add flag in AI Reports list for delete rights= Me= MeDONEDONE= MєDONE V= MeDONE= MEDONE= MELn.1Y-20578 [EE. Add delete buttonl= MeDONEVDONEV& JY-20579 (BE] Add new report type in filters options$ JY-20580 [FE] Rename column Shared= MeDONE V- MeDONE VJY-20581 [FE) Rework Shared Tooltip infoJY-20582 [BE+AI+Infra] Create new queue= MєDONE V= MєDONE+ CreateIn QA vDetailsAssigneeReporterDevelopmentReleasesComponentsParentSub-ProductLabelsStory point estimateStory PointsOrganisationsPriorityFix versionsSprintDaysNeed QAParentCanny Links* Improve StoryQ00 14 8 Tu21Aрr 18:40:47ASK ROVO 1 o t eSteliyan GeorgievAssign to me2 Galya Dimitrova[ Open with VS Code4 branches50 commits3 pull requests6 buildsA ProductionA See all deploymentsPlatform# JY-19240 AJ ReportsAdd options(AT) (BE) (FE) (OANoneNone= MediumNonePlatform Sprint 2 Q2 +1Yes• JY-19240 AJ ReportsOpen Canny Links26 minutes agoMERGED...
|
67440
|
|
67443
|
NULL
|
0
|
2026-04-21T15:40:47.546891+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776786047546_m1.jpg...
|
Slack
|
Aneliya Angelova, Nikolay Yankov, Steliyan Georgie Aneliya Angelova, Nikolay Yankov, Steliyan Georgiev (DM) - Jiminny Inc - 2 new items - Slack...
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Aneliya Angelova
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Unread mentions
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Nikolay Yankov
Today at 5:55:21 PM
5:55 PM
kiosk-нах се с Аделина да видя за
Shared By
и ми направи впечатление, че тя като user, с когото е шернато, тя вижда и всички останли с които е шернато (в response-a на request-a, не в UI)
Мисля си, че ще е добре да го запечатаме това да не expose-ва информация за всички с които е шернато
какво мислите?
Untitled.png
Toggle file
Untitled.png
Download Untitled.png
Share file: Untitled.png
View canvas details
More actions
Aneliya Angelova
Today at 6:15:00 PM
6:15 PM
съгласна съм с Ники
Lukas Kovalik
Today at 6:18:27 PM
6:18 PM
аз няма претенции, мога да ги пропусна ако user не е creator
1 reaction, react with +1 emoji
1
Add reaction…
Nikolay Yankov
Today at 6:21:15 PM
6:21 PM
обаче не знам дали Галя ще го иска това, преди колоната се казваше recipients
и показваше всички които получават..
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:22:26 PM
6:22 PM
при репорти които не са Ask Jiminny там никога няма да е creator
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 6:26:59 PM
6:26 PM
pitah Galq - според нея нямало нужда да се крие
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:27:04 PM
6:27
от рекуеста
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:27:11 PM
6:27
не било конфиденциално
1 reaction, react with +1 emoji
1
Add reaction…
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:35:01 PM
6:35 PM
качено е
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 6:39:01 PM
6:39 PM
всичко ли качи - в смисъл това da ne se показва creator-a в shared with
(edited)
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:39:07 PM
6:39
i towa za kiosk reportite
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:39:28 PM
6:39 PM
да
1 reaction, react with raised hands emoji
1
Add reaction…
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
creator не се показва и при два типа и groups показваме само
creator не се показва и при два типа и groups показваме само
Shift + Return to add a new line
Shift + Return
to add a new line
Todor Stamatov, Direct Message, 1 of 15 suggestions
Aneliya Angelova: i towa za kiosk reportite....
|
[{"role":"AXPopUpButton","text [{"role":"AXPopUpButton","text":"Switch workspaces… (Jiminny Inc) Has new messages","depth":14,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"Home","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Home","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"DMs","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"DMs","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"Activity","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Activity","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"Later","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Later","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"More…","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More","depth":16,"role_description":"text"},{"role":"AXStaticText","text":"Unreads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Threads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Huddles","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Drafts & sent","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Directories","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-x-integration-app","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-inner-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"ai-chapter","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"alerts","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"backend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"c-learning-people","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"confusion-clinic","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"curiosity_lab","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"engineering","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"frontend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"general","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"infra-changes","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-bg","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-copilot-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-zoom-phone-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-tickets","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"product_launches","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"random","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"releases","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"support","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"thank-yous","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"the_people_of_jiminny","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Steliyan Georgiev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Mario Georgiev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Todor Stamatov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Gabriela Dureva","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Petko Kashinski","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Vasil Vasilev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Nikolov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Galya Dimitrova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Stefka Stoyanova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tomov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tanev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Ivanov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Ves","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Jira Cloud","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Toast","depth":23,"role_description":"text"},{"role":"AXButton","text":"Unread mentions","depth":17,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"Messages","depth":17,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Messages","depth":19,"role_description":"text"},{"role":"AXRadioButton","text":"Add canvas","depth":18,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Add canvas","depth":20,"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":17,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":19,"role_description":"text"},{"role":"AXPopUpButton","text":"Add and Edit Channel Tabs","depth":17,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Canvas","depth":17,"role_description":"text"},{"role":"AXStaticText","text":"List","depth":17,"role_description":"text"},{"role":"AXStaticText","text":"Folder","depth":17,"role_description":"text"},{"role":"AXPopUpButton","text":"Jump to date","depth":23,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Nikolay Yankov","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:55:21 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:55 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"kiosk-нах се с Аделина да видя за","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"Shared By","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"и ми направи впечатление, че тя като user, с когото е шернато, тя вижда и всички останли с които е шернато (в response-a на request-a, не в UI)","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"Мисля си, че ще е добре да го запечатаме това да не expose-ва информация за всички с които е шернато","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"какво мислите?","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"Untitled.png","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"","depth":25,"role_description":"text"},{"role":"AXButton","text":"Toggle file","depth":25,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXLink","text":"Untitled.png","depth":27,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Download Untitled.png","depth":28,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Share file: Untitled.png","depth":28,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View canvas details","depth":28,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":28,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:15:00 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:15 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"съгласна съм с Ники","depth":25,"role_description":"text"},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:18:27 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:18 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"аз няма претенции, мога да ги пропусна ако user не е creator","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"1 reaction, react with +1 emoji","depth":25,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"1","depth":26,"role_description":"text"},{"role":"AXButton","text":"Add reaction…","depth":25,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Nikolay Yankov","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:21:15 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:21 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"обаче не знам дали Галя ще го иска това, преди колоната се казваше recipients","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"и показваше всички които получават..","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:22:26 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:22 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"при репорти които не са Ask Jiminny там никога няма да е creator","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:26:59 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:26 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"pitah Galq - според нея нямало нужда да се крие","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 6:27:04 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:27","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"от рекуеста","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 6:27:11 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:27","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"не било конфиденциално","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"1 reaction, react with +1 emoji","depth":25,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"1","depth":26,"role_description":"text"},{"role":"AXButton","text":"Add reaction…","depth":25,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:35:01 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:35 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"качено е","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:39:01 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:39 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"всичко ли качи - в смисъл това da ne se показва creator-a в shared with","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"(edited)","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 6:39:07 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:39","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"i towa za kiosk reportite","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:39:28 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:39 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"да","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"1 reaction, react with raised hands emoji","depth":25,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"1","depth":26,"role_description":"text"},{"role":"AXButton","text":"Add reaction…","depth":25,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"creator не се показва и при два типа и groups показваме само","depth":23,"value":"creator не се показва и при два типа и groups показваме само","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"creator не се показва и при два типа и groups показваме само","depth":25,"role_description":"text"},{"role":"AXButton","text":"Shift + Return to add a new line","depth":20,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Shift + Return","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"to add a new line","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Todor Stamatov, Direct Message, 1 of 15 suggestions","depth":11,"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova: i towa za kiosk reportite.","depth":11,"role_description":"text"}]...
|
8645564811610918907
|
-1280968573301948336
|
idle
|
hybrid
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Aneliya Angelova
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Unread mentions
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Nikolay Yankov
Today at 5:55:21 PM
5:55 PM
kiosk-нах се с Аделина да видя за
Shared By
и ми направи впечатление, че тя като user, с когото е шернато, тя вижда и всички останли с които е шернато (в response-a на request-a, не в UI)
Мисля си, че ще е добре да го запечатаме това да не expose-ва информация за всички с които е шернато
какво мислите?
Untitled.png
Toggle file
Untitled.png
Download Untitled.png
Share file: Untitled.png
View canvas details
More actions
Aneliya Angelova
Today at 6:15:00 PM
6:15 PM
съгласна съм с Ники
Lukas Kovalik
Today at 6:18:27 PM
6:18 PM
аз няма претенции, мога да ги пропусна ако user не е creator
1 reaction, react with +1 emoji
1
Add reaction…
Nikolay Yankov
Today at 6:21:15 PM
6:21 PM
обаче не знам дали Галя ще го иска това, преди колоната се казваше recipients
и показваше всички които получават..
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:22:26 PM
6:22 PM
при репорти които не са Ask Jiminny там никога няма да е creator
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 6:26:59 PM
6:26 PM
pitah Galq - според нея нямало нужда да се крие
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:27:04 PM
6:27
от рекуеста
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:27:11 PM
6:27
не било конфиденциално
1 reaction, react with +1 emoji
1
Add reaction…
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:35:01 PM
6:35 PM
качено е
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 6:39:01 PM
6:39 PM
всичко ли качи - в смисъл това da ne se показва creator-a в shared with
(edited)
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:39:07 PM
6:39
i towa za kiosk reportite
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:39:28 PM
6:39 PM
да
1 reaction, react with raised hands emoji
1
Add reaction…
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
creator не се показва и при два типа и groups показваме само
creator не се показва и при два типа и groups показваме само
Shift + Return to add a new line
Shift + Return
to add a new line
Todor Stamatov, Direct Message, 1 of 15 suggestions
Aneliya Angelova: i towa za kiosk reportite.
iTerm2ShellEditViewSessionScriptsProfilesWindowHelpБГ100% <78-zsh* Build full day activity...• *4|DOCKER-zshworker-nudges:worker-nudges_00: started₴2-zshscreenpipe*What's next:Try Docker Debug for seamless, persistent debugging tools in any container or image + docker debug docker_lamp_1Learn moreat [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-18909-automated-reports-ask-jiminny) $ csfixdockerexec -it docker_lamp_1./vendor/bin/php-cs-fixer fix--config=.php-cs-fixer.dist.php -v --using-cache=no --diffPHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.PHPruntime:8.3.30Running analysis on 7 cores with 10 files per process.Parallel runner is an experimental feature and may be unstable, use it at your own risk. Feedback highly appreciated!Loadedconfigdefault from-php-cs-fixer.dist.php".5609/5609100%• ₴5-zsh86Tue 21 Apr 18:40:47APP (-zsh)181+Fixed 0 of 5609 files in 36.627 seconds, 60.00 MB memory usedWhat's next:Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-18909-automated-reports-ask-jiminny) $ ||...
|
67441
|
|
67444
|
1519
|
0
|
2026-04-21T15:41:07.663159+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776786067663_m2.jpg...
|
PhpStorm
|
faVsco.js – AutomatedReportsRepository.php
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsServiceTest
Run 'AutomatedReportsServiceTest'
Debug 'AutomatedReportsServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
whereHas
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
3/3
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
16
7
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Repositories;
use Carbon\CarbonImmutable;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Facades\DB;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\Kiosk\AutomatedReports\ReportSort;
use Jiminny\Services\Kiosk\AutomatedReports\ReportSortDirection;
class AutomatedReportsRepository
{
/**
* Create a new automated report
*
* @param array $data
*
* @return AutomatedReport
*/
public function create(array $data): AutomatedReport
{
return AutomatedReport::create($data);
}
/**
* Find an automated report by UUID
*
* @param string $uuid
*
* @return AutomatedReport|null
*/
public function findByUuid(string $uuid): ?AutomatedReport
{
return AutomatedReport::where('uuid', AutomatedReport::toOptimized($uuid))->first();
}
public function findByIdOrUuid(string $idOrUuid): ?AutomatedReport
{
if (is_numeric($idOrUuid)) {
return AutomatedReport::find((int) $idOrUuid);
}
return AutomatedReport::where('uuid', AutomatedReport::toOptimized($idOrUuid))->first();
}
/**
* Retrieve all standard (non-Ask Jiminny) automated reports.
*
* @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.
* @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.
*
* @return Collection<AutomatedReport>
*/
public function getAllStandardReports(
string $sortColumn = 'created_at',
string $sortDirection = 'desc'
): Collection {
return $this->buildSortedQuery($sortColumn, $sortDirection)
->whereNot('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->get();
}
/**
* Retrieve all Ask Jiminny reports created by the given user.
*
* @param User $user The user whose reports to retrieve.
* @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.
* @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.
*
* @return Collection<AutomatedReport>
*/
public function getAskJiminnyReportsByUser(
User $user,
string $sortColumn = 'created_at',
string $sortDirection = 'desc'
): Collection {
return $this->buildSortedQuery($sortColumn, $sortDirection)
->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->where('created_by', $user->getId())
->get();
}
private function buildSortedQuery(string $sortColumn, string $sortDirection): \Illuminate\Database\Eloquent\Builder
{
$allowedColumns = ['created_by', 'created_at'];
if (! in_array($sortColumn, $allowedColumns)) {
$sortColumn = 'created_at';
}
$sortDirection = strtolower($sortDirection) === 'asc' ? 'asc' : 'desc';
$query = AutomatedReport::query()->with(['creator', 'team']);
if ($sortColumn === 'created_by') {
$query->leftJoin('users', 'users.id', '=', 'automated_reports.created_by')
->orderByRaw("users.name COLLATE utf8mb4_unicode_ci {$sortDirection}")
->select('automated_reports.*');
} else {
$query->orderBy($sortColumn, $sortDirection);
}
return $query;
}
/**
* Get all active Ask Jiminny reports whose expiry date has passed.
*
* @return Collection<AutomatedReport>
*/
public function getExpiredActiveAskJiminnyReports(): Collection
{
return AutomatedReport::where('status', true)
->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->whereNotNull('expires_at')
->where('expires_at', '<', now()->toDateString())
->get();
}
/**
* Get all active and enabled reports with active teams for the specified frequency.
*
* @param string $frequency
*
* @return Collection<AutomatedReport>
*/
public function getActiveReportsByFrequency(string $frequency): Collection
{
return AutomatedReport::where('automated_reports.status', true)
->where('automated_reports.frequency', $frequency)
->join('teams', 'automated_reports.team_id', '=', 'teams.id')
->where('teams.status', Team::STATUS_ACTIVE)
->where(function ($query) {
$query->whereNull('automated_reports.expires_at')
->orWhere('automated_reports.expires_at', '>=', now()->toDateString());
})
->select('automated_reports.*')
->get();
}
/**
* Update an automated report
*
* @param AutomatedReport $report
* @param array $data
*
* @return AutomatedReport
*/
public function update(AutomatedReport $report, array $data): AutomatedReport
{
$report->update($data);
return $report;
}
/**
* Create a new automated report result.
*
* @param array $data The data to create the automated report result with.
*
* @return AutomatedReportResult The newly created automated report result.
*/
public function createResult(array $data): AutomatedReportResult
{
return AutomatedReportResult::create($data);
}
/**
* Find an automated report result by UUID.
*
* @param string $uuid The UUID to find the automated report result with.
*
* @return AutomatedReportResult|null The automated report result if found, otherwise null.
*/
public function findResultByUuid(string $uuid): ?AutomatedReportResult
{
return AutomatedReportResult::where('uuid', AutomatedReportResult::toOptimized($uuid))->first();
}
public function findResultByUuidForUser(string $uuid, User $user): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('uuid', AutomatedReportResult::toOptimized($uuid))
->whereHas('report', static function ($query) use ($user): void {
$query->where('team_id', $user->getTeamId())
->where('created_by', $user->getId());
})
->first();
}
public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('parent_id', $result->getId())
->where('media_type', $type)
->first();
}
public function findLatestDefaultOrFailedResult(AutomatedReport $report): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('report_id', $report->getId())
->whereIn('status', [AutomatedReportResult::STATUS_DEFAULT, AutomatedReportResult::STATUS_FAILED])
->latest()
->first();
}
public function getGeneratedNotSentResults(): Collection
{
return AutomatedReportResult::query()
->whereNotNull('generated_at')
->whereNull('sent_at')
->where('status', AutomatedReportResult::STATUS_GENERATED)
->whereHas('report')
->with('report')
->get();
}
public function getPaginatedUserReports(
User $user,
ReportSort $sort,
ReportSortDirection $sortDirection,
int $resultsPerPage,
int $page,
?Carbon $fromDate,
?Carbon $toDate,
array $teamIds,
array $reportTypes,
?string $name,
): LengthAwarePaginator {
$query = AutomatedReportResult::query()
->whereNotNull('automated_report_results.generated_at')
->join('automated_reports', 'automated_report_results.report_id', '=', 'automated_reports.id')
->where(fn (Builder $q) => $this->applyUserAccessScope($q, $user))
->orderByRaw("$sort->value COLLATE utf8mb4_unicode_ci {$sortDirection->value}")
->select('automated_report_results.*')
->with('report.team');
if ($fromDate !== null && $toDate !== null) {
$query->whereBetween('generated_at', [$fromDate, $toDate]);
}
if (! empty($teamIds)) {
$query->where(function ($q) use ($teamIds) {
foreach ($teamIds as $id) {
$q->orWhereJsonContains('automated_reports.groups', $id);
}
});
}
if (! empty($reportTypes)) {
$query->whereIn('automated_reports.type', $reportTypes);
}
if (! empty($name)) {
$query->whereLike('name', "%$name%");
}
return $query->paginate($resultsPerPage, ['*'], 'page', $page);
}
public function countUserReports(User $user): int
{
return AutomatedReportResult::query()
->whereNotNull('generated_at')
->whereNotNull('sent_at')
->whereHas('report', function ($q) use ($user) {
$q->where('team_id', $user->getTeamId())
->whereJsonContains('recipients->users', $user->getId());
})
->count();
}
/**
* Restrict a query on the automated_reports table to reports the given user is allowed to see.
*
* Matches the customer-facing audience:
* - explicit user recipients (recipients.users)
* - members of any of the report's groups (Ask Jiminny reports)
*/
private function applyUserAccessScope(Builder $query, User $user): void
{
$userId = $user->getId();
$groupId = $user->getGroupId();
$query
->where('automated_reports.team_id', $user->getTeamId())
->where(function (Builder $q) use ($userId, $groupId): void {
$q->whereJsonContains('automated_reports.recipients->users', $userId);
if ($groupId !== null) {
$q->orWhere(function (Builder $sub) use ($groupId): void {
$sub->where('automated_reports.type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->whereJsonContains('automated_reports.groups', $groupId);
});
}
});
}
/**
* Get report IDs for a specific team
*
* @param Team $team
*
* @return \Illuminate\Support\Collection
*/
public function getReportIdsByTeam(Team $team): \Illuminate\Support\Collection
{
return AutomatedReport::where('team_id', $team->getId())->pluck('id');
}
/**
* Get all reports for a specific team
*
* @param Team $team
*
* @return Collection
*/
public function getReportsByTeam(Team $team): Collection
{
return AutomatedReport::where('team_id', $team->getId())->get();
}
/**
* Get all report results for a specific report
*
* @param AutomatedReport $report
*
* @return Collection
*/
public function getResultsByReport(AutomatedReport $report): Collection
{
return $this->getResultsByReportQuery($report)->get();
}
public function getResultsByReportQuery(AutomatedReport $report): Builder
{
return AutomatedReportResult::where('report_id', $report->getId());
}
public function getReportResultsQueryForRetention(Team $team, CarbonImmutable $retentionDate): Builder
{
$reportIds = $this->getReportIdsByTeam($team);
return AutomatedReportResult::query()->whereIn('report_id', $reportIds)
->whereRaw('IFNULL(generated_at, created_at) <= ?', [$retentionDate]);
}
/**
* @param int|null $teamId Optional team ID to filter results
*
* @return \Illuminate\Support\Collection<int, int> Collection of team IDs
*/
public function getTeamIdsWithReportsResults(?int $teamId = null): \Illuminate\Support\Collection
{
$query = DB::table('automated_reports')
->join('teams', 'automated_reports.team_id', '=', 'teams.id')
->select('teams.id')
->distinct();
if ($teamId !== null) {
$query->where('teams.id', $teamId);
}
return $query->pluck('teams.id');
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
18
14
2
4
Previous Highlighted Error
Next Highlighted Error
SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o
JOIN activities a ON o.id = a.opportunity_id
WHERE a.crm_configuration_id = 39
AND a.actual_start_time > '2025-10-13'
AND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')
;
SELECT * FROM activities
WHERE crm_configuration_id = 39 and user_id = 143
and actual_start_time >= '2025-10-13'
AND type IN ('conference', 'softphone-inbound', 'softphone-outbound')
;
SELECT * FROM opportunities WHERE account_id IN (178);
select * from activities where id IN (620137, 620187, 620188, 620189, 620230);
# HS
SELECT * FROM opportunities WHERE id IN (238);
select * from activities where id IN (477,2076);
select * from users;
SELECT COUNT(*) FROM users;
SELECT COUNT(*) FROM activities;
SELECT COUNT(*) FROM opportunities;
UPDATE activities
SET
actual_start_time = '2025-12-19 09:00:00',
actual_end_time = '2025-12-19 10:30:00',
scheduled_start_time = '2025-12-19 09:00:00',
scheduled_end_time = '2025-12-19 10:30:00'
WHERE id IN (407509,407375);
select * from partners;
SELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id
FROM activities
WHERE user_id = 143
AND actual_start_time >= '2025-10-13 00:00:00'
AND actual_start_time <= '2026-01-13 23:59:59'
ORDER BY actual_start_time DESC;
SELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;
SELECT * FROM crm_layouts where crm_configuration_id = 39;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;
# lead_id
# account_id 177
# contact_id 3969
# opportunity_id
# stage_id 203
SELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;
SELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'
AND user_id = 143 and actual_start_time >= '2025-10-13';
SELECT * FROM activities a
# JOIN opportunities o ON a.opportunity_id = o.id
WHERE a.crm_configuration_id = 39 AND a.type = 'conference'
and status = 'completed' and recording_state = 'recorded'
and a.actual_start_time >= '2025-10-13'
AND a.user_id = 143
;
select * from leads
where crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707
SELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);
SELECT * FROM activities WHERE id IN (356013,616188,616202,616310);
SELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198
SELECT * FROM activities WHERE id IN (356001, 356008); # contacts:
SELECT * FROM opportunities WHERE id IN (1707);
SELECT * FROM stages where id IN (204, 198);
SELECT * FROM opportunities WHERE account_id IN (178);
SELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';
SELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal
SELECT * FROM activities where crm_configuration_id = 39
AND opportunity_id IS NULL
AND is_internal = false
and status = 'completed' and recording_state = 'recorded'
AND actual_start_time >= '2025-10-13'
AND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)
# AND lead_id IN (112, 109)
;
SELECT * FROM crm_profiles WHERE user_id = 143;
select * from inboxes; # 212
select * from users where id = 143; # 143
select * from inbox_email_batches where inbox_id = 212
and updated_at >= '2026-01-28 00:00:00' order by id desc;
select * from inbox_emails where inbox_id = 212
and batch_id = 95885 order by id desc;
select * from email_messages where origin_user_id = 143;
select * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';
select * from participants where activity_id = 620247;
select * from crm_profiles where user_id = 143;
SELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001
select * from transcription where activity_id = 356001; # 6943
select * from ai_prompts where transcription_id = 6943;
SELECT * FROM activity_summary_logs where activity_id = 356001;
SELECT * FROM social_accounts WHERE sociable_id = 143;
# [PASSWORD_DOTS]
SELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;
# 422515 softphone tr. 8100
SELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;
# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS
select * from ai_prompts where transcription_id IN (8100, 7670);
select * from activity_summary_logs where activity_id = 407509;
select * from sidekick_settings;
select * from default_activity_types;
SELECT * FROM contacts WHERE crm_configuration_id = 39 and email = '[EMAIL]';
SELECT * FROM leads WHERE crm_configuration_id = 39 and email = '[EMAIL]';
SELECT * FROM activity_searches where user_id = 143;
SELECT * FROM groups where team_id = 1;
select * from teams where id = 1;
select * from groups where team_id = 1; # 1150 - 7e75f8025c22
select id, name, group_id, status, deleted_at, email
from users where team_id = 1 order by group_id desc ;
select * from activity_searches where id in (1977, 1978, 1979);
select * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);
select * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277
select * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879
INSERT INTO `activity_search_filters`
(`activity_search_id`, `filter`, `value`) VALUES
(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),
(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),
(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')
;
select * from crm_configurations where id = 39;
select sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id
where u.team_id = 1;
SELECT * FROM social_accounts WHERE sociable_id = 1635;
SELECT * FROM users WHERE id = 1635;
select * from teams where id = 1;
select * from users where team_id = 1;
select * from team_features where team_id = 1;
select * from features;
SELECT * FROM activity_searches where id = 1982; # 1981
SELECT * FROM activity_search_filters WHERE activity_search_id = 1982;
SELECT * FROM automated_reports where id = 68;
UPDATE automated_reports set playbook_categories = NULL where id = 68;
SELECT * FROM automated_report_results where id = 275;
SELECT * FROM automated_reports order by id desc;
SELECT * FROM automated_report_results order by id desc;
select * from activity_searches where user_id = 143;
select * from ask_anything_prompts;
SELECT * FROM groups WHERE id = 1439;
SELECT * FROM users WHERE group_id = 1439;
select * from permissions; # 158
select * from roles;
select * from permission_role
select * from teams where id = 1;
select * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;
select * from groups where id = 28;
select * from playbooks where team_id = 1;
select * from playbooks where id = 179;
select * from playbook_categories where id = 1391;
select * from users where id = 143;
select * from crm_profiles where user_id = 143;
select * from activities where crm_configuration_id = 39 and type = 'conference'
and crm_provider_id IS NOT NULL ORDER by id desc;
select * from activities where id = 422003; # 00UO400000pB6fpMAC
SELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type
FROM automated_report_results ar
JOIN automated_reports a ON a.id = ar.report_id
WHERE a.type = 'ask_jiminny'
LIMIT 10;
SELECT `automated_report_results`.* FROM `automated_report_results`
INNER JOIN `automated_reports`
ON `automated_report_results`.`report_id` = `automated_reports`.`id`
WHERE `automated_report_results`.`generated_at` IS NOT NULL
AND `automated_reports`.`team_id` = 1
AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$."users"')
;
select * from teams where id = 3143;
select * from crm_configurations where id = 500;
select * from users where name = 'Integration Account'; # 1695
SELECT * FROM social_accounts WHERE sociable_id = 1695;
select * from activities where crm_configuration_id = 39
and recording_state = 'recorded' and duration > 60
and status = 'completed' and actual_start_time >= '2025-12-01';
SELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;
select * from leads;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"bounds":{"left":0.025930852,"top":0.019952115,"width":0.03856383,"height":0.025538707},"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"#11894 on JY-18909-automated-reports-ask-jiminny, menu","depth":5,"bounds":{"left":0.064494684,"top":0.019952115,"width":0.12134308,"height":0.025538707},"help_text":"Pull request #11894 exists for current branch JY-18909-automated-reports-ask-jiminny","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"bounds":{"left":0.8218085,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AutomatedReportsServiceTest","depth":6,"bounds":{"left":0.83710104,"top":0.019952115,"width":0.078457445,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AutomatedReportsServiceTest'","depth":6,"bounds":{"left":0.9155585,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AutomatedReportsServiceTest'","depth":6,"bounds":{"left":0.9268617,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"bounds":{"left":0.9381649,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"bounds":{"left":0.96609044,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"bounds":{"left":0.9773936,"top":0.019952115,"width":0.011303191,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"bounds":{"left":0.9886968,"top":0.019952115,"width":0.011303186,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"bounds":{"left":0.12101064,"top":0.20430966,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"bounds":{"left":0.13364361,"top":0.20351157,"width":0.00731383,"height":0.017557861},"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"whereHas","depth":4,"bounds":{"left":0.14461437,"top":0.20351157,"width":0.06050532,"height":0.015961692},"value":"whereHas","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.21409574,"top":0.20351157,"width":0.00731383,"height":0.017557861},"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"bounds":{"left":0.22406915,"top":0.20351157,"width":0.00731383,"height":0.017557861},"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"bounds":{"left":0.23271276,"top":0.20351157,"width":0.00731383,"height":0.017557861},"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"bounds":{"left":0.24135639,"top":0.20351157,"width":0.00731383,"height":0.017557861},"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.27027926,"top":1.0,"width":0.00731383,"height":0.0},"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"3/3","depth":4,"bounds":{"left":0.2549867,"top":0.20271349,"width":0.025598405,"height":0.017557861},"role_description":"text"},{"role":"AXButton","text":"Previous Occurrence","depth":4,"bounds":{"left":0.2805851,"top":0.2019154,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Occurrence","depth":4,"bounds":{"left":0.28922874,"top":0.2019154,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Filter Search Results","depth":4,"bounds":{"left":0.29787233,"top":0.2019154,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open in Window, Multiple Cursors","depth":4,"bounds":{"left":0.30651596,"top":0.2019154,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Click to highlight","depth":4,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close","depth":4,"bounds":{"left":0.4870346,"top":0.2019154,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"16","depth":4,"bounds":{"left":0.4481383,"top":0.2330407,"width":0.009640957,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"7","depth":4,"bounds":{"left":0.45977393,"top":0.2330407,"width":0.0076462766,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"bounds":{"left":0.4694149,"top":0.2330407,"width":0.00731383,"height":0.015163607},"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.47839096,"top":0.23144454,"width":0.00731383,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.48570478,"top":0.23144454,"width":0.006981383,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Repositories;\n\nuse Carbon\\CarbonImmutable;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Database\\Eloquent\\Collection;\nuse Illuminate\\Pagination\\LengthAwarePaginator;\nuse Illuminate\\Support\\Facades\\DB;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\AutomatedReportsService;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\ReportSort;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\ReportSortDirection;\n\nclass AutomatedReportsRepository\n{\n /**\n * Create a new automated report\n *\n * @param array $data\n *\n * @return AutomatedReport\n */\n public function create(array $data): AutomatedReport\n {\n return AutomatedReport::create($data);\n }\n\n /**\n * Find an automated report by UUID\n *\n * @param string $uuid\n *\n * @return AutomatedReport|null\n */\n public function findByUuid(string $uuid): ?AutomatedReport\n {\n return AutomatedReport::where('uuid', AutomatedReport::toOptimized($uuid))->first();\n }\n\n public function findByIdOrUuid(string $idOrUuid): ?AutomatedReport\n {\n if (is_numeric($idOrUuid)) {\n return AutomatedReport::find((int) $idOrUuid);\n }\n\n return AutomatedReport::where('uuid', AutomatedReport::toOptimized($idOrUuid))->first();\n }\n\n /**\n * Retrieve all standard (non-Ask Jiminny) automated reports.\n *\n * @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.\n * @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.\n *\n * @return Collection<AutomatedReport>\n */\n public function getAllStandardReports(\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): Collection {\n return $this->buildSortedQuery($sortColumn, $sortDirection)\n ->whereNot('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->get();\n }\n\n /**\n * Retrieve all Ask Jiminny reports created by the given user.\n *\n * @param User $user The user whose reports to retrieve.\n * @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.\n * @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.\n *\n * @return Collection<AutomatedReport>\n */\n public function getAskJiminnyReportsByUser(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): Collection {\n return $this->buildSortedQuery($sortColumn, $sortDirection)\n ->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->where('created_by', $user->getId())\n ->get();\n }\n\n private function buildSortedQuery(string $sortColumn, string $sortDirection): \\Illuminate\\Database\\Eloquent\\Builder\n {\n $allowedColumns = ['created_by', 'created_at'];\n if (! in_array($sortColumn, $allowedColumns)) {\n $sortColumn = 'created_at';\n }\n\n $sortDirection = strtolower($sortDirection) === 'asc' ? 'asc' : 'desc';\n\n $query = AutomatedReport::query()->with(['creator', 'team']);\n\n if ($sortColumn === 'created_by') {\n $query->leftJoin('users', 'users.id', '=', 'automated_reports.created_by')\n ->orderByRaw(\"users.name COLLATE utf8mb4_unicode_ci {$sortDirection}\")\n ->select('automated_reports.*');\n } else {\n $query->orderBy($sortColumn, $sortDirection);\n }\n\n return $query;\n }\n\n /**\n * Get all active Ask Jiminny reports whose expiry date has passed.\n *\n * @return Collection<AutomatedReport>\n */\n public function getExpiredActiveAskJiminnyReports(): Collection\n {\n return AutomatedReport::where('status', true)\n ->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->whereNotNull('expires_at')\n ->where('expires_at', '<', now()->toDateString())\n ->get();\n }\n\n /**\n * Get all active and enabled reports with active teams for the specified frequency.\n *\n * @param string $frequency\n *\n * @return Collection<AutomatedReport>\n */\n public function getActiveReportsByFrequency(string $frequency): Collection\n {\n return AutomatedReport::where('automated_reports.status', true)\n ->where('automated_reports.frequency', $frequency)\n ->join('teams', 'automated_reports.team_id', '=', 'teams.id')\n ->where('teams.status', Team::STATUS_ACTIVE)\n ->where(function ($query) {\n $query->whereNull('automated_reports.expires_at')\n ->orWhere('automated_reports.expires_at', '>=', now()->toDateString());\n })\n ->select('automated_reports.*')\n ->get();\n }\n\n /**\n * Update an automated report\n *\n * @param AutomatedReport $report\n * @param array $data\n *\n * @return AutomatedReport\n */\n public function update(AutomatedReport $report, array $data): AutomatedReport\n {\n $report->update($data);\n\n return $report;\n }\n\n /**\n * Create a new automated report result.\n *\n * @param array $data The data to create the automated report result with.\n *\n * @return AutomatedReportResult The newly created automated report result.\n */\n public function createResult(array $data): AutomatedReportResult\n {\n return AutomatedReportResult::create($data);\n }\n\n /**\n * Find an automated report result by UUID.\n *\n * @param string $uuid The UUID to find the automated report result with.\n *\n * @return AutomatedReportResult|null The automated report result if found, otherwise null.\n */\n public function findResultByUuid(string $uuid): ?AutomatedReportResult\n {\n return AutomatedReportResult::where('uuid', AutomatedReportResult::toOptimized($uuid))->first();\n }\n\n public function findResultByUuidForUser(string $uuid, User $user): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('uuid', AutomatedReportResult::toOptimized($uuid))\n ->whereHas('report', static function ($query) use ($user): void {\n $query->where('team_id', $user->getTeamId())\n ->where('created_by', $user->getId());\n })\n ->first();\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('parent_id', $result->getId())\n ->where('media_type', $type)\n ->first();\n }\n\n public function findLatestDefaultOrFailedResult(AutomatedReport $report): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('report_id', $report->getId())\n ->whereIn('status', [AutomatedReportResult::STATUS_DEFAULT, AutomatedReportResult::STATUS_FAILED])\n ->latest()\n ->first();\n }\n\n public function getGeneratedNotSentResults(): Collection\n {\n return AutomatedReportResult::query()\n ->whereNotNull('generated_at')\n ->whereNull('sent_at')\n ->where('status', AutomatedReportResult::STATUS_GENERATED)\n ->whereHas('report')\n ->with('report')\n ->get();\n }\n\n public function getPaginatedUserReports(\n User $user,\n ReportSort $sort,\n ReportSortDirection $sortDirection,\n int $resultsPerPage,\n int $page,\n ?Carbon $fromDate,\n ?Carbon $toDate,\n array $teamIds,\n array $reportTypes,\n ?string $name,\n ): LengthAwarePaginator {\n $query = AutomatedReportResult::query()\n ->whereNotNull('automated_report_results.generated_at')\n ->join('automated_reports', 'automated_report_results.report_id', '=', 'automated_reports.id')\n ->where(fn (Builder $q) => $this->applyUserAccessScope($q, $user))\n ->orderByRaw(\"$sort->value COLLATE utf8mb4_unicode_ci {$sortDirection->value}\")\n ->select('automated_report_results.*')\n ->with('report.team');\n\n if ($fromDate !== null && $toDate !== null) {\n $query->whereBetween('generated_at', [$fromDate, $toDate]);\n }\n\n if (! empty($teamIds)) {\n $query->where(function ($q) use ($teamIds) {\n foreach ($teamIds as $id) {\n $q->orWhereJsonContains('automated_reports.groups', $id);\n }\n });\n }\n\n if (! empty($reportTypes)) {\n $query->whereIn('automated_reports.type', $reportTypes);\n }\n\n if (! empty($name)) {\n $query->whereLike('name', \"%$name%\");\n }\n\n return $query->paginate($resultsPerPage, ['*'], 'page', $page);\n }\n\n public function countUserReports(User $user): int\n {\n return AutomatedReportResult::query()\n ->whereNotNull('generated_at')\n ->whereNotNull('sent_at')\n ->whereHas('report', function ($q) use ($user) {\n $q->where('team_id', $user->getTeamId())\n ->whereJsonContains('recipients->users', $user->getId());\n })\n ->count();\n }\n\n /**\n * Restrict a query on the automated_reports table to reports the given user is allowed to see.\n *\n * Matches the customer-facing audience:\n * - explicit user recipients (recipients.users)\n * - members of any of the report's groups (Ask Jiminny reports)\n */\n private function applyUserAccessScope(Builder $query, User $user): void\n {\n $userId = $user->getId();\n $groupId = $user->getGroupId();\n\n $query\n ->where('automated_reports.team_id', $user->getTeamId())\n ->where(function (Builder $q) use ($userId, $groupId): void {\n $q->whereJsonContains('automated_reports.recipients->users', $userId);\n\n if ($groupId !== null) {\n $q->orWhere(function (Builder $sub) use ($groupId): void {\n $sub->where('automated_reports.type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->whereJsonContains('automated_reports.groups', $groupId);\n });\n }\n });\n }\n\n /**\n * Get report IDs for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Support\\Collection\n */\n public function getReportIdsByTeam(Team $team): \\Illuminate\\Support\\Collection\n {\n return AutomatedReport::where('team_id', $team->getId())->pluck('id');\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return Collection\n */\n public function getReportsByTeam(Team $team): Collection\n {\n return AutomatedReport::where('team_id', $team->getId())->get();\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return Collection\n */\n public function getResultsByReport(AutomatedReport $report): Collection\n {\n return $this->getResultsByReportQuery($report)->get();\n }\n\n public function getResultsByReportQuery(AutomatedReport $report): Builder\n {\n return AutomatedReportResult::where('report_id', $report->getId());\n }\n\n public function getReportResultsQueryForRetention(Team $team, CarbonImmutable $retentionDate): Builder\n {\n $reportIds = $this->getReportIdsByTeam($team);\n\n return AutomatedReportResult::query()->whereIn('report_id', $reportIds)\n ->whereRaw('IFNULL(generated_at, created_at) <= ?', [$retentionDate]);\n }\n\n /**\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return \\Illuminate\\Support\\Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): \\Illuminate\\Support\\Collection\n {\n $query = DB::table('automated_reports')\n ->join('teams', 'automated_reports.team_id', '=', 'teams.id')\n ->select('teams.id')\n ->distinct();\n\n if ($teamId !== null) {\n $query->where('teams.id', $teamId);\n }\n\n return $query->pluck('teams.id');\n }\n}","depth":4,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Repositories;\n\nuse Carbon\\CarbonImmutable;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Database\\Eloquent\\Collection;\nuse Illuminate\\Pagination\\LengthAwarePaginator;\nuse Illuminate\\Support\\Facades\\DB;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\AutomatedReportsService;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\ReportSort;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\ReportSortDirection;\n\nclass AutomatedReportsRepository\n{\n /**\n * Create a new automated report\n *\n * @param array $data\n *\n * @return AutomatedReport\n */\n public function create(array $data): AutomatedReport\n {\n return AutomatedReport::create($data);\n }\n\n /**\n * Find an automated report by UUID\n *\n * @param string $uuid\n *\n * @return AutomatedReport|null\n */\n public function findByUuid(string $uuid): ?AutomatedReport\n {\n return AutomatedReport::where('uuid', AutomatedReport::toOptimized($uuid))->first();\n }\n\n public function findByIdOrUuid(string $idOrUuid): ?AutomatedReport\n {\n if (is_numeric($idOrUuid)) {\n return AutomatedReport::find((int) $idOrUuid);\n }\n\n return AutomatedReport::where('uuid', AutomatedReport::toOptimized($idOrUuid))->first();\n }\n\n /**\n * Retrieve all standard (non-Ask Jiminny) automated reports.\n *\n * @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.\n * @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.\n *\n * @return Collection<AutomatedReport>\n */\n public function getAllStandardReports(\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): Collection {\n return $this->buildSortedQuery($sortColumn, $sortDirection)\n ->whereNot('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->get();\n }\n\n /**\n * Retrieve all Ask Jiminny reports created by the given user.\n *\n * @param User $user The user whose reports to retrieve.\n * @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.\n * @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.\n *\n * @return Collection<AutomatedReport>\n */\n public function getAskJiminnyReportsByUser(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): Collection {\n return $this->buildSortedQuery($sortColumn, $sortDirection)\n ->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->where('created_by', $user->getId())\n ->get();\n }\n\n private function buildSortedQuery(string $sortColumn, string $sortDirection): \\Illuminate\\Database\\Eloquent\\Builder\n {\n $allowedColumns = ['created_by', 'created_at'];\n if (! in_array($sortColumn, $allowedColumns)) {\n $sortColumn = 'created_at';\n }\n\n $sortDirection = strtolower($sortDirection) === 'asc' ? 'asc' : 'desc';\n\n $query = AutomatedReport::query()->with(['creator', 'team']);\n\n if ($sortColumn === 'created_by') {\n $query->leftJoin('users', 'users.id', '=', 'automated_reports.created_by')\n ->orderByRaw(\"users.name COLLATE utf8mb4_unicode_ci {$sortDirection}\")\n ->select('automated_reports.*');\n } else {\n $query->orderBy($sortColumn, $sortDirection);\n }\n\n return $query;\n }\n\n /**\n * Get all active Ask Jiminny reports whose expiry date has passed.\n *\n * @return Collection<AutomatedReport>\n */\n public function getExpiredActiveAskJiminnyReports(): Collection\n {\n return AutomatedReport::where('status', true)\n ->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->whereNotNull('expires_at')\n ->where('expires_at', '<', now()->toDateString())\n ->get();\n }\n\n /**\n * Get all active and enabled reports with active teams for the specified frequency.\n *\n * @param string $frequency\n *\n * @return Collection<AutomatedReport>\n */\n public function getActiveReportsByFrequency(string $frequency): Collection\n {\n return AutomatedReport::where('automated_reports.status', true)\n ->where('automated_reports.frequency', $frequency)\n ->join('teams', 'automated_reports.team_id', '=', 'teams.id')\n ->where('teams.status', Team::STATUS_ACTIVE)\n ->where(function ($query) {\n $query->whereNull('automated_reports.expires_at')\n ->orWhere('automated_reports.expires_at', '>=', now()->toDateString());\n })\n ->select('automated_reports.*')\n ->get();\n }\n\n /**\n * Update an automated report\n *\n * @param AutomatedReport $report\n * @param array $data\n *\n * @return AutomatedReport\n */\n public function update(AutomatedReport $report, array $data): AutomatedReport\n {\n $report->update($data);\n\n return $report;\n }\n\n /**\n * Create a new automated report result.\n *\n * @param array $data The data to create the automated report result with.\n *\n * @return AutomatedReportResult The newly created automated report result.\n */\n public function createResult(array $data): AutomatedReportResult\n {\n return AutomatedReportResult::create($data);\n }\n\n /**\n * Find an automated report result by UUID.\n *\n * @param string $uuid The UUID to find the automated report result with.\n *\n * @return AutomatedReportResult|null The automated report result if found, otherwise null.\n */\n public function findResultByUuid(string $uuid): ?AutomatedReportResult\n {\n return AutomatedReportResult::where('uuid', AutomatedReportResult::toOptimized($uuid))->first();\n }\n\n public function findResultByUuidForUser(string $uuid, User $user): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('uuid', AutomatedReportResult::toOptimized($uuid))\n ->whereHas('report', static function ($query) use ($user): void {\n $query->where('team_id', $user->getTeamId())\n ->where('created_by', $user->getId());\n })\n ->first();\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('parent_id', $result->getId())\n ->where('media_type', $type)\n ->first();\n }\n\n public function findLatestDefaultOrFailedResult(AutomatedReport $report): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('report_id', $report->getId())\n ->whereIn('status', [AutomatedReportResult::STATUS_DEFAULT, AutomatedReportResult::STATUS_FAILED])\n ->latest()\n ->first();\n }\n\n public function getGeneratedNotSentResults(): Collection\n {\n return AutomatedReportResult::query()\n ->whereNotNull('generated_at')\n ->whereNull('sent_at')\n ->where('status', AutomatedReportResult::STATUS_GENERATED)\n ->whereHas('report')\n ->with('report')\n ->get();\n }\n\n public function getPaginatedUserReports(\n User $user,\n ReportSort $sort,\n ReportSortDirection $sortDirection,\n int $resultsPerPage,\n int $page,\n ?Carbon $fromDate,\n ?Carbon $toDate,\n array $teamIds,\n array $reportTypes,\n ?string $name,\n ): LengthAwarePaginator {\n $query = AutomatedReportResult::query()\n ->whereNotNull('automated_report_results.generated_at')\n ->join('automated_reports', 'automated_report_results.report_id', '=', 'automated_reports.id')\n ->where(fn (Builder $q) => $this->applyUserAccessScope($q, $user))\n ->orderByRaw(\"$sort->value COLLATE utf8mb4_unicode_ci {$sortDirection->value}\")\n ->select('automated_report_results.*')\n ->with('report.team');\n\n if ($fromDate !== null && $toDate !== null) {\n $query->whereBetween('generated_at', [$fromDate, $toDate]);\n }\n\n if (! empty($teamIds)) {\n $query->where(function ($q) use ($teamIds) {\n foreach ($teamIds as $id) {\n $q->orWhereJsonContains('automated_reports.groups', $id);\n }\n });\n }\n\n if (! empty($reportTypes)) {\n $query->whereIn('automated_reports.type', $reportTypes);\n }\n\n if (! empty($name)) {\n $query->whereLike('name', \"%$name%\");\n }\n\n return $query->paginate($resultsPerPage, ['*'], 'page', $page);\n }\n\n public function countUserReports(User $user): int\n {\n return AutomatedReportResult::query()\n ->whereNotNull('generated_at')\n ->whereNotNull('sent_at')\n ->whereHas('report', function ($q) use ($user) {\n $q->where('team_id', $user->getTeamId())\n ->whereJsonContains('recipients->users', $user->getId());\n })\n ->count();\n }\n\n /**\n * Restrict a query on the automated_reports table to reports the given user is allowed to see.\n *\n * Matches the customer-facing audience:\n * - explicit user recipients (recipients.users)\n * - members of any of the report's groups (Ask Jiminny reports)\n */\n private function applyUserAccessScope(Builder $query, User $user): void\n {\n $userId = $user->getId();\n $groupId = $user->getGroupId();\n\n $query\n ->where('automated_reports.team_id', $user->getTeamId())\n ->where(function (Builder $q) use ($userId, $groupId): void {\n $q->whereJsonContains('automated_reports.recipients->users', $userId);\n\n if ($groupId !== null) {\n $q->orWhere(function (Builder $sub) use ($groupId): void {\n $sub->where('automated_reports.type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->whereJsonContains('automated_reports.groups', $groupId);\n });\n }\n });\n }\n\n /**\n * Get report IDs for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Support\\Collection\n */\n public function getReportIdsByTeam(Team $team): \\Illuminate\\Support\\Collection\n {\n return AutomatedReport::where('team_id', $team->getId())->pluck('id');\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return Collection\n */\n public function getReportsByTeam(Team $team): Collection\n {\n return AutomatedReport::where('team_id', $team->getId())->get();\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return Collection\n */\n public function getResultsByReport(AutomatedReport $report): Collection\n {\n return $this->getResultsByReportQuery($report)->get();\n }\n\n public function getResultsByReportQuery(AutomatedReport $report): Builder\n {\n return AutomatedReportResult::where('report_id', $report->getId());\n }\n\n public function getReportResultsQueryForRetention(Team $team, CarbonImmutable $retentionDate): Builder\n {\n $reportIds = $this->getReportIdsByTeam($team);\n\n return AutomatedReportResult::query()->whereIn('report_id', $reportIds)\n ->whereRaw('IFNULL(generated_at, created_at) <= ?', [$retentionDate]);\n }\n\n /**\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return \\Illuminate\\Support\\Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): \\Illuminate\\Support\\Collection\n {\n $query = DB::table('automated_reports')\n ->join('teams', 'automated_reports.team_id', '=', 'teams.id')\n ->select('teams.id')\n ->distinct();\n\n if ($teamId !== null) {\n $query->where('teams.id', $teamId);\n }\n\n return $query->pluck('teams.id');\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"bounds":{"left":0.50166225,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"bounds":{"left":0.5103058,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"bounds":{"left":0.5212766,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"bounds":{"left":0.5299202,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"bounds":{"left":0.53856385,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"bounds":{"left":0.54953456,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"bounds":{"left":0.56050533,"top":0.14844373,"width":0.024268618,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"bounds":{"left":0.58710104,"top":0.14844373,"width":0.008643617,"height":0.01915403},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"bounds":{"left":0.5980718,"top":0.14844373,"width":0.029587766,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"bounds":{"left":0.6599069,"top":0.14844373,"width":0.02825798,"height":0.01915403},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.042220745,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"18","depth":4,"bounds":{"left":0.63231385,"top":0.17318435,"width":0.009640957,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"14","depth":4,"bounds":{"left":0.64394945,"top":0.17318435,"width":0.009640957,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"2","depth":4,"bounds":{"left":0.6555851,"top":0.17318435,"width":0.007978723,"height":0.015163607},"role_description":"text"},{"role":"AXStaticText","text":"4","depth":4,"bounds":{"left":0.6655585,"top":0.17318435,"width":0.007978723,"height":0.015163607},"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"bounds":{"left":0.67519945,"top":0.17158818,"width":0.00731383,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"bounds":{"left":0.6825133,"top":0.17158818,"width":0.006981383,"height":0.018355945},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o\nJOIN activities a ON o.id = a.opportunity_id\nWHERE a.crm_configuration_id = 39\nAND a.actual_start_time > '2025-10-13'\nAND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM activities\nWHERE crm_configuration_id = 39 and user_id = 143\nand actual_start_time >= '2025-10-13'\nAND type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM opportunities WHERE account_id IN (178);\nselect * from activities where id IN (620137, 620187, 620188, 620189, 620230);\n\n# HS\nSELECT * FROM opportunities WHERE id IN (238);\nselect * from activities where id IN (477,2076);\n\nselect * from users;\n\nSELECT COUNT(*) FROM users;\nSELECT COUNT(*) FROM activities;\nSELECT COUNT(*) FROM opportunities;\n\nUPDATE activities\nSET\n actual_start_time = '2025-12-19 09:00:00',\n actual_end_time = '2025-12-19 10:30:00',\n scheduled_start_time = '2025-12-19 09:00:00',\n scheduled_end_time = '2025-12-19 10:30:00'\nWHERE id IN (407509,407375);\n\nselect * from partners;\n\nSELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id\nFROM activities\nWHERE user_id = 143\nAND actual_start_time >= '2025-10-13 00:00:00'\nAND actual_start_time <= '2026-01-13 23:59:59'\nORDER BY actual_start_time DESC;\n\nSELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;\nSELECT * FROM crm_layouts where crm_configuration_id = 39;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;\n# lead_id\n# account_id 177\n# contact_id 3969\n# opportunity_id\n# stage_id 203\n\nSELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;\n\nSELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'\nAND user_id = 143 and actual_start_time >= '2025-10-13';\n\nSELECT * FROM activities a\n# JOIN opportunities o ON a.opportunity_id = o.id\nWHERE a.crm_configuration_id = 39 AND a.type = 'conference'\nand status = 'completed' and recording_state = 'recorded'\nand a.actual_start_time >= '2025-10-13'\nAND a.user_id = 143\n;\n\nselect * from leads\nwhere crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707\n\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310);\nSELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198\nSELECT * FROM activities WHERE id IN (356001, 356008); # contacts:\n\nSELECT * FROM opportunities WHERE id IN (1707);\nSELECT * FROM stages where id IN (204, 198);\nSELECT * FROM opportunities WHERE account_id IN (178);\nSELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';\nSELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal\n\nSELECT * FROM activities where crm_configuration_id = 39\nAND opportunity_id IS NULL\nAND is_internal = false\nand status = 'completed' and recording_state = 'recorded'\nAND actual_start_time >= '2025-10-13'\nAND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)\n# AND lead_id IN (112, 109)\n;\n\nSELECT * FROM crm_profiles WHERE user_id = 143;\n\nselect * from inboxes; # 212\nselect * from users where id = 143; # 143\nselect * from inbox_email_batches where inbox_id = 212\nand updated_at >= '2026-01-28 00:00:00' order by id desc;\nselect * from inbox_emails where inbox_id = 212\nand batch_id = 95885 order by id desc;\nselect * from email_messages where origin_user_id = 143;\nselect * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';\nselect * from participants where activity_id = 620247;\n\nselect * from crm_profiles where user_id = 143;\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001\nselect * from transcription where activity_id = 356001; # 6943\nselect * from ai_prompts where transcription_id = 6943;\nSELECT * FROM activity_summary_logs where activity_id = 356001;\n\nSELECT * FROM social_accounts WHERE sociable_id = 143;\n\n# ************************************************************************************\nSELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;\n# 422515 softphone tr. 8100\n\nSELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;\n# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS\n\nselect * from ai_prompts where transcription_id IN (8100, 7670);\nselect * from activity_summary_logs where activity_id = 407509;\n\nselect * from sidekick_settings;\nselect * from default_activity_types;\n\nSELECT * FROM contacts WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\nSELECT * FROM leads WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\n\nSELECT * FROM activity_searches where user_id = 143;\nSELECT * FROM groups where team_id = 1;\n\nselect * from teams where id = 1;\nselect * from groups where team_id = 1; # 1150 - 7e75f8025c22\nselect id, name, group_id, status, deleted_at, email\nfrom users where team_id = 1 order by group_id desc ;\n\nselect * from activity_searches where id in (1977, 1978, 1979);\nselect * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);\nselect * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277\nselect * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879\n\nINSERT INTO `activity_search_filters`\n(`activity_search_id`, `filter`, `value`) VALUES\n(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')\n;\n\nselect * from crm_configurations where id = 39;\n\n\nselect sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id\nwhere u.team_id = 1;\nSELECT * FROM social_accounts WHERE sociable_id = 1635;\nSELECT * FROM users WHERE id = 1635;\n\nselect * from teams where id = 1;\nselect * from users where team_id = 1;\nselect * from team_features where team_id = 1;\nselect * from features;\n\nSELECT * FROM activity_searches where id = 1982; # 1981\nSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;\n\nSELECT * FROM automated_reports where id = 68;\nUPDATE automated_reports set playbook_categories = NULL where id = 68;\nSELECT * FROM automated_report_results where id = 275;\n\nSELECT * FROM automated_reports order by id desc;\nSELECT * FROM automated_report_results order by id desc;\nselect * from activity_searches where user_id = 143;\nselect * from ask_anything_prompts;\n\nSELECT * FROM groups WHERE id = 1439;\nSELECT * FROM users WHERE group_id = 1439;\n\nselect * from permissions; # 158\nselect * from roles;\nselect * from permission_role\n\nselect * from teams where id = 1;\nselect * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;\nselect * from groups where id = 28;\nselect * from playbooks where team_id = 1;\nselect * from playbooks where id = 179;\nselect * from playbook_categories where id = 1391;\nselect * from users where id = 143;\nselect * from crm_profiles where user_id = 143;\nselect * from activities where crm_configuration_id = 39 and type = 'conference'\nand crm_provider_id IS NOT NULL ORDER by id desc;\nselect * from activities where id = 422003; # 00UO400000pB6fpMAC\n\nSELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type\nFROM automated_report_results ar\nJOIN automated_reports a ON a.id = ar.report_id\nWHERE a.type = 'ask_jiminny'\nLIMIT 10;\n\nSELECT `automated_report_results`.* FROM `automated_report_results`\nINNER JOIN `automated_reports`\n ON `automated_report_results`.`report_id` = `automated_reports`.`id`\nWHERE `automated_report_results`.`generated_at` IS NOT NULL\n AND `automated_reports`.`team_id` = 1\n AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$.\"users\"')\n;\n\n\nselect * from teams where id = 3143;\nselect * from crm_configurations where id = 500;\nselect * from users where name = 'Integration Account'; # 1695\nSELECT * FROM social_accounts WHERE sociable_id = 1695;\n\nselect * from activities where crm_configuration_id = 39\nand recording_state = 'recorded' and duration > 60\nand status = 'completed' and actual_start_time >= '2025-12-01';\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;\n\nselect * from leads;","depth":4,"value":"SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o\nJOIN activities a ON o.id = a.opportunity_id\nWHERE a.crm_configuration_id = 39\nAND a.actual_start_time > '2025-10-13'\nAND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM activities\nWHERE crm_configuration_id = 39 and user_id = 143\nand actual_start_time >= '2025-10-13'\nAND type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM opportunities WHERE account_id IN (178);\nselect * from activities where id IN (620137, 620187, 620188, 620189, 620230);\n\n# HS\nSELECT * FROM opportunities WHERE id IN (238);\nselect * from activities where id IN (477,2076);\n\nselect * from users;\n\nSELECT COUNT(*) FROM users;\nSELECT COUNT(*) FROM activities;\nSELECT COUNT(*) FROM opportunities;\n\nUPDATE activities\nSET\n actual_start_time = '2025-12-19 09:00:00',\n actual_end_time = '2025-12-19 10:30:00',\n scheduled_start_time = '2025-12-19 09:00:00',\n scheduled_end_time = '2025-12-19 10:30:00'\nWHERE id IN (407509,407375);\n\nselect * from partners;\n\nSELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id\nFROM activities\nWHERE user_id = 143\nAND actual_start_time >= '2025-10-13 00:00:00'\nAND actual_start_time <= '2026-01-13 23:59:59'\nORDER BY actual_start_time DESC;\n\nSELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;\nSELECT * FROM crm_layouts where crm_configuration_id = 39;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;\n# lead_id\n# account_id 177\n# contact_id 3969\n# opportunity_id\n# stage_id 203\n\nSELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;\n\nSELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'\nAND user_id = 143 and actual_start_time >= '2025-10-13';\n\nSELECT * FROM activities a\n# JOIN opportunities o ON a.opportunity_id = o.id\nWHERE a.crm_configuration_id = 39 AND a.type = 'conference'\nand status = 'completed' and recording_state = 'recorded'\nand a.actual_start_time >= '2025-10-13'\nAND a.user_id = 143\n;\n\nselect * from leads\nwhere crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707\n\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310);\nSELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198\nSELECT * FROM activities WHERE id IN (356001, 356008); # contacts:\n\nSELECT * FROM opportunities WHERE id IN (1707);\nSELECT * FROM stages where id IN (204, 198);\nSELECT * FROM opportunities WHERE account_id IN (178);\nSELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';\nSELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal\n\nSELECT * FROM activities where crm_configuration_id = 39\nAND opportunity_id IS NULL\nAND is_internal = false\nand status = 'completed' and recording_state = 'recorded'\nAND actual_start_time >= '2025-10-13'\nAND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)\n# AND lead_id IN (112, 109)\n;\n\nSELECT * FROM crm_profiles WHERE user_id = 143;\n\nselect * from inboxes; # 212\nselect * from users where id = 143; # 143\nselect * from inbox_email_batches where inbox_id = 212\nand updated_at >= '2026-01-28 00:00:00' order by id desc;\nselect * from inbox_emails where inbox_id = 212\nand batch_id = 95885 order by id desc;\nselect * from email_messages where origin_user_id = 143;\nselect * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';\nselect * from participants where activity_id = 620247;\n\nselect * from crm_profiles where user_id = 143;\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001\nselect * from transcription where activity_id = 356001; # 6943\nselect * from ai_prompts where transcription_id = 6943;\nSELECT * FROM activity_summary_logs where activity_id = 356001;\n\nSELECT * FROM social_accounts WHERE sociable_id = 143;\n\n# ************************************************************************************\nSELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;\n# 422515 softphone tr. 8100\n\nSELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;\n# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS\n\nselect * from ai_prompts where transcription_id IN (8100, 7670);\nselect * from activity_summary_logs where activity_id = 407509;\n\nselect * from sidekick_settings;\nselect * from default_activity_types;\n\nSELECT * FROM contacts WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\nSELECT * FROM leads WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\n\nSELECT * FROM activity_searches where user_id = 143;\nSELECT * FROM groups where team_id = 1;\n\nselect * from teams where id = 1;\nselect * from groups where team_id = 1; # 1150 - 7e75f8025c22\nselect id, name, group_id, status, deleted_at, email\nfrom users where team_id = 1 order by group_id desc ;\n\nselect * from activity_searches where id in (1977, 1978, 1979);\nselect * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);\nselect * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277\nselect * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879\n\nINSERT INTO `activity_search_filters`\n(`activity_search_id`, `filter`, `value`) VALUES\n(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')\n;\n\nselect * from crm_configurations where id = 39;\n\n\nselect sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id\nwhere u.team_id = 1;\nSELECT * FROM social_accounts WHERE sociable_id = 1635;\nSELECT * FROM users WHERE id = 1635;\n\nselect * from teams where id = 1;\nselect * from users where team_id = 1;\nselect * from team_features where team_id = 1;\nselect * from features;\n\nSELECT * FROM activity_searches where id = 1982; # 1981\nSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;\n\nSELECT * FROM automated_reports where id = 68;\nUPDATE automated_reports set playbook_categories = NULL where id = 68;\nSELECT * FROM automated_report_results where id = 275;\n\nSELECT * FROM automated_reports order by id desc;\nSELECT * FROM automated_report_results order by id desc;\nselect * from activity_searches where user_id = 143;\nselect * from ask_anything_prompts;\n\nSELECT * FROM groups WHERE id = 1439;\nSELECT * FROM users WHERE group_id = 1439;\n\nselect * from permissions; # 158\nselect * from roles;\nselect * from permission_role\n\nselect * from teams where id = 1;\nselect * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;\nselect * from groups where id = 28;\nselect * from playbooks where team_id = 1;\nselect * from playbooks where id = 179;\nselect * from playbook_categories where id = 1391;\nselect * from users where id = 143;\nselect * from crm_profiles where user_id = 143;\nselect * from activities where crm_configuration_id = 39 and type = 'conference'\nand crm_provider_id IS NOT NULL ORDER by id desc;\nselect * from activities where id = 422003; # 00UO400000pB6fpMAC\n\nSELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type\nFROM automated_report_results ar\nJOIN automated_reports a ON a.id = ar.report_id\nWHERE a.type = 'ask_jiminny'\nLIMIT 10;\n\nSELECT `automated_report_results`.* FROM `automated_report_results`\nINNER JOIN `automated_reports`\n ON `automated_report_results`.`report_id` = `automated_reports`.`id`\nWHERE `automated_report_results`.`generated_at` IS NOT NULL\n AND `automated_reports`.`team_id` = 1\n AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$.\"users\"')\n;\n\n\nselect * from teams where id = 3143;\nselect * from crm_configurations where id = 500;\nselect * from users where name = 'Integration Account'; # 1695\nSELECT * FROM social_accounts WHERE sociable_id = 1695;\n\nselect * from activities where crm_configuration_id = 39\nand recording_state = 'recorded' and duration > 60\nand status = 'completed' and actual_start_time >= '2025-12-01';\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;\n\nselect * from leads;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"bounds":{"left":0.011968086,"top":0.047885075,"width":0.024268618,"height":0.024740623},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.27027926,"top":1.0,"width":0.008643617,"height":0.0},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
5262134208844209929
|
-2393068234934446523
|
visual_change
|
accessibility
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsServiceTest
Run 'AutomatedReportsServiceTest'
Debug 'AutomatedReportsServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
whereHas
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
3/3
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
16
7
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Repositories;
use Carbon\CarbonImmutable;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Facades\DB;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\Kiosk\AutomatedReports\ReportSort;
use Jiminny\Services\Kiosk\AutomatedReports\ReportSortDirection;
class AutomatedReportsRepository
{
/**
* Create a new automated report
*
* @param array $data
*
* @return AutomatedReport
*/
public function create(array $data): AutomatedReport
{
return AutomatedReport::create($data);
}
/**
* Find an automated report by UUID
*
* @param string $uuid
*
* @return AutomatedReport|null
*/
public function findByUuid(string $uuid): ?AutomatedReport
{
return AutomatedReport::where('uuid', AutomatedReport::toOptimized($uuid))->first();
}
public function findByIdOrUuid(string $idOrUuid): ?AutomatedReport
{
if (is_numeric($idOrUuid)) {
return AutomatedReport::find((int) $idOrUuid);
}
return AutomatedReport::where('uuid', AutomatedReport::toOptimized($idOrUuid))->first();
}
/**
* Retrieve all standard (non-Ask Jiminny) automated reports.
*
* @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.
* @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.
*
* @return Collection<AutomatedReport>
*/
public function getAllStandardReports(
string $sortColumn = 'created_at',
string $sortDirection = 'desc'
): Collection {
return $this->buildSortedQuery($sortColumn, $sortDirection)
->whereNot('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->get();
}
/**
* Retrieve all Ask Jiminny reports created by the given user.
*
* @param User $user The user whose reports to retrieve.
* @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.
* @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.
*
* @return Collection<AutomatedReport>
*/
public function getAskJiminnyReportsByUser(
User $user,
string $sortColumn = 'created_at',
string $sortDirection = 'desc'
): Collection {
return $this->buildSortedQuery($sortColumn, $sortDirection)
->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->where('created_by', $user->getId())
->get();
}
private function buildSortedQuery(string $sortColumn, string $sortDirection): \Illuminate\Database\Eloquent\Builder
{
$allowedColumns = ['created_by', 'created_at'];
if (! in_array($sortColumn, $allowedColumns)) {
$sortColumn = 'created_at';
}
$sortDirection = strtolower($sortDirection) === 'asc' ? 'asc' : 'desc';
$query = AutomatedReport::query()->with(['creator', 'team']);
if ($sortColumn === 'created_by') {
$query->leftJoin('users', 'users.id', '=', 'automated_reports.created_by')
->orderByRaw("users.name COLLATE utf8mb4_unicode_ci {$sortDirection}")
->select('automated_reports.*');
} else {
$query->orderBy($sortColumn, $sortDirection);
}
return $query;
}
/**
* Get all active Ask Jiminny reports whose expiry date has passed.
*
* @return Collection<AutomatedReport>
*/
public function getExpiredActiveAskJiminnyReports(): Collection
{
return AutomatedReport::where('status', true)
->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->whereNotNull('expires_at')
->where('expires_at', '<', now()->toDateString())
->get();
}
/**
* Get all active and enabled reports with active teams for the specified frequency.
*
* @param string $frequency
*
* @return Collection<AutomatedReport>
*/
public function getActiveReportsByFrequency(string $frequency): Collection
{
return AutomatedReport::where('automated_reports.status', true)
->where('automated_reports.frequency', $frequency)
->join('teams', 'automated_reports.team_id', '=', 'teams.id')
->where('teams.status', Team::STATUS_ACTIVE)
->where(function ($query) {
$query->whereNull('automated_reports.expires_at')
->orWhere('automated_reports.expires_at', '>=', now()->toDateString());
})
->select('automated_reports.*')
->get();
}
/**
* Update an automated report
*
* @param AutomatedReport $report
* @param array $data
*
* @return AutomatedReport
*/
public function update(AutomatedReport $report, array $data): AutomatedReport
{
$report->update($data);
return $report;
}
/**
* Create a new automated report result.
*
* @param array $data The data to create the automated report result with.
*
* @return AutomatedReportResult The newly created automated report result.
*/
public function createResult(array $data): AutomatedReportResult
{
return AutomatedReportResult::create($data);
}
/**
* Find an automated report result by UUID.
*
* @param string $uuid The UUID to find the automated report result with.
*
* @return AutomatedReportResult|null The automated report result if found, otherwise null.
*/
public function findResultByUuid(string $uuid): ?AutomatedReportResult
{
return AutomatedReportResult::where('uuid', AutomatedReportResult::toOptimized($uuid))->first();
}
public function findResultByUuidForUser(string $uuid, User $user): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('uuid', AutomatedReportResult::toOptimized($uuid))
->whereHas('report', static function ($query) use ($user): void {
$query->where('team_id', $user->getTeamId())
->where('created_by', $user->getId());
})
->first();
}
public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('parent_id', $result->getId())
->where('media_type', $type)
->first();
}
public function findLatestDefaultOrFailedResult(AutomatedReport $report): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('report_id', $report->getId())
->whereIn('status', [AutomatedReportResult::STATUS_DEFAULT, AutomatedReportResult::STATUS_FAILED])
->latest()
->first();
}
public function getGeneratedNotSentResults(): Collection
{
return AutomatedReportResult::query()
->whereNotNull('generated_at')
->whereNull('sent_at')
->where('status', AutomatedReportResult::STATUS_GENERATED)
->whereHas('report')
->with('report')
->get();
}
public function getPaginatedUserReports(
User $user,
ReportSort $sort,
ReportSortDirection $sortDirection,
int $resultsPerPage,
int $page,
?Carbon $fromDate,
?Carbon $toDate,
array $teamIds,
array $reportTypes,
?string $name,
): LengthAwarePaginator {
$query = AutomatedReportResult::query()
->whereNotNull('automated_report_results.generated_at')
->join('automated_reports', 'automated_report_results.report_id', '=', 'automated_reports.id')
->where(fn (Builder $q) => $this->applyUserAccessScope($q, $user))
->orderByRaw("$sort->value COLLATE utf8mb4_unicode_ci {$sortDirection->value}")
->select('automated_report_results.*')
->with('report.team');
if ($fromDate !== null && $toDate !== null) {
$query->whereBetween('generated_at', [$fromDate, $toDate]);
}
if (! empty($teamIds)) {
$query->where(function ($q) use ($teamIds) {
foreach ($teamIds as $id) {
$q->orWhereJsonContains('automated_reports.groups', $id);
}
});
}
if (! empty($reportTypes)) {
$query->whereIn('automated_reports.type', $reportTypes);
}
if (! empty($name)) {
$query->whereLike('name', "%$name%");
}
return $query->paginate($resultsPerPage, ['*'], 'page', $page);
}
public function countUserReports(User $user): int
{
return AutomatedReportResult::query()
->whereNotNull('generated_at')
->whereNotNull('sent_at')
->whereHas('report', function ($q) use ($user) {
$q->where('team_id', $user->getTeamId())
->whereJsonContains('recipients->users', $user->getId());
})
->count();
}
/**
* Restrict a query on the automated_reports table to reports the given user is allowed to see.
*
* Matches the customer-facing audience:
* - explicit user recipients (recipients.users)
* - members of any of the report's groups (Ask Jiminny reports)
*/
private function applyUserAccessScope(Builder $query, User $user): void
{
$userId = $user->getId();
$groupId = $user->getGroupId();
$query
->where('automated_reports.team_id', $user->getTeamId())
->where(function (Builder $q) use ($userId, $groupId): void {
$q->whereJsonContains('automated_reports.recipients->users', $userId);
if ($groupId !== null) {
$q->orWhere(function (Builder $sub) use ($groupId): void {
$sub->where('automated_reports.type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->whereJsonContains('automated_reports.groups', $groupId);
});
}
});
}
/**
* Get report IDs for a specific team
*
* @param Team $team
*
* @return \Illuminate\Support\Collection
*/
public function getReportIdsByTeam(Team $team): \Illuminate\Support\Collection
{
return AutomatedReport::where('team_id', $team->getId())->pluck('id');
}
/**
* Get all reports for a specific team
*
* @param Team $team
*
* @return Collection
*/
public function getReportsByTeam(Team $team): Collection
{
return AutomatedReport::where('team_id', $team->getId())->get();
}
/**
* Get all report results for a specific report
*
* @param AutomatedReport $report
*
* @return Collection
*/
public function getResultsByReport(AutomatedReport $report): Collection
{
return $this->getResultsByReportQuery($report)->get();
}
public function getResultsByReportQuery(AutomatedReport $report): Builder
{
return AutomatedReportResult::where('report_id', $report->getId());
}
public function getReportResultsQueryForRetention(Team $team, CarbonImmutable $retentionDate): Builder
{
$reportIds = $this->getReportIdsByTeam($team);
return AutomatedReportResult::query()->whereIn('report_id', $reportIds)
->whereRaw('IFNULL(generated_at, created_at) <= ?', [$retentionDate]);
}
/**
* @param int|null $teamId Optional team ID to filter results
*
* @return \Illuminate\Support\Collection<int, int> Collection of team IDs
*/
public function getTeamIdsWithReportsResults(?int $teamId = null): \Illuminate\Support\Collection
{
$query = DB::table('automated_reports')
->join('teams', 'automated_reports.team_id', '=', 'teams.id')
->select('teams.id')
->distinct();
if ($teamId !== null) {
$query->where('teams.id', $teamId);
}
return $query->pluck('teams.id');
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
18
14
2
4
Previous Highlighted Error
Next Highlighted Error
SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o
JOIN activities a ON o.id = a.opportunity_id
WHERE a.crm_configuration_id = 39
AND a.actual_start_time > '2025-10-13'
AND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')
;
SELECT * FROM activities
WHERE crm_configuration_id = 39 and user_id = 143
and actual_start_time >= '2025-10-13'
AND type IN ('conference', 'softphone-inbound', 'softphone-outbound')
;
SELECT * FROM opportunities WHERE account_id IN (178);
select * from activities where id IN (620137, 620187, 620188, 620189, 620230);
# HS
SELECT * FROM opportunities WHERE id IN (238);
select * from activities where id IN (477,2076);
select * from users;
SELECT COUNT(*) FROM users;
SELECT COUNT(*) FROM activities;
SELECT COUNT(*) FROM opportunities;
UPDATE activities
SET
actual_start_time = '2025-12-19 09:00:00',
actual_end_time = '2025-12-19 10:30:00',
scheduled_start_time = '2025-12-19 09:00:00',
scheduled_end_time = '2025-12-19 10:30:00'
WHERE id IN (407509,407375);
select * from partners;
SELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id
FROM activities
WHERE user_id = 143
AND actual_start_time >= '2025-10-13 00:00:00'
AND actual_start_time <= '2026-01-13 23:59:59'
ORDER BY actual_start_time DESC;
SELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;
SELECT * FROM crm_layouts where crm_configuration_id = 39;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;
# lead_id
# account_id 177
# contact_id 3969
# opportunity_id
# stage_id 203
SELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;
SELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'
AND user_id = 143 and actual_start_time >= '2025-10-13';
SELECT * FROM activities a
# JOIN opportunities o ON a.opportunity_id = o.id
WHERE a.crm_configuration_id = 39 AND a.type = 'conference'
and status = 'completed' and recording_state = 'recorded'
and a.actual_start_time >= '2025-10-13'
AND a.user_id = 143
;
select * from leads
where crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707
SELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);
SELECT * FROM activities WHERE id IN (356013,616188,616202,616310);
SELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198
SELECT * FROM activities WHERE id IN (356001, 356008); # contacts:
SELECT * FROM opportunities WHERE id IN (1707);
SELECT * FROM stages where id IN (204, 198);
SELECT * FROM opportunities WHERE account_id IN (178);
SELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';
SELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal
SELECT * FROM activities where crm_configuration_id = 39
AND opportunity_id IS NULL
AND is_internal = false
and status = 'completed' and recording_state = 'recorded'
AND actual_start_time >= '2025-10-13'
AND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)
# AND lead_id IN (112, 109)
;
SELECT * FROM crm_profiles WHERE user_id = 143;
select * from inboxes; # 212
select * from users where id = 143; # 143
select * from inbox_email_batches where inbox_id = 212
and updated_at >= '2026-01-28 00:00:00' order by id desc;
select * from inbox_emails where inbox_id = 212
and batch_id = 95885 order by id desc;
select * from email_messages where origin_user_id = 143;
select * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';
select * from participants where activity_id = 620247;
select * from crm_profiles where user_id = 143;
SELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001
select * from transcription where activity_id = 356001; # 6943
select * from ai_prompts where transcription_id = 6943;
SELECT * FROM activity_summary_logs where activity_id = 356001;
SELECT * FROM social_accounts WHERE sociable_id = 143;
# [PASSWORD_DOTS]
SELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;
# 422515 softphone tr. 8100
SELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;
# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS
select * from ai_prompts where transcription_id IN (8100, 7670);
select * from activity_summary_logs where activity_id = 407509;
select * from sidekick_settings;
select * from default_activity_types;
SELECT * FROM contacts WHERE crm_configuration_id = 39 and email = '[EMAIL]';
SELECT * FROM leads WHERE crm_configuration_id = 39 and email = '[EMAIL]';
SELECT * FROM activity_searches where user_id = 143;
SELECT * FROM groups where team_id = 1;
select * from teams where id = 1;
select * from groups where team_id = 1; # 1150 - 7e75f8025c22
select id, name, group_id, status, deleted_at, email
from users where team_id = 1 order by group_id desc ;
select * from activity_searches where id in (1977, 1978, 1979);
select * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);
select * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277
select * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879
INSERT INTO `activity_search_filters`
(`activity_search_id`, `filter`, `value`) VALUES
(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),
(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),
(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')
;
select * from crm_configurations where id = 39;
select sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id
where u.team_id = 1;
SELECT * FROM social_accounts WHERE sociable_id = 1635;
SELECT * FROM users WHERE id = 1635;
select * from teams where id = 1;
select * from users where team_id = 1;
select * from team_features where team_id = 1;
select * from features;
SELECT * FROM activity_searches where id = 1982; # 1981
SELECT * FROM activity_search_filters WHERE activity_search_id = 1982;
SELECT * FROM automated_reports where id = 68;
UPDATE automated_reports set playbook_categories = NULL where id = 68;
SELECT * FROM automated_report_results where id = 275;
SELECT * FROM automated_reports order by id desc;
SELECT * FROM automated_report_results order by id desc;
select * from activity_searches where user_id = 143;
select * from ask_anything_prompts;
SELECT * FROM groups WHERE id = 1439;
SELECT * FROM users WHERE group_id = 1439;
select * from permissions; # 158
select * from roles;
select * from permission_role
select * from teams where id = 1;
select * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;
select * from groups where id = 28;
select * from playbooks where team_id = 1;
select * from playbooks where id = 179;
select * from playbook_categories where id = 1391;
select * from users where id = 143;
select * from crm_profiles where user_id = 143;
select * from activities where crm_configuration_id = 39 and type = 'conference'
and crm_provider_id IS NOT NULL ORDER by id desc;
select * from activities where id = 422003; # 00UO400000pB6fpMAC
SELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type
FROM automated_report_results ar
JOIN automated_reports a ON a.id = ar.report_id
WHERE a.type = 'ask_jiminny'
LIMIT 10;
SELECT `automated_report_results`.* FROM `automated_report_results`
INNER JOIN `automated_reports`
ON `automated_report_results`.`report_id` = `automated_reports`.`id`
WHERE `automated_report_results`.`generated_at` IS NOT NULL
AND `automated_reports`.`team_id` = 1
AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$."users"')
;
select * from teams where id = 3143;
select * from crm_configurations where id = 500;
select * from users where name = 'Integration Account'; # 1695
SELECT * FROM social_accounts WHERE sociable_id = 1695;
select * from activities where crm_configuration_id = 39
and recording_state = 'recorded' and duration > 60
and status = 'completed' and actual_start_time >= '2025-12-01';
SELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;
select * from leads;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
NULL
|
|
67445
|
1518
|
0
|
2026-04-21T15:41:15.828844+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776786075828_m1.jpg...
|
PhpStorm
|
faVsco.js – AutomatedReportsRepository.php
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsServiceTest
Run 'AutomatedReportsServiceTest'
Debug 'AutomatedReportsServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
whereHas
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
3/3
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
16
7
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Repositories;
use Carbon\CarbonImmutable;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Facades\DB;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\Kiosk\AutomatedReports\ReportSort;
use Jiminny\Services\Kiosk\AutomatedReports\ReportSortDirection;
class AutomatedReportsRepository
{
/**
* Create a new automated report
*
* @param array $data
*
* @return AutomatedReport
*/
public function create(array $data): AutomatedReport
{
return AutomatedReport::create($data);
}
/**
* Find an automated report by UUID
*
* @param string $uuid
*
* @return AutomatedReport|null
*/
public function findByUuid(string $uuid): ?AutomatedReport
{
return AutomatedReport::where('uuid', AutomatedReport::toOptimized($uuid))->first();
}
public function findByIdOrUuid(string $idOrUuid): ?AutomatedReport
{
if (is_numeric($idOrUuid)) {
return AutomatedReport::find((int) $idOrUuid);
}
return AutomatedReport::where('uuid', AutomatedReport::toOptimized($idOrUuid))->first();
}
/**
* Retrieve all standard (non-Ask Jiminny) automated reports.
*
* @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.
* @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.
*
* @return Collection<AutomatedReport>
*/
public function getAllStandardReports(
string $sortColumn = 'created_at',
string $sortDirection = 'desc'
): Collection {
return $this->buildSortedQuery($sortColumn, $sortDirection)
->whereNot('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->get();
}
/**
* Retrieve all Ask Jiminny reports created by the given user.
*
* @param User $user The user whose reports to retrieve.
* @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.
* @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.
*
* @return Collection<AutomatedReport>
*/
public function getAskJiminnyReportsByUser(
User $user,
string $sortColumn = 'created_at',
string $sortDirection = 'desc'
): Collection {
return $this->buildSortedQuery($sortColumn, $sortDirection)
->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->where('created_by', $user->getId())
->get();
}
private function buildSortedQuery(string $sortColumn, string $sortDirection): \Illuminate\Database\Eloquent\Builder
{
$allowedColumns = ['created_by', 'created_at'];
if (! in_array($sortColumn, $allowedColumns)) {
$sortColumn = 'created_at';
}
$sortDirection = strtolower($sortDirection) === 'asc' ? 'asc' : 'desc';
$query = AutomatedReport::query()->with(['creator', 'team']);
if ($sortColumn === 'created_by') {
$query->leftJoin('users', 'users.id', '=', 'automated_reports.created_by')
->orderByRaw("users.name COLLATE utf8mb4_unicode_ci {$sortDirection}")
->select('automated_reports.*');
} else {
$query->orderBy($sortColumn, $sortDirection);
}
return $query;
}
/**
* Get all active Ask Jiminny reports whose expiry date has passed.
*
* @return Collection<AutomatedReport>
*/
public function getExpiredActiveAskJiminnyReports(): Collection
{
return AutomatedReport::where('status', true)
->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->whereNotNull('expires_at')
->where('expires_at', '<', now()->toDateString())
->get();
}
/**
* Get all active and enabled reports with active teams for the specified frequency.
*
* @param string $frequency
*
* @return Collection<AutomatedReport>
*/
public function getActiveReportsByFrequency(string $frequency): Collection
{
return AutomatedReport::where('automated_reports.status', true)
->where('automated_reports.frequency', $frequency)
->join('teams', 'automated_reports.team_id', '=', 'teams.id')
->where('teams.status', Team::STATUS_ACTIVE)
->where(function ($query) {
$query->whereNull('automated_reports.expires_at')
->orWhere('automated_reports.expires_at', '>=', now()->toDateString());
})
->select('automated_reports.*')
->get();
}
/**
* Update an automated report
*
* @param AutomatedReport $report
* @param array $data
*
* @return AutomatedReport
*/
public function update(AutomatedReport $report, array $data): AutomatedReport
{
$report->update($data);
return $report;
}
/**
* Create a new automated report result.
*
* @param array $data The data to create the automated report result with.
*
* @return AutomatedReportResult The newly created automated report result.
*/
public function createResult(array $data): AutomatedReportResult
{
return AutomatedReportResult::create($data);
}
/**
* Find an automated report result by UUID.
*
* @param string $uuid The UUID to find the automated report result with.
*
* @return AutomatedReportResult|null The automated report result if found, otherwise null.
*/
public function findResultByUuid(string $uuid): ?AutomatedReportResult
{
return AutomatedReportResult::where('uuid', AutomatedReportResult::toOptimized($uuid))->first();
}
public function findResultByUuidForUser(string $uuid, User $user): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('uuid', AutomatedReportResult::toOptimized($uuid))
->whereHas('report', static function ($query) use ($user): void {
$query->where('team_id', $user->getTeamId())
->where('created_by', $user->getId());
})
->first();
}
public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('parent_id', $result->getId())
->where('media_type', $type)
->first();
}
public function findLatestDefaultOrFailedResult(AutomatedReport $report): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('report_id', $report->getId())
->whereIn('status', [AutomatedReportResult::STATUS_DEFAULT, AutomatedReportResult::STATUS_FAILED])
->latest()
->first();
}
public function getGeneratedNotSentResults(): Collection
{
return AutomatedReportResult::query()
->whereNotNull('generated_at')
->whereNull('sent_at')
->where('status', AutomatedReportResult::STATUS_GENERATED)
->whereHas('report')
->with('report')
->get();
}
public function getPaginatedUserReports(
User $user,
ReportSort $sort,
ReportSortDirection $sortDirection,
int $resultsPerPage,
int $page,
?Carbon $fromDate,
?Carbon $toDate,
array $teamIds,
array $reportTypes,
?string $name,
): LengthAwarePaginator {
$query = AutomatedReportResult::query()
->whereNotNull('automated_report_results.generated_at')
->join('automated_reports', 'automated_report_results.report_id', '=', 'automated_reports.id')
->where(fn (Builder $q) => $this->applyUserAccessScope($q, $user))
->orderByRaw("$sort->value COLLATE utf8mb4_unicode_ci {$sortDirection->value}")
->select('automated_report_results.*')
->with('report.team');
if ($fromDate !== null && $toDate !== null) {
$query->whereBetween('generated_at', [$fromDate, $toDate]);
}
if (! empty($teamIds)) {
$query->where(function ($q) use ($teamIds) {
foreach ($teamIds as $id) {
$q->orWhereJsonContains('automated_reports.groups', $id);
}
});
}
if (! empty($reportTypes)) {
$query->whereIn('automated_reports.type', $reportTypes);
}
if (! empty($name)) {
$query->whereLike('name', "%$name%");
}
return $query->paginate($resultsPerPage, ['*'], 'page', $page);
}
public function countUserReports(User $user): int
{
return AutomatedReportResult::query()
->whereNotNull('generated_at')
->whereNotNull('sent_at')
->whereHas('report', function ($q) use ($user) {
$q->where('team_id', $user->getTeamId())
->whereJsonContains('recipients->users', $user->getId());
})
->count();
}
/**
* Restrict a query on the automated_reports table to reports the given user is allowed to see.
*
* Matches the customer-facing audience:
* - explicit user recipients (recipients.users)
* - members of any of the report's groups (Ask Jiminny reports)
*/
private function applyUserAccessScope(Builder $query, User $user): void
{
$userId = $user->getId();
$groupId = $user->getGroupId();
$query
->where('automated_reports.team_id', $user->getTeamId())
->where(function (Builder $q) use ($userId, $groupId): void {
$q->whereJsonContains('automated_reports.recipients->users', $userId);
if ($groupId !== null) {
$q->orWhere(function (Builder $sub) use ($groupId): void {
$sub->where('automated_reports.type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->whereJsonContains('automated_reports.groups', $groupId);
});
}
});
}
/**
* Get report IDs for a specific team
*
* @param Team $team
*
* @return \Illuminate\Support\Collection
*/
public function getReportIdsByTeam(Team $team): \Illuminate\Support\Collection
{
return AutomatedReport::where('team_id', $team->getId())->pluck('id');
}
/**
* Get all reports for a specific team
*
* @param Team $team
*
* @return Collection
*/
public function getReportsByTeam(Team $team): Collection
{
return AutomatedReport::where('team_id', $team->getId())->get();
}
/**
* Get all report results for a specific report
*
* @param AutomatedReport $report
*
* @return Collection
*/
public function getResultsByReport(AutomatedReport $report): Collection
{
return $this->getResultsByReportQuery($report)->get();
}
public function getResultsByReportQuery(AutomatedReport $report): Builder
{
return AutomatedReportResult::where('report_id', $report->getId());
}
public function getReportResultsQueryForRetention(Team $team, CarbonImmutable $retentionDate): Builder
{
$reportIds = $this->getReportIdsByTeam($team);
return AutomatedReportResult::query()->whereIn('report_id', $reportIds)
->whereRaw('IFNULL(generated_at, created_at) <= ?', [$retentionDate]);
}
/**
* @param int|null $teamId Optional team ID to filter results
*
* @return \Illuminate\Support\Collection<int, int> Collection of team IDs
*/
public function getTeamIdsWithReportsResults(?int $teamId = null): \Illuminate\Support\Collection
{
$query = DB::table('automated_reports')
->join('teams', 'automated_reports.team_id', '=', 'teams.id')
->select('teams.id')
->distinct();
if ($teamId !== null) {
$query->where('teams.id', $teamId);
}
return $query->pluck('teams.id');
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
18
14
2
4
Previous Highlighted Error
Next Highlighted Error
SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o
JOIN activities a ON o.id = a.opportunity_id
WHERE a.crm_configuration_id = 39
AND a.actual_start_time > '2025-10-13'
AND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')
;
SELECT * FROM activities
WHERE crm_configuration_id = 39 and user_id = 143
and actual_start_time >= '2025-10-13'
AND type IN ('conference', 'softphone-inbound', 'softphone-outbound')
;
SELECT * FROM opportunities WHERE account_id IN (178);
select * from activities where id IN (620137, 620187, 620188, 620189, 620230);
# HS
SELECT * FROM opportunities WHERE id IN (238);
select * from activities where id IN (477,2076);
select * from users;
SELECT COUNT(*) FROM users;
SELECT COUNT(*) FROM activities;
SELECT COUNT(*) FROM opportunities;
UPDATE activities
SET
actual_start_time = '2025-12-19 09:00:00',
actual_end_time = '2025-12-19 10:30:00',
scheduled_start_time = '2025-12-19 09:00:00',
scheduled_end_time = '2025-12-19 10:30:00'
WHERE id IN (407509,407375);
select * from partners;
SELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id
FROM activities
WHERE user_id = 143
AND actual_start_time >= '2025-10-13 00:00:00'
AND actual_start_time <= '2026-01-13 23:59:59'
ORDER BY actual_start_time DESC;
SELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;
SELECT * FROM crm_layouts where crm_configuration_id = 39;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;
# lead_id
# account_id 177
# contact_id 3969
# opportunity_id
# stage_id 203
SELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;
SELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'
AND user_id = 143 and actual_start_time >= '2025-10-13';
SELECT * FROM activities a
# JOIN opportunities o ON a.opportunity_id = o.id
WHERE a.crm_configuration_id = 39 AND a.type = 'conference'
and status = 'completed' and recording_state = 'recorded'
and a.actual_start_time >= '2025-10-13'
AND a.user_id = 143
;
select * from leads
where crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707
SELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);
SELECT * FROM activities WHERE id IN (356013,616188,616202,616310);
SELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198
SELECT * FROM activities WHERE id IN (356001, 356008); # contacts:
SELECT * FROM opportunities WHERE id IN (1707);
SELECT * FROM stages where id IN (204, 198);
SELECT * FROM opportunities WHERE account_id IN (178);
SELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';
SELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal
SELECT * FROM activities where crm_configuration_id = 39
AND opportunity_id IS NULL
AND is_internal = false
and status = 'completed' and recording_state = 'recorded'
AND actual_start_time >= '2025-10-13'
AND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)
# AND lead_id IN (112, 109)
;
SELECT * FROM crm_profiles WHERE user_id = 143;
select * from inboxes; # 212
select * from users where id = 143; # 143
select * from inbox_email_batches where inbox_id = 212
and updated_at >= '2026-01-28 00:00:00' order by id desc;
select * from inbox_emails where inbox_id = 212
and batch_id = 95885 order by id desc;
select * from email_messages where origin_user_id = 143;
select * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';
select * from participants where activity_id = 620247;
select * from crm_profiles where user_id = 143;
SELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001
select * from transcription where activity_id = 356001; # 6943
select * from ai_prompts where transcription_id = 6943;
SELECT * FROM activity_summary_logs where activity_id = 356001;
SELECT * FROM social_accounts WHERE sociable_id = 143;
# [PASSWORD_DOTS]
SELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;
# 422515 softphone tr. 8100
SELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;
# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS
select * from ai_prompts where transcription_id IN (8100, 7670);
select * from activity_summary_logs where activity_id = 407509;
select * from sidekick_settings;
select * from default_activity_types;
SELECT * FROM contacts WHERE crm_configuration_id = 39 and email = '[EMAIL]';
SELECT * FROM leads WHERE crm_configuration_id = 39 and email = '[EMAIL]';
SELECT * FROM activity_searches where user_id = 143;
SELECT * FROM groups where team_id = 1;
select * from teams where id = 1;
select * from groups where team_id = 1; # 1150 - 7e75f8025c22
select id, name, group_id, status, deleted_at, email
from users where team_id = 1 order by group_id desc ;
select * from activity_searches where id in (1977, 1978, 1979);
select * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);
select * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277
select * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879
INSERT INTO `activity_search_filters`
(`activity_search_id`, `filter`, `value`) VALUES
(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),
(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),
(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')
;
select * from crm_configurations where id = 39;
select sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id
where u.team_id = 1;
SELECT * FROM social_accounts WHERE sociable_id = 1635;
SELECT * FROM users WHERE id = 1635;
select * from teams where id = 1;
select * from users where team_id = 1;
select * from team_features where team_id = 1;
select * from features;
SELECT * FROM activity_searches where id = 1982; # 1981
SELECT * FROM activity_search_filters WHERE activity_search_id = 1982;
SELECT * FROM automated_reports where id = 68;
UPDATE automated_reports set playbook_categories = NULL where id = 68;
SELECT * FROM automated_report_results where id = 275;
SELECT * FROM automated_reports order by id desc;
SELECT * FROM automated_report_results order by id desc;
select * from activity_searches where user_id = 143;
select * from ask_anything_prompts;
SELECT * FROM groups WHERE id = 1439;
SELECT * FROM users WHERE group_id = 1439;
select * from permissions; # 158
select * from roles;
select * from permission_role
select * from teams where id = 1;
select * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;
select * from groups where id = 28;
select * from playbooks where team_id = 1;
select * from playbooks where id = 179;
select * from playbook_categories where id = 1391;
select * from users where id = 143;
select * from crm_profiles where user_id = 143;
select * from activities where crm_configuration_id = 39 and type = 'conference'
and crm_provider_id IS NOT NULL ORDER by id desc;
select * from activities where id = 422003; # 00UO400000pB6fpMAC
SELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type
FROM automated_report_results ar
JOIN automated_reports a ON a.id = ar.report_id
WHERE a.type = 'ask_jiminny'
LIMIT 10;
SELECT `automated_report_results`.* FROM `automated_report_results`
INNER JOIN `automated_reports`
ON `automated_report_results`.`report_id` = `automated_reports`.`id`
WHERE `automated_report_results`.`generated_at` IS NOT NULL
AND `automated_reports`.`team_id` = 1
AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$."users"')
;
select * from teams where id = 3143;
select * from crm_configurations where id = 500;
select * from users where name = 'Integration Account'; # 1695
SELECT * FROM social_accounts WHERE sociable_id = 1695;
select * from activities where crm_configuration_id = 39
and recording_state = 'recorded' and duration > 60
and status = 'completed' and actual_start_time >= '2025-12-01';
SELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;
select * from leads;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
[{"role":"AXButton","text" [{"role":"AXButton","text":"Project: faVsco.js, menu","depth":5,"help_text":"~/jiminny/app","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"#11894 on JY-18909-automated-reports-ask-jiminny, menu","depth":5,"help_text":"Pull request #11894 exists for current branch JY-18909-automated-reports-ask-jiminny","role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Start Listening for PHP Debug Connections","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"AutomatedReportsServiceTest","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Run 'AutomatedReportsServiceTest'","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Debug 'AutomatedReportsServiceTest'","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"More Actions","depth":6,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"JetBrains AI","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Search Everywhere","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"IDE and Project Settings","depth":5,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Show Replace Field","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Search History","depth":3,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"whereHas","depth":4,"value":"whereHas","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Match Case","depth":3,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Words","depth":3,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Regex","depth":3,"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Replace History","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextField","text":"Replace","depth":4,"role_description":"text field","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"New Line","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Preserve case","depth":3,"bounds":{"left":0.0,"top":0.0,"width":0.015277778,"height":0.024444444},"role_description":"checkbox","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"3/3","depth":4,"role_description":"text"},{"role":"AXButton","text":"Previous Occurrence","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Occurrence","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Filter Search Results","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open in Window, Multiple Cursors","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Click to highlight","depth":4,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Close","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"16","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"7","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"1","depth":4,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Repositories;\n\nuse Carbon\\CarbonImmutable;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Database\\Eloquent\\Collection;\nuse Illuminate\\Pagination\\LengthAwarePaginator;\nuse Illuminate\\Support\\Facades\\DB;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\AutomatedReportsService;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\ReportSort;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\ReportSortDirection;\n\nclass AutomatedReportsRepository\n{\n /**\n * Create a new automated report\n *\n * @param array $data\n *\n * @return AutomatedReport\n */\n public function create(array $data): AutomatedReport\n {\n return AutomatedReport::create($data);\n }\n\n /**\n * Find an automated report by UUID\n *\n * @param string $uuid\n *\n * @return AutomatedReport|null\n */\n public function findByUuid(string $uuid): ?AutomatedReport\n {\n return AutomatedReport::where('uuid', AutomatedReport::toOptimized($uuid))->first();\n }\n\n public function findByIdOrUuid(string $idOrUuid): ?AutomatedReport\n {\n if (is_numeric($idOrUuid)) {\n return AutomatedReport::find((int) $idOrUuid);\n }\n\n return AutomatedReport::where('uuid', AutomatedReport::toOptimized($idOrUuid))->first();\n }\n\n /**\n * Retrieve all standard (non-Ask Jiminny) automated reports.\n *\n * @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.\n * @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.\n *\n * @return Collection<AutomatedReport>\n */\n public function getAllStandardReports(\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): Collection {\n return $this->buildSortedQuery($sortColumn, $sortDirection)\n ->whereNot('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->get();\n }\n\n /**\n * Retrieve all Ask Jiminny reports created by the given user.\n *\n * @param User $user The user whose reports to retrieve.\n * @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.\n * @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.\n *\n * @return Collection<AutomatedReport>\n */\n public function getAskJiminnyReportsByUser(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): Collection {\n return $this->buildSortedQuery($sortColumn, $sortDirection)\n ->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->where('created_by', $user->getId())\n ->get();\n }\n\n private function buildSortedQuery(string $sortColumn, string $sortDirection): \\Illuminate\\Database\\Eloquent\\Builder\n {\n $allowedColumns = ['created_by', 'created_at'];\n if (! in_array($sortColumn, $allowedColumns)) {\n $sortColumn = 'created_at';\n }\n\n $sortDirection = strtolower($sortDirection) === 'asc' ? 'asc' : 'desc';\n\n $query = AutomatedReport::query()->with(['creator', 'team']);\n\n if ($sortColumn === 'created_by') {\n $query->leftJoin('users', 'users.id', '=', 'automated_reports.created_by')\n ->orderByRaw(\"users.name COLLATE utf8mb4_unicode_ci {$sortDirection}\")\n ->select('automated_reports.*');\n } else {\n $query->orderBy($sortColumn, $sortDirection);\n }\n\n return $query;\n }\n\n /**\n * Get all active Ask Jiminny reports whose expiry date has passed.\n *\n * @return Collection<AutomatedReport>\n */\n public function getExpiredActiveAskJiminnyReports(): Collection\n {\n return AutomatedReport::where('status', true)\n ->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->whereNotNull('expires_at')\n ->where('expires_at', '<', now()->toDateString())\n ->get();\n }\n\n /**\n * Get all active and enabled reports with active teams for the specified frequency.\n *\n * @param string $frequency\n *\n * @return Collection<AutomatedReport>\n */\n public function getActiveReportsByFrequency(string $frequency): Collection\n {\n return AutomatedReport::where('automated_reports.status', true)\n ->where('automated_reports.frequency', $frequency)\n ->join('teams', 'automated_reports.team_id', '=', 'teams.id')\n ->where('teams.status', Team::STATUS_ACTIVE)\n ->where(function ($query) {\n $query->whereNull('automated_reports.expires_at')\n ->orWhere('automated_reports.expires_at', '>=', now()->toDateString());\n })\n ->select('automated_reports.*')\n ->get();\n }\n\n /**\n * Update an automated report\n *\n * @param AutomatedReport $report\n * @param array $data\n *\n * @return AutomatedReport\n */\n public function update(AutomatedReport $report, array $data): AutomatedReport\n {\n $report->update($data);\n\n return $report;\n }\n\n /**\n * Create a new automated report result.\n *\n * @param array $data The data to create the automated report result with.\n *\n * @return AutomatedReportResult The newly created automated report result.\n */\n public function createResult(array $data): AutomatedReportResult\n {\n return AutomatedReportResult::create($data);\n }\n\n /**\n * Find an automated report result by UUID.\n *\n * @param string $uuid The UUID to find the automated report result with.\n *\n * @return AutomatedReportResult|null The automated report result if found, otherwise null.\n */\n public function findResultByUuid(string $uuid): ?AutomatedReportResult\n {\n return AutomatedReportResult::where('uuid', AutomatedReportResult::toOptimized($uuid))->first();\n }\n\n public function findResultByUuidForUser(string $uuid, User $user): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('uuid', AutomatedReportResult::toOptimized($uuid))\n ->whereHas('report', static function ($query) use ($user): void {\n $query->where('team_id', $user->getTeamId())\n ->where('created_by', $user->getId());\n })\n ->first();\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('parent_id', $result->getId())\n ->where('media_type', $type)\n ->first();\n }\n\n public function findLatestDefaultOrFailedResult(AutomatedReport $report): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('report_id', $report->getId())\n ->whereIn('status', [AutomatedReportResult::STATUS_DEFAULT, AutomatedReportResult::STATUS_FAILED])\n ->latest()\n ->first();\n }\n\n public function getGeneratedNotSentResults(): Collection\n {\n return AutomatedReportResult::query()\n ->whereNotNull('generated_at')\n ->whereNull('sent_at')\n ->where('status', AutomatedReportResult::STATUS_GENERATED)\n ->whereHas('report')\n ->with('report')\n ->get();\n }\n\n public function getPaginatedUserReports(\n User $user,\n ReportSort $sort,\n ReportSortDirection $sortDirection,\n int $resultsPerPage,\n int $page,\n ?Carbon $fromDate,\n ?Carbon $toDate,\n array $teamIds,\n array $reportTypes,\n ?string $name,\n ): LengthAwarePaginator {\n $query = AutomatedReportResult::query()\n ->whereNotNull('automated_report_results.generated_at')\n ->join('automated_reports', 'automated_report_results.report_id', '=', 'automated_reports.id')\n ->where(fn (Builder $q) => $this->applyUserAccessScope($q, $user))\n ->orderByRaw(\"$sort->value COLLATE utf8mb4_unicode_ci {$sortDirection->value}\")\n ->select('automated_report_results.*')\n ->with('report.team');\n\n if ($fromDate !== null && $toDate !== null) {\n $query->whereBetween('generated_at', [$fromDate, $toDate]);\n }\n\n if (! empty($teamIds)) {\n $query->where(function ($q) use ($teamIds) {\n foreach ($teamIds as $id) {\n $q->orWhereJsonContains('automated_reports.groups', $id);\n }\n });\n }\n\n if (! empty($reportTypes)) {\n $query->whereIn('automated_reports.type', $reportTypes);\n }\n\n if (! empty($name)) {\n $query->whereLike('name', \"%$name%\");\n }\n\n return $query->paginate($resultsPerPage, ['*'], 'page', $page);\n }\n\n public function countUserReports(User $user): int\n {\n return AutomatedReportResult::query()\n ->whereNotNull('generated_at')\n ->whereNotNull('sent_at')\n ->whereHas('report', function ($q) use ($user) {\n $q->where('team_id', $user->getTeamId())\n ->whereJsonContains('recipients->users', $user->getId());\n })\n ->count();\n }\n\n /**\n * Restrict a query on the automated_reports table to reports the given user is allowed to see.\n *\n * Matches the customer-facing audience:\n * - explicit user recipients (recipients.users)\n * - members of any of the report's groups (Ask Jiminny reports)\n */\n private function applyUserAccessScope(Builder $query, User $user): void\n {\n $userId = $user->getId();\n $groupId = $user->getGroupId();\n\n $query\n ->where('automated_reports.team_id', $user->getTeamId())\n ->where(function (Builder $q) use ($userId, $groupId): void {\n $q->whereJsonContains('automated_reports.recipients->users', $userId);\n\n if ($groupId !== null) {\n $q->orWhere(function (Builder $sub) use ($groupId): void {\n $sub->where('automated_reports.type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->whereJsonContains('automated_reports.groups', $groupId);\n });\n }\n });\n }\n\n /**\n * Get report IDs for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Support\\Collection\n */\n public function getReportIdsByTeam(Team $team): \\Illuminate\\Support\\Collection\n {\n return AutomatedReport::where('team_id', $team->getId())->pluck('id');\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return Collection\n */\n public function getReportsByTeam(Team $team): Collection\n {\n return AutomatedReport::where('team_id', $team->getId())->get();\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return Collection\n */\n public function getResultsByReport(AutomatedReport $report): Collection\n {\n return $this->getResultsByReportQuery($report)->get();\n }\n\n public function getResultsByReportQuery(AutomatedReport $report): Builder\n {\n return AutomatedReportResult::where('report_id', $report->getId());\n }\n\n public function getReportResultsQueryForRetention(Team $team, CarbonImmutable $retentionDate): Builder\n {\n $reportIds = $this->getReportIdsByTeam($team);\n\n return AutomatedReportResult::query()->whereIn('report_id', $reportIds)\n ->whereRaw('IFNULL(generated_at, created_at) <= ?', [$retentionDate]);\n }\n\n /**\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return \\Illuminate\\Support\\Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): \\Illuminate\\Support\\Collection\n {\n $query = DB::table('automated_reports')\n ->join('teams', 'automated_reports.team_id', '=', 'teams.id')\n ->select('teams.id')\n ->distinct();\n\n if ($teamId !== null) {\n $query->where('teams.id', $teamId);\n }\n\n return $query->pluck('teams.id');\n }\n}","depth":4,"value":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Jiminny\\Repositories;\n\nuse Carbon\\CarbonImmutable;\nuse Illuminate\\Database\\Eloquent\\Builder;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Database\\Eloquent\\Collection;\nuse Illuminate\\Pagination\\LengthAwarePaginator;\nuse Illuminate\\Support\\Facades\\DB;\nuse Jiminny\\Models\\AutomatedReport;\nuse Jiminny\\Models\\AutomatedReportResult;\nuse Jiminny\\Models\\Team;\nuse Jiminny\\Models\\User;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\AutomatedReportsService;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\ReportSort;\nuse Jiminny\\Services\\Kiosk\\AutomatedReports\\ReportSortDirection;\n\nclass AutomatedReportsRepository\n{\n /**\n * Create a new automated report\n *\n * @param array $data\n *\n * @return AutomatedReport\n */\n public function create(array $data): AutomatedReport\n {\n return AutomatedReport::create($data);\n }\n\n /**\n * Find an automated report by UUID\n *\n * @param string $uuid\n *\n * @return AutomatedReport|null\n */\n public function findByUuid(string $uuid): ?AutomatedReport\n {\n return AutomatedReport::where('uuid', AutomatedReport::toOptimized($uuid))->first();\n }\n\n public function findByIdOrUuid(string $idOrUuid): ?AutomatedReport\n {\n if (is_numeric($idOrUuid)) {\n return AutomatedReport::find((int) $idOrUuid);\n }\n\n return AutomatedReport::where('uuid', AutomatedReport::toOptimized($idOrUuid))->first();\n }\n\n /**\n * Retrieve all standard (non-Ask Jiminny) automated reports.\n *\n * @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.\n * @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.\n *\n * @return Collection<AutomatedReport>\n */\n public function getAllStandardReports(\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): Collection {\n return $this->buildSortedQuery($sortColumn, $sortDirection)\n ->whereNot('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->get();\n }\n\n /**\n * Retrieve all Ask Jiminny reports created by the given user.\n *\n * @param User $user The user whose reports to retrieve.\n * @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.\n * @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.\n *\n * @return Collection<AutomatedReport>\n */\n public function getAskJiminnyReportsByUser(\n User $user,\n string $sortColumn = 'created_at',\n string $sortDirection = 'desc'\n ): Collection {\n return $this->buildSortedQuery($sortColumn, $sortDirection)\n ->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->where('created_by', $user->getId())\n ->get();\n }\n\n private function buildSortedQuery(string $sortColumn, string $sortDirection): \\Illuminate\\Database\\Eloquent\\Builder\n {\n $allowedColumns = ['created_by', 'created_at'];\n if (! in_array($sortColumn, $allowedColumns)) {\n $sortColumn = 'created_at';\n }\n\n $sortDirection = strtolower($sortDirection) === 'asc' ? 'asc' : 'desc';\n\n $query = AutomatedReport::query()->with(['creator', 'team']);\n\n if ($sortColumn === 'created_by') {\n $query->leftJoin('users', 'users.id', '=', 'automated_reports.created_by')\n ->orderByRaw(\"users.name COLLATE utf8mb4_unicode_ci {$sortDirection}\")\n ->select('automated_reports.*');\n } else {\n $query->orderBy($sortColumn, $sortDirection);\n }\n\n return $query;\n }\n\n /**\n * Get all active Ask Jiminny reports whose expiry date has passed.\n *\n * @return Collection<AutomatedReport>\n */\n public function getExpiredActiveAskJiminnyReports(): Collection\n {\n return AutomatedReport::where('status', true)\n ->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->whereNotNull('expires_at')\n ->where('expires_at', '<', now()->toDateString())\n ->get();\n }\n\n /**\n * Get all active and enabled reports with active teams for the specified frequency.\n *\n * @param string $frequency\n *\n * @return Collection<AutomatedReport>\n */\n public function getActiveReportsByFrequency(string $frequency): Collection\n {\n return AutomatedReport::where('automated_reports.status', true)\n ->where('automated_reports.frequency', $frequency)\n ->join('teams', 'automated_reports.team_id', '=', 'teams.id')\n ->where('teams.status', Team::STATUS_ACTIVE)\n ->where(function ($query) {\n $query->whereNull('automated_reports.expires_at')\n ->orWhere('automated_reports.expires_at', '>=', now()->toDateString());\n })\n ->select('automated_reports.*')\n ->get();\n }\n\n /**\n * Update an automated report\n *\n * @param AutomatedReport $report\n * @param array $data\n *\n * @return AutomatedReport\n */\n public function update(AutomatedReport $report, array $data): AutomatedReport\n {\n $report->update($data);\n\n return $report;\n }\n\n /**\n * Create a new automated report result.\n *\n * @param array $data The data to create the automated report result with.\n *\n * @return AutomatedReportResult The newly created automated report result.\n */\n public function createResult(array $data): AutomatedReportResult\n {\n return AutomatedReportResult::create($data);\n }\n\n /**\n * Find an automated report result by UUID.\n *\n * @param string $uuid The UUID to find the automated report result with.\n *\n * @return AutomatedReportResult|null The automated report result if found, otherwise null.\n */\n public function findResultByUuid(string $uuid): ?AutomatedReportResult\n {\n return AutomatedReportResult::where('uuid', AutomatedReportResult::toOptimized($uuid))->first();\n }\n\n public function findResultByUuidForUser(string $uuid, User $user): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('uuid', AutomatedReportResult::toOptimized($uuid))\n ->whereHas('report', static function ($query) use ($user): void {\n $query->where('team_id', $user->getTeamId())\n ->where('created_by', $user->getId());\n })\n ->first();\n }\n\n public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('parent_id', $result->getId())\n ->where('media_type', $type)\n ->first();\n }\n\n public function findLatestDefaultOrFailedResult(AutomatedReport $report): ?AutomatedReportResult\n {\n return AutomatedReportResult::query()\n ->where('report_id', $report->getId())\n ->whereIn('status', [AutomatedReportResult::STATUS_DEFAULT, AutomatedReportResult::STATUS_FAILED])\n ->latest()\n ->first();\n }\n\n public function getGeneratedNotSentResults(): Collection\n {\n return AutomatedReportResult::query()\n ->whereNotNull('generated_at')\n ->whereNull('sent_at')\n ->where('status', AutomatedReportResult::STATUS_GENERATED)\n ->whereHas('report')\n ->with('report')\n ->get();\n }\n\n public function getPaginatedUserReports(\n User $user,\n ReportSort $sort,\n ReportSortDirection $sortDirection,\n int $resultsPerPage,\n int $page,\n ?Carbon $fromDate,\n ?Carbon $toDate,\n array $teamIds,\n array $reportTypes,\n ?string $name,\n ): LengthAwarePaginator {\n $query = AutomatedReportResult::query()\n ->whereNotNull('automated_report_results.generated_at')\n ->join('automated_reports', 'automated_report_results.report_id', '=', 'automated_reports.id')\n ->where(fn (Builder $q) => $this->applyUserAccessScope($q, $user))\n ->orderByRaw(\"$sort->value COLLATE utf8mb4_unicode_ci {$sortDirection->value}\")\n ->select('automated_report_results.*')\n ->with('report.team');\n\n if ($fromDate !== null && $toDate !== null) {\n $query->whereBetween('generated_at', [$fromDate, $toDate]);\n }\n\n if (! empty($teamIds)) {\n $query->where(function ($q) use ($teamIds) {\n foreach ($teamIds as $id) {\n $q->orWhereJsonContains('automated_reports.groups', $id);\n }\n });\n }\n\n if (! empty($reportTypes)) {\n $query->whereIn('automated_reports.type', $reportTypes);\n }\n\n if (! empty($name)) {\n $query->whereLike('name', \"%$name%\");\n }\n\n return $query->paginate($resultsPerPage, ['*'], 'page', $page);\n }\n\n public function countUserReports(User $user): int\n {\n return AutomatedReportResult::query()\n ->whereNotNull('generated_at')\n ->whereNotNull('sent_at')\n ->whereHas('report', function ($q) use ($user) {\n $q->where('team_id', $user->getTeamId())\n ->whereJsonContains('recipients->users', $user->getId());\n })\n ->count();\n }\n\n /**\n * Restrict a query on the automated_reports table to reports the given user is allowed to see.\n *\n * Matches the customer-facing audience:\n * - explicit user recipients (recipients.users)\n * - members of any of the report's groups (Ask Jiminny reports)\n */\n private function applyUserAccessScope(Builder $query, User $user): void\n {\n $userId = $user->getId();\n $groupId = $user->getGroupId();\n\n $query\n ->where('automated_reports.team_id', $user->getTeamId())\n ->where(function (Builder $q) use ($userId, $groupId): void {\n $q->whereJsonContains('automated_reports.recipients->users', $userId);\n\n if ($groupId !== null) {\n $q->orWhere(function (Builder $sub) use ($groupId): void {\n $sub->where('automated_reports.type', AutomatedReportsService::TYPE_ASK_JIMINNY)\n ->whereJsonContains('automated_reports.groups', $groupId);\n });\n }\n });\n }\n\n /**\n * Get report IDs for a specific team\n *\n * @param Team $team\n *\n * @return \\Illuminate\\Support\\Collection\n */\n public function getReportIdsByTeam(Team $team): \\Illuminate\\Support\\Collection\n {\n return AutomatedReport::where('team_id', $team->getId())->pluck('id');\n }\n\n /**\n * Get all reports for a specific team\n *\n * @param Team $team\n *\n * @return Collection\n */\n public function getReportsByTeam(Team $team): Collection\n {\n return AutomatedReport::where('team_id', $team->getId())->get();\n }\n\n /**\n * Get all report results for a specific report\n *\n * @param AutomatedReport $report\n *\n * @return Collection\n */\n public function getResultsByReport(AutomatedReport $report): Collection\n {\n return $this->getResultsByReportQuery($report)->get();\n }\n\n public function getResultsByReportQuery(AutomatedReport $report): Builder\n {\n return AutomatedReportResult::where('report_id', $report->getId());\n }\n\n public function getReportResultsQueryForRetention(Team $team, CarbonImmutable $retentionDate): Builder\n {\n $reportIds = $this->getReportIdsByTeam($team);\n\n return AutomatedReportResult::query()->whereIn('report_id', $reportIds)\n ->whereRaw('IFNULL(generated_at, created_at) <= ?', [$retentionDate]);\n }\n\n /**\n * @param int|null $teamId Optional team ID to filter results\n *\n * @return \\Illuminate\\Support\\Collection<int, int> Collection of team IDs\n */\n public function getTeamIdsWithReportsResults(?int $teamId = null): \\Illuminate\\Support\\Collection\n {\n $query = DB::table('automated_reports')\n ->join('teams', 'automated_reports.team_id', '=', 'teams.id')\n ->select('teams.id')\n ->distinct();\n\n if ($teamId !== null) {\n $query->where('teams.id', $teamId);\n }\n\n return $query->pluck('teams.id');\n }\n}","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Execute","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Explain Plan","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Browse Query History","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"View Parameters","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Open Query Execution Settings…","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"In-Editor Results","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Tx: Auto","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Cancel Running Statements","depth":4,"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Playground","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"jiminny","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Sync Changes","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide This Notification","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":false,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Code changed:","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.088194445,"height":0.027777778},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"18","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"14","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"2","depth":4,"role_description":"text"},{"role":"AXStaticText","text":"4","depth":4,"role_description":"text"},{"role":"AXButton","text":"Previous Highlighted Error","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Next Highlighted Error","depth":4,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o\nJOIN activities a ON o.id = a.opportunity_id\nWHERE a.crm_configuration_id = 39\nAND a.actual_start_time > '2025-10-13'\nAND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM activities\nWHERE crm_configuration_id = 39 and user_id = 143\nand actual_start_time >= '2025-10-13'\nAND type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM opportunities WHERE account_id IN (178);\nselect * from activities where id IN (620137, 620187, 620188, 620189, 620230);\n\n# HS\nSELECT * FROM opportunities WHERE id IN (238);\nselect * from activities where id IN (477,2076);\n\nselect * from users;\n\nSELECT COUNT(*) FROM users;\nSELECT COUNT(*) FROM activities;\nSELECT COUNT(*) FROM opportunities;\n\nUPDATE activities\nSET\n actual_start_time = '2025-12-19 09:00:00',\n actual_end_time = '2025-12-19 10:30:00',\n scheduled_start_time = '2025-12-19 09:00:00',\n scheduled_end_time = '2025-12-19 10:30:00'\nWHERE id IN (407509,407375);\n\nselect * from partners;\n\nSELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id\nFROM activities\nWHERE user_id = 143\nAND actual_start_time >= '2025-10-13 00:00:00'\nAND actual_start_time <= '2026-01-13 23:59:59'\nORDER BY actual_start_time DESC;\n\nSELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;\nSELECT * FROM crm_layouts where crm_configuration_id = 39;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;\n# lead_id\n# account_id 177\n# contact_id 3969\n# opportunity_id\n# stage_id 203\n\nSELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;\n\nSELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'\nAND user_id = 143 and actual_start_time >= '2025-10-13';\n\nSELECT * FROM activities a\n# JOIN opportunities o ON a.opportunity_id = o.id\nWHERE a.crm_configuration_id = 39 AND a.type = 'conference'\nand status = 'completed' and recording_state = 'recorded'\nand a.actual_start_time >= '2025-10-13'\nAND a.user_id = 143\n;\n\nselect * from leads\nwhere crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707\n\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310);\nSELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198\nSELECT * FROM activities WHERE id IN (356001, 356008); # contacts:\n\nSELECT * FROM opportunities WHERE id IN (1707);\nSELECT * FROM stages where id IN (204, 198);\nSELECT * FROM opportunities WHERE account_id IN (178);\nSELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';\nSELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal\n\nSELECT * FROM activities where crm_configuration_id = 39\nAND opportunity_id IS NULL\nAND is_internal = false\nand status = 'completed' and recording_state = 'recorded'\nAND actual_start_time >= '2025-10-13'\nAND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)\n# AND lead_id IN (112, 109)\n;\n\nSELECT * FROM crm_profiles WHERE user_id = 143;\n\nselect * from inboxes; # 212\nselect * from users where id = 143; # 143\nselect * from inbox_email_batches where inbox_id = 212\nand updated_at >= '2026-01-28 00:00:00' order by id desc;\nselect * from inbox_emails where inbox_id = 212\nand batch_id = 95885 order by id desc;\nselect * from email_messages where origin_user_id = 143;\nselect * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';\nselect * from participants where activity_id = 620247;\n\nselect * from crm_profiles where user_id = 143;\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001\nselect * from transcription where activity_id = 356001; # 6943\nselect * from ai_prompts where transcription_id = 6943;\nSELECT * FROM activity_summary_logs where activity_id = 356001;\n\nSELECT * FROM social_accounts WHERE sociable_id = 143;\n\n# ************************************************************************************\nSELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;\n# 422515 softphone tr. 8100\n\nSELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;\n# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS\n\nselect * from ai_prompts where transcription_id IN (8100, 7670);\nselect * from activity_summary_logs where activity_id = 407509;\n\nselect * from sidekick_settings;\nselect * from default_activity_types;\n\nSELECT * FROM contacts WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\nSELECT * FROM leads WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\n\nSELECT * FROM activity_searches where user_id = 143;\nSELECT * FROM groups where team_id = 1;\n\nselect * from teams where id = 1;\nselect * from groups where team_id = 1; # 1150 - 7e75f8025c22\nselect id, name, group_id, status, deleted_at, email\nfrom users where team_id = 1 order by group_id desc ;\n\nselect * from activity_searches where id in (1977, 1978, 1979);\nselect * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);\nselect * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277\nselect * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879\n\nINSERT INTO `activity_search_filters`\n(`activity_search_id`, `filter`, `value`) VALUES\n(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')\n;\n\nselect * from crm_configurations where id = 39;\n\n\nselect sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id\nwhere u.team_id = 1;\nSELECT * FROM social_accounts WHERE sociable_id = 1635;\nSELECT * FROM users WHERE id = 1635;\n\nselect * from teams where id = 1;\nselect * from users where team_id = 1;\nselect * from team_features where team_id = 1;\nselect * from features;\n\nSELECT * FROM activity_searches where id = 1982; # 1981\nSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;\n\nSELECT * FROM automated_reports where id = 68;\nUPDATE automated_reports set playbook_categories = NULL where id = 68;\nSELECT * FROM automated_report_results where id = 275;\n\nSELECT * FROM automated_reports order by id desc;\nSELECT * FROM automated_report_results order by id desc;\nselect * from activity_searches where user_id = 143;\nselect * from ask_anything_prompts;\n\nSELECT * FROM groups WHERE id = 1439;\nSELECT * FROM users WHERE group_id = 1439;\n\nselect * from permissions; # 158\nselect * from roles;\nselect * from permission_role\n\nselect * from teams where id = 1;\nselect * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;\nselect * from groups where id = 28;\nselect * from playbooks where team_id = 1;\nselect * from playbooks where id = 179;\nselect * from playbook_categories where id = 1391;\nselect * from users where id = 143;\nselect * from crm_profiles where user_id = 143;\nselect * from activities where crm_configuration_id = 39 and type = 'conference'\nand crm_provider_id IS NOT NULL ORDER by id desc;\nselect * from activities where id = 422003; # 00UO400000pB6fpMAC\n\nSELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type\nFROM automated_report_results ar\nJOIN automated_reports a ON a.id = ar.report_id\nWHERE a.type = 'ask_jiminny'\nLIMIT 10;\n\nSELECT `automated_report_results`.* FROM `automated_report_results`\nINNER JOIN `automated_reports`\n ON `automated_report_results`.`report_id` = `automated_reports`.`id`\nWHERE `automated_report_results`.`generated_at` IS NOT NULL\n AND `automated_reports`.`team_id` = 1\n AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$.\"users\"')\n;\n\n\nselect * from teams where id = 3143;\nselect * from crm_configurations where id = 500;\nselect * from users where name = 'Integration Account'; # 1695\nSELECT * FROM social_accounts WHERE sociable_id = 1695;\n\nselect * from activities where crm_configuration_id = 39\nand recording_state = 'recorded' and duration > 60\nand status = 'completed' and actual_start_time >= '2025-12-01';\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;\n\nselect * from leads;","depth":4,"value":"SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o\nJOIN activities a ON o.id = a.opportunity_id\nWHERE a.crm_configuration_id = 39\nAND a.actual_start_time > '2025-10-13'\nAND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM activities\nWHERE crm_configuration_id = 39 and user_id = 143\nand actual_start_time >= '2025-10-13'\nAND type IN ('conference', 'softphone-inbound', 'softphone-outbound')\n;\n\nSELECT * FROM opportunities WHERE account_id IN (178);\nselect * from activities where id IN (620137, 620187, 620188, 620189, 620230);\n\n# HS\nSELECT * FROM opportunities WHERE id IN (238);\nselect * from activities where id IN (477,2076);\n\nselect * from users;\n\nSELECT COUNT(*) FROM users;\nSELECT COUNT(*) FROM activities;\nSELECT COUNT(*) FROM opportunities;\n\nUPDATE activities\nSET\n actual_start_time = '2025-12-19 09:00:00',\n actual_end_time = '2025-12-19 10:30:00',\n scheduled_start_time = '2025-12-19 09:00:00',\n scheduled_end_time = '2025-12-19 10:30:00'\nWHERE id IN (407509,407375);\n\nselect * from partners;\n\nSELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id\nFROM activities\nWHERE user_id = 143\nAND actual_start_time >= '2025-10-13 00:00:00'\nAND actual_start_time <= '2026-01-13 23:59:59'\nORDER BY actual_start_time DESC;\n\nSELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;\nSELECT * FROM crm_layouts where crm_configuration_id = 39;\nSELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;\n# lead_id\n# account_id 177\n# contact_id 3969\n# opportunity_id\n# stage_id 203\n\nSELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;\n\nSELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'\nAND user_id = 143 and actual_start_time >= '2025-10-13';\n\nSELECT * FROM activities a\n# JOIN opportunities o ON a.opportunity_id = o.id\nWHERE a.crm_configuration_id = 39 AND a.type = 'conference'\nand status = 'completed' and recording_state = 'recorded'\nand a.actual_start_time >= '2025-10-13'\nAND a.user_id = 143\n;\n\nselect * from leads\nwhere crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707\n\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);\nSELECT * FROM activities WHERE id IN (356013,616188,616202,616310);\nSELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198\nSELECT * FROM activities WHERE id IN (356001, 356008); # contacts:\n\nSELECT * FROM opportunities WHERE id IN (1707);\nSELECT * FROM stages where id IN (204, 198);\nSELECT * FROM opportunities WHERE account_id IN (178);\nSELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';\nSELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal\n\nSELECT * FROM activities where crm_configuration_id = 39\nAND opportunity_id IS NULL\nAND is_internal = false\nand status = 'completed' and recording_state = 'recorded'\nAND actual_start_time >= '2025-10-13'\nAND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)\n# AND lead_id IN (112, 109)\n;\n\nSELECT * FROM crm_profiles WHERE user_id = 143;\n\nselect * from inboxes; # 212\nselect * from users where id = 143; # 143\nselect * from inbox_email_batches where inbox_id = 212\nand updated_at >= '2026-01-28 00:00:00' order by id desc;\nselect * from inbox_emails where inbox_id = 212\nand batch_id = 95885 order by id desc;\nselect * from email_messages where origin_user_id = 143;\nselect * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';\nselect * from participants where activity_id = 620247;\n\nselect * from crm_profiles where user_id = 143;\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001\nselect * from transcription where activity_id = 356001; # 6943\nselect * from ai_prompts where transcription_id = 6943;\nSELECT * FROM activity_summary_logs where activity_id = 356001;\n\nSELECT * FROM social_accounts WHERE sociable_id = 143;\n\n# ************************************************************************************\nSELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;\n# 422515 softphone tr. 8100\n\nSELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;\n# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS\n\nselect * from ai_prompts where transcription_id IN (8100, 7670);\nselect * from activity_summary_logs where activity_id = 407509;\n\nselect * from sidekick_settings;\nselect * from default_activity_types;\n\nSELECT * FROM contacts WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\nSELECT * FROM leads WHERE crm_configuration_id = 39 and email = 'm.kogoj@gmx.at';\n\nSELECT * FROM activity_searches where user_id = 143;\nSELECT * FROM groups where team_id = 1;\n\nselect * from teams where id = 1;\nselect * from groups where team_id = 1; # 1150 - 7e75f8025c22\nselect id, name, group_id, status, deleted_at, email\nfrom users where team_id = 1 order by group_id desc ;\n\nselect * from activity_searches where id in (1977, 1978, 1979);\nselect * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);\nselect * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277\nselect * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879\n\nINSERT INTO `activity_search_filters`\n(`activity_search_id`, `filter`, `value`) VALUES\n(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),\n(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')\n;\n\nselect * from crm_configurations where id = 39;\n\n\nselect sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id\nwhere u.team_id = 1;\nSELECT * FROM social_accounts WHERE sociable_id = 1635;\nSELECT * FROM users WHERE id = 1635;\n\nselect * from teams where id = 1;\nselect * from users where team_id = 1;\nselect * from team_features where team_id = 1;\nselect * from features;\n\nSELECT * FROM activity_searches where id = 1982; # 1981\nSELECT * FROM activity_search_filters WHERE activity_search_id = 1982;\n\nSELECT * FROM automated_reports where id = 68;\nUPDATE automated_reports set playbook_categories = NULL where id = 68;\nSELECT * FROM automated_report_results where id = 275;\n\nSELECT * FROM automated_reports order by id desc;\nSELECT * FROM automated_report_results order by id desc;\nselect * from activity_searches where user_id = 143;\nselect * from ask_anything_prompts;\n\nSELECT * FROM groups WHERE id = 1439;\nSELECT * FROM users WHERE group_id = 1439;\n\nselect * from permissions; # 158\nselect * from roles;\nselect * from permission_role\n\nselect * from teams where id = 1;\nselect * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;\nselect * from groups where id = 28;\nselect * from playbooks where team_id = 1;\nselect * from playbooks where id = 179;\nselect * from playbook_categories where id = 1391;\nselect * from users where id = 143;\nselect * from crm_profiles where user_id = 143;\nselect * from activities where crm_configuration_id = 39 and type = 'conference'\nand crm_provider_id IS NOT NULL ORDER by id desc;\nselect * from activities where id = 422003; # 00UO400000pB6fpMAC\n\nSELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type\nFROM automated_report_results ar\nJOIN automated_reports a ON a.id = ar.report_id\nWHERE a.type = 'ask_jiminny'\nLIMIT 10;\n\nSELECT `automated_report_results`.* FROM `automated_report_results`\nINNER JOIN `automated_reports`\n ON `automated_report_results`.`report_id` = `automated_reports`.`id`\nWHERE `automated_report_results`.`generated_at` IS NOT NULL\n AND `automated_reports`.`team_id` = 1\n AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$.\"users\"')\n;\n\n\nselect * from teams where id = 3143;\nselect * from crm_configurations where id = 500;\nselect * from users where name = 'Integration Account'; # 1695\nSELECT * FROM social_accounts WHERE sociable_id = 1695;\n\nselect * from activities where crm_configuration_id = 39\nand recording_state = 'recorded' and duration > 60\nand status = 'completed' and actual_start_time >= '2025-12-01';\n\nSELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;\n\nselect * from leads;","role_description":"text entry area","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Project","depth":3,"role_description":"text"},{"role":"AXButton","text":"Project","depth":3,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"New File or Directory…","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Expand Selected","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Collapse All","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Options","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Hide","depth":4,"bounds":{"left":0.0,"top":0.0,"width":0.018055556,"height":0.026666667},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false}]...
|
5262134208844209929
|
-2393068234934446523
|
click
|
accessibility
|
NULL
|
Project: faVsco.js, menu
#11894 on JY-18909-automa Project: faVsco.js, menu
#11894 on JY-18909-automated-reports-ask-jiminny, menu
Start Listening for PHP Debug Connections
AutomatedReportsServiceTest
Run 'AutomatedReportsServiceTest'
Debug 'AutomatedReportsServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Show Replace Field
Search History
whereHas
New Line
Match Case
Words
Regex
Replace History
Replace
New Line
Preserve case
3/3
Previous Occurrence
Next Occurrence
Filter Search Results
Open in Window, Multiple Cursors
Click to highlight
Close
Sync Changes
Hide This Notification
Code changed:
Hide
16
7
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Repositories;
use Carbon\CarbonImmutable;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Facades\DB;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\Kiosk\AutomatedReports\ReportSort;
use Jiminny\Services\Kiosk\AutomatedReports\ReportSortDirection;
class AutomatedReportsRepository
{
/**
* Create a new automated report
*
* @param array $data
*
* @return AutomatedReport
*/
public function create(array $data): AutomatedReport
{
return AutomatedReport::create($data);
}
/**
* Find an automated report by UUID
*
* @param string $uuid
*
* @return AutomatedReport|null
*/
public function findByUuid(string $uuid): ?AutomatedReport
{
return AutomatedReport::where('uuid', AutomatedReport::toOptimized($uuid))->first();
}
public function findByIdOrUuid(string $idOrUuid): ?AutomatedReport
{
if (is_numeric($idOrUuid)) {
return AutomatedReport::find((int) $idOrUuid);
}
return AutomatedReport::where('uuid', AutomatedReport::toOptimized($idOrUuid))->first();
}
/**
* Retrieve all standard (non-Ask Jiminny) automated reports.
*
* @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.
* @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.
*
* @return Collection<AutomatedReport>
*/
public function getAllStandardReports(
string $sortColumn = 'created_at',
string $sortDirection = 'desc'
): Collection {
return $this->buildSortedQuery($sortColumn, $sortDirection)
->whereNot('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->get();
}
/**
* Retrieve all Ask Jiminny reports created by the given user.
*
* @param User $user The user whose reports to retrieve.
* @param string $sortColumn The column to sort by. Allowed values: 'created_by', 'created_at'. Defaults to 'created_at'.
* @param string $sortDirection The sort direction. Allowed values: 'asc', 'desc'. Defaults to 'desc'.
*
* @return Collection<AutomatedReport>
*/
public function getAskJiminnyReportsByUser(
User $user,
string $sortColumn = 'created_at',
string $sortDirection = 'desc'
): Collection {
return $this->buildSortedQuery($sortColumn, $sortDirection)
->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->where('created_by', $user->getId())
->get();
}
private function buildSortedQuery(string $sortColumn, string $sortDirection): \Illuminate\Database\Eloquent\Builder
{
$allowedColumns = ['created_by', 'created_at'];
if (! in_array($sortColumn, $allowedColumns)) {
$sortColumn = 'created_at';
}
$sortDirection = strtolower($sortDirection) === 'asc' ? 'asc' : 'desc';
$query = AutomatedReport::query()->with(['creator', 'team']);
if ($sortColumn === 'created_by') {
$query->leftJoin('users', 'users.id', '=', 'automated_reports.created_by')
->orderByRaw("users.name COLLATE utf8mb4_unicode_ci {$sortDirection}")
->select('automated_reports.*');
} else {
$query->orderBy($sortColumn, $sortDirection);
}
return $query;
}
/**
* Get all active Ask Jiminny reports whose expiry date has passed.
*
* @return Collection<AutomatedReport>
*/
public function getExpiredActiveAskJiminnyReports(): Collection
{
return AutomatedReport::where('status', true)
->where('type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->whereNotNull('expires_at')
->where('expires_at', '<', now()->toDateString())
->get();
}
/**
* Get all active and enabled reports with active teams for the specified frequency.
*
* @param string $frequency
*
* @return Collection<AutomatedReport>
*/
public function getActiveReportsByFrequency(string $frequency): Collection
{
return AutomatedReport::where('automated_reports.status', true)
->where('automated_reports.frequency', $frequency)
->join('teams', 'automated_reports.team_id', '=', 'teams.id')
->where('teams.status', Team::STATUS_ACTIVE)
->where(function ($query) {
$query->whereNull('automated_reports.expires_at')
->orWhere('automated_reports.expires_at', '>=', now()->toDateString());
})
->select('automated_reports.*')
->get();
}
/**
* Update an automated report
*
* @param AutomatedReport $report
* @param array $data
*
* @return AutomatedReport
*/
public function update(AutomatedReport $report, array $data): AutomatedReport
{
$report->update($data);
return $report;
}
/**
* Create a new automated report result.
*
* @param array $data The data to create the automated report result with.
*
* @return AutomatedReportResult The newly created automated report result.
*/
public function createResult(array $data): AutomatedReportResult
{
return AutomatedReportResult::create($data);
}
/**
* Find an automated report result by UUID.
*
* @param string $uuid The UUID to find the automated report result with.
*
* @return AutomatedReportResult|null The automated report result if found, otherwise null.
*/
public function findResultByUuid(string $uuid): ?AutomatedReportResult
{
return AutomatedReportResult::where('uuid', AutomatedReportResult::toOptimized($uuid))->first();
}
public function findResultByUuidForUser(string $uuid, User $user): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('uuid', AutomatedReportResult::toOptimized($uuid))
->whereHas('report', static function ($query) use ($user): void {
$query->where('team_id', $user->getTeamId())
->where('created_by', $user->getId());
})
->first();
}
public function findChildResult(AutomatedReportResult $result, string $type): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('parent_id', $result->getId())
->where('media_type', $type)
->first();
}
public function findLatestDefaultOrFailedResult(AutomatedReport $report): ?AutomatedReportResult
{
return AutomatedReportResult::query()
->where('report_id', $report->getId())
->whereIn('status', [AutomatedReportResult::STATUS_DEFAULT, AutomatedReportResult::STATUS_FAILED])
->latest()
->first();
}
public function getGeneratedNotSentResults(): Collection
{
return AutomatedReportResult::query()
->whereNotNull('generated_at')
->whereNull('sent_at')
->where('status', AutomatedReportResult::STATUS_GENERATED)
->whereHas('report')
->with('report')
->get();
}
public function getPaginatedUserReports(
User $user,
ReportSort $sort,
ReportSortDirection $sortDirection,
int $resultsPerPage,
int $page,
?Carbon $fromDate,
?Carbon $toDate,
array $teamIds,
array $reportTypes,
?string $name,
): LengthAwarePaginator {
$query = AutomatedReportResult::query()
->whereNotNull('automated_report_results.generated_at')
->join('automated_reports', 'automated_report_results.report_id', '=', 'automated_reports.id')
->where(fn (Builder $q) => $this->applyUserAccessScope($q, $user))
->orderByRaw("$sort->value COLLATE utf8mb4_unicode_ci {$sortDirection->value}")
->select('automated_report_results.*')
->with('report.team');
if ($fromDate !== null && $toDate !== null) {
$query->whereBetween('generated_at', [$fromDate, $toDate]);
}
if (! empty($teamIds)) {
$query->where(function ($q) use ($teamIds) {
foreach ($teamIds as $id) {
$q->orWhereJsonContains('automated_reports.groups', $id);
}
});
}
if (! empty($reportTypes)) {
$query->whereIn('automated_reports.type', $reportTypes);
}
if (! empty($name)) {
$query->whereLike('name', "%$name%");
}
return $query->paginate($resultsPerPage, ['*'], 'page', $page);
}
public function countUserReports(User $user): int
{
return AutomatedReportResult::query()
->whereNotNull('generated_at')
->whereNotNull('sent_at')
->whereHas('report', function ($q) use ($user) {
$q->where('team_id', $user->getTeamId())
->whereJsonContains('recipients->users', $user->getId());
})
->count();
}
/**
* Restrict a query on the automated_reports table to reports the given user is allowed to see.
*
* Matches the customer-facing audience:
* - explicit user recipients (recipients.users)
* - members of any of the report's groups (Ask Jiminny reports)
*/
private function applyUserAccessScope(Builder $query, User $user): void
{
$userId = $user->getId();
$groupId = $user->getGroupId();
$query
->where('automated_reports.team_id', $user->getTeamId())
->where(function (Builder $q) use ($userId, $groupId): void {
$q->whereJsonContains('automated_reports.recipients->users', $userId);
if ($groupId !== null) {
$q->orWhere(function (Builder $sub) use ($groupId): void {
$sub->where('automated_reports.type', AutomatedReportsService::TYPE_ASK_JIMINNY)
->whereJsonContains('automated_reports.groups', $groupId);
});
}
});
}
/**
* Get report IDs for a specific team
*
* @param Team $team
*
* @return \Illuminate\Support\Collection
*/
public function getReportIdsByTeam(Team $team): \Illuminate\Support\Collection
{
return AutomatedReport::where('team_id', $team->getId())->pluck('id');
}
/**
* Get all reports for a specific team
*
* @param Team $team
*
* @return Collection
*/
public function getReportsByTeam(Team $team): Collection
{
return AutomatedReport::where('team_id', $team->getId())->get();
}
/**
* Get all report results for a specific report
*
* @param AutomatedReport $report
*
* @return Collection
*/
public function getResultsByReport(AutomatedReport $report): Collection
{
return $this->getResultsByReportQuery($report)->get();
}
public function getResultsByReportQuery(AutomatedReport $report): Builder
{
return AutomatedReportResult::where('report_id', $report->getId());
}
public function getReportResultsQueryForRetention(Team $team, CarbonImmutable $retentionDate): Builder
{
$reportIds = $this->getReportIdsByTeam($team);
return AutomatedReportResult::query()->whereIn('report_id', $reportIds)
->whereRaw('IFNULL(generated_at, created_at) <= ?', [$retentionDate]);
}
/**
* @param int|null $teamId Optional team ID to filter results
*
* @return \Illuminate\Support\Collection<int, int> Collection of team IDs
*/
public function getTeamIdsWithReportsResults(?int $teamId = null): \Illuminate\Support\Collection
{
$query = DB::table('automated_reports')
->join('teams', 'automated_reports.team_id', '=', 'teams.id')
->select('teams.id')
->distinct();
if ($teamId !== null) {
$query->where('teams.id', $teamId);
}
return $query->pluck('teams.id');
}
}
Execute
Explain Plan
Browse Query History
View Parameters
Open Query Execution Settings…
In-Editor Results
Tx: Auto
Cancel Running Statements
Playground
jiminny
Sync Changes
Hide This Notification
Code changed:
Hide
18
14
2
4
Previous Highlighted Error
Next Highlighted Error
SELECT a.id, a.uuid, a.actual_start_time, o.id, o.uuid FROM opportunities o
JOIN activities a ON o.id = a.opportunity_id
WHERE a.crm_configuration_id = 39
AND a.actual_start_time > '2025-10-13'
AND a.type IN ('conference', 'softphone-inbound', 'softphone-outbound')
;
SELECT * FROM activities
WHERE crm_configuration_id = 39 and user_id = 143
and actual_start_time >= '2025-10-13'
AND type IN ('conference', 'softphone-inbound', 'softphone-outbound')
;
SELECT * FROM opportunities WHERE account_id IN (178);
select * from activities where id IN (620137, 620187, 620188, 620189, 620230);
# HS
SELECT * FROM opportunities WHERE id IN (238);
select * from activities where id IN (477,2076);
select * from users;
SELECT COUNT(*) FROM users;
SELECT COUNT(*) FROM activities;
SELECT COUNT(*) FROM opportunities;
UPDATE activities
SET
actual_start_time = '2025-12-19 09:00:00',
actual_end_time = '2025-12-19 10:30:00',
scheduled_start_time = '2025-12-19 09:00:00',
scheduled_end_time = '2025-12-19 10:30:00'
WHERE id IN (407509,407375);
select * from partners;
SELECT id, uuid, type, actual_start_time, user_id, crm_configuration_id
FROM activities
WHERE user_id = 143
AND actual_start_time >= '2025-10-13 00:00:00'
AND actual_start_time <= '2026-01-13 23:59:59'
ORDER BY actual_start_time DESC;
SELECT * FROM activities WHERE uuid_to_bin('78eda160-3086-435f-88a5-bb0c71b6008d') = uuid;
SELECT * FROM crm_layouts where crm_configuration_id = 39;
SELECT * FROM crm_layout_entities WHERE crm_layout_id = 282;
# lead_id
# account_id 177
# contact_id 3969
# opportunity_id
# stage_id 203
SELECT * FROM opportunities WHERE opportunities.crm_configuration_id = id = 282;
SELECT * FROM activities where crm_configuration_id = 39 AND type = 'conference'
AND user_id = 143 and actual_start_time >= '2025-10-13';
SELECT * FROM activities a
# JOIN opportunities o ON a.opportunity_id = o.id
WHERE a.crm_configuration_id = 39 AND a.type = 'conference'
and status = 'completed' and recording_state = 'recorded'
and a.actual_start_time >= '2025-10-13'
AND a.user_id = 143
;
select * from leads
where crm_configuration_id = 39; # 112 -> ac. 178, 109 => op. 1707
SELECT * FROM activities WHERE id IN (356013,616188,616202,616310,407509,407375,356001,356008);
SELECT * FROM activities WHERE id IN (356013,616188,616202,616310);
SELECT * FROM activities WHERE id IN (407509,407375); # leads: 112, 109 | status - 198
SELECT * FROM activities WHERE id IN (356001, 356008); # contacts:
SELECT * FROM opportunities WHERE id IN (1707);
SELECT * FROM stages where id IN (204, 198);
SELECT * FROM opportunities WHERE account_id IN (178);
SELECT * FROM opportunities WHERE crm_configuration_id = 39 AND created_at > '2025-01-01';
SELECT * FROM contacts WHERE account_id IN (178); # 4118 Musaibe, 4448 Ceco Personal
SELECT * FROM activities where crm_configuration_id = 39
AND opportunity_id IS NULL
AND is_internal = false
and status = 'completed' and recording_state = 'recorded'
AND actual_start_time >= '2025-10-13'
AND (lead_id IS NOT NULL OR contact_id IS NOT NULL OR account_id IS NOT NULL)
# AND lead_id IN (112, 109)
;
SELECT * FROM crm_profiles WHERE user_id = 143;
select * from inboxes; # 212
select * from users where id = 143; # 143
select * from inbox_email_batches where inbox_id = 212
and updated_at >= '2026-01-28 00:00:00' order by id desc;
select * from inbox_emails where inbox_id = 212
and batch_id = 95885 order by id desc;
select * from email_messages where origin_user_id = 143;
select * from activities where user_id = 143 and updated_at >= '2026-01-28 00:00:00';
select * from participants where activity_id = 620247;
select * from crm_profiles where user_id = 143;
SELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid; # 356001
select * from transcription where activity_id = 356001; # 6943
select * from ai_prompts where transcription_id = 6943;
SELECT * FROM activity_summary_logs where activity_id = 356001;
SELECT * FROM social_accounts WHERE sociable_id = 143;
# [PASSWORD_DOTS]
SELECT * FROM activities WHERE uuid_to_bin('0164a4fb-cb95-454e-9edd-4d804e4999bd') = uuid;
# 422515 softphone tr. 8100
SELECT * FROM activities WHERE uuid_to_bin('7520add8-8d87-41a5-98e5-fc4edf96f21e') = uuid;
# 407509 conference tr. 7670 crmId: 00UD1000002J9aTMAS
select * from ai_prompts where transcription_id IN (8100, 7670);
select * from activity_summary_logs where activity_id = 407509;
select * from sidekick_settings;
select * from default_activity_types;
SELECT * FROM contacts WHERE crm_configuration_id = 39 and email = '[EMAIL]';
SELECT * FROM leads WHERE crm_configuration_id = 39 and email = '[EMAIL]';
SELECT * FROM activity_searches where user_id = 143;
SELECT * FROM groups where team_id = 1;
select * from teams where id = 1;
select * from groups where team_id = 1; # 1150 - 7e75f8025c22
select id, name, group_id, status, deleted_at, email
from users where team_id = 1 order by group_id desc ;
select * from activity_searches where id in (1977, 1978, 1979);
select * from activity_search_filters where activity_search_id IN (1977, 1978, 1979);
select * from activity_search_filters where filter = 'group_id' and value = '443f26b8-8512-437e-a9f9-7e75f8025c22'; # 10268, 10272, 10277
select * from nudges where activity_search_id IN (1977, 1978, 1979); # 877, 878, 879
INSERT INTO `activity_search_filters`
(`activity_search_id`, `filter`, `value`) VALUES
(1977, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),
(1978, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22'),
(1979, 'group_id', '443f26b8-8512-437e-a9f9-7e75f8025c22')
;
select * from crm_configurations where id = 39;
select sa.* from users u JOIN social_accounts sa on u.id = sa.sociable_id
where u.team_id = 1;
SELECT * FROM social_accounts WHERE sociable_id = 1635;
SELECT * FROM users WHERE id = 1635;
select * from teams where id = 1;
select * from users where team_id = 1;
select * from team_features where team_id = 1;
select * from features;
SELECT * FROM activity_searches where id = 1982; # 1981
SELECT * FROM activity_search_filters WHERE activity_search_id = 1982;
SELECT * FROM automated_reports where id = 68;
UPDATE automated_reports set playbook_categories = NULL where id = 68;
SELECT * FROM automated_report_results where id = 275;
SELECT * FROM automated_reports order by id desc;
SELECT * FROM automated_report_results order by id desc;
select * from activity_searches where user_id = 143;
select * from ask_anything_prompts;
SELECT * FROM groups WHERE id = 1439;
SELECT * FROM users WHERE group_id = 1439;
select * from permissions; # 158
select * from roles;
select * from permission_role
select * from teams where id = 1;
select * from groups g JOIN playbooks p on g.playbook_id = p.id where g.team_id = 1;
select * from groups where id = 28;
select * from playbooks where team_id = 1;
select * from playbooks where id = 179;
select * from playbook_categories where id = 1391;
select * from users where id = 143;
select * from crm_profiles where user_id = 143;
select * from activities where crm_configuration_id = 39 and type = 'conference'
and crm_provider_id IS NOT NULL ORDER by id desc;
select * from activities where id = 422003; # 00UO400000pB6fpMAC
SELECT ar.id, ar.uuid, ar.media_type, ar.status, a.type
FROM automated_report_results ar
JOIN automated_reports a ON a.id = ar.report_id
WHERE a.type = 'ask_jiminny'
LIMIT 10;
SELECT `automated_report_results`.* FROM `automated_report_results`
INNER JOIN `automated_reports`
ON `automated_report_results`.`report_id` = `automated_reports`.`id`
WHERE `automated_report_results`.`generated_at` IS NOT NULL
AND `automated_reports`.`team_id` = 1
AND JSON_CONTAINS(`automated_reports`.`recipients`, 1635, '$."users"')
;
select * from teams where id = 3143;
select * from crm_configurations where id = 500;
select * from users where name = 'Integration Account'; # 1695
SELECT * FROM social_accounts WHERE sociable_id = 1695;
select * from activities where crm_configuration_id = 39
and recording_state = 'recorded' and duration > 60
and status = 'completed' and actual_start_time >= '2025-12-01';
SELECT * FROM activities WHERE uuid_to_bin('458cf915-b914-4000-b083-5687b32b2956') = uuid;
select * from leads;
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
NULL
|
|
67520
|
NULL
|
0
|
2026-04-21T15:45:55.267346+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776786355267_m2.jpg...
|
Slack
|
Aneliya Angelova (DM) - Jiminny Inc - 1 new item - Aneliya Angelova (DM) - Jiminny Inc - 1 new item - Slack...
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Aneliya Angelova
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Today at 5:36:07 PM
5:36
eto go reporta w kiosk
image.png
Toggle file
image.png
Today at 5:36:33 PM
5:36
той трябва да се шерне само с Web Service Account 2
Today at 5:40:40 PM
5:40
вие нали използвате тази колона
groups
в момента при новите репорти за да сложите тимовете с които се шерва, а при репортите в киоска няма шерване с екипи и в тази колона за екипите от чиито активитита се филтрират активитита за репортите
Lukas Kovalik
Today at 5:41:02 PM
5:41 PM
да
Today at 5:41:09 PM
5:41
може ли да се чуем само да вид на прод
Today at 5:41:47 PM
5:41
или пак то може и без
Today at 5:41:51 PM
5:41
сега ще видя
Aneliya Angelova
Today at 5:43:08 PM
5:43 PM
може да се чуем да
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:43:09 PM
5:43
само кажи
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 5:58:04 PM
5:58 PM
ок мисля че го оправих вече, само да го изтествам
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:58:17 PM
5:58
за другите неща нещо се обръках
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:58:20 PM
5:58
Галя иска в колоната SHARED
значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като “Shared With”
Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:59:30 PM
5:59
ако съм creator на template и на result трябва да виждам всички с който е споделено , включително и мен, така ли?
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 6:00:48 PM
6:00 PM
bez teb
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:00:49 PM
6:00 PM
или да се махне мое име
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:00:51 PM
6:00
ок
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 6:00:56 PM
6:00 PM
да
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Todor Stamatov, Direct Message, 1 of 15 suggestions
Channel...
|
[{"role":"AXPopUpButton","text [{"role":"AXPopUpButton","text":"Switch workspaces… (Jiminny Inc) Has new messages","depth":14,"bounds":{"left":0.0056515955,"top":0.058260176,"width":0.011968086,"height":0.028731046},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"Home","depth":14,"bounds":{"left":0.0029920214,"top":0.10055866,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Home","depth":16,"bounds":{"left":0.0066489363,"top":0.13806863,"width":0.009973404,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"DMs","depth":14,"bounds":{"left":0.0029920214,"top":0.15482841,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"DMs","depth":16,"bounds":{"left":0.0076462766,"top":0.19233839,"width":0.007978723,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Activity","depth":14,"bounds":{"left":0.0029920214,"top":0.20909816,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Activity","depth":16,"bounds":{"left":0.004986702,"top":0.24660814,"width":0.012965426,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":14,"bounds":{"left":0.0029920214,"top":0.26336792,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":16,"bounds":{"left":0.0076462766,"top":0.3008779,"width":0.0076462766,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Later","depth":14,"bounds":{"left":0.0029920214,"top":0.31763768,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Later","depth":16,"bounds":{"left":0.00731383,"top":0.35514766,"width":0.008643617,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"More…","depth":14,"bounds":{"left":0.0029920214,"top":0.3719074,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More","depth":16,"bounds":{"left":0.006981383,"top":0.4094174,"width":0.008976064,"height":0.0103751},"role_description":"text"},{"role":"AXStaticText","text":"Unreads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Threads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Huddles","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Drafts & sent","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Directories","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-x-integration-app","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-inner-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"ai-chapter","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"alerts","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"backend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"c-learning-people","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"confusion-clinic","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"curiosity_lab","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"engineering","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"frontend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"general","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"infra-changes","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-bg","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-copilot-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-zoom-phone-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-team","depth":23,"bounds":{"left":0.042220745,"top":0.09177973,"width":0.03125,"height":0.003990423},"role_description":"text"},{"role":"AXStaticText","text":"platform-tickets","depth":23,"bounds":{"left":0.042220745,"top":0.103751,"width":0.034906916,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"product_launches","depth":23,"bounds":{"left":0.042220745,"top":0.12609737,"width":0.03856383,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"random","depth":23,"bounds":{"left":0.042220745,"top":0.14844373,"width":0.01662234,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"releases","depth":23,"bounds":{"left":0.042220745,"top":0.1707901,"width":0.01761968,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"support","depth":23,"bounds":{"left":0.042220745,"top":0.19313647,"width":0.016954787,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"thank-yous","depth":23,"bounds":{"left":0.042220745,"top":0.21548285,"width":0.024268618,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"the_people_of_jiminny","depth":23,"bounds":{"left":0.042220745,"top":0.23782921,"width":0.04488032,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"bounds":{"left":0.042220745,"top":0.2905028,"width":0.03756649,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"bounds":{"left":0.07945479,"top":0.2905028,"width":0.0063164895,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"bounds":{"left":0.08211436,"top":0.2905028,"width":0.014295213,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"bounds":{"left":0.09607713,"top":0.30806065,"width":0.0003324468,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Steliyan Georgiev","depth":23,"bounds":{"left":0.09607713,"top":0.30806065,"width":0.0003324468,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"bounds":{"left":0.042220745,"top":0.31284916,"width":0.03756649,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Mario Georgiev","depth":23,"bounds":{"left":0.042220745,"top":0.33519554,"width":0.033909574,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"bounds":{"left":0.042220745,"top":0.3575419,"width":0.032912236,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Todor Stamatov","depth":23,"bounds":{"left":0.042220745,"top":0.37988827,"width":0.034242023,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Gabriela Dureva","depth":23,"bounds":{"left":0.042220745,"top":0.40223464,"width":0.03523936,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Petko Kashinski","depth":23,"bounds":{"left":0.042220745,"top":0.424581,"width":0.034242023,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Vasil Vasilev","depth":23,"bounds":{"left":0.042220745,"top":0.44692737,"width":0.026263298,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Nikolov","depth":23,"bounds":{"left":0.042220745,"top":0.46927375,"width":0.034242023,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Galya Dimitrova","depth":23,"bounds":{"left":0.042220745,"top":0.49162012,"width":0.034906916,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Stefka Stoyanova","depth":23,"bounds":{"left":0.042220745,"top":0.5139665,"width":0.03756649,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tomov","depth":23,"bounds":{"left":0.042220745,"top":0.5363129,"width":0.030585106,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tanev","depth":23,"bounds":{"left":0.042220745,"top":0.5586592,"width":0.028922873,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Ivanov","depth":23,"bounds":{"left":0.042220745,"top":0.5810056,"width":0.031914894,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Ves","depth":23,"bounds":{"left":0.042220745,"top":0.60335195,"width":0.0076462766,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Jira Cloud","depth":23,"bounds":{"left":0.042220745,"top":0.6560255,"width":0.022273935,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Toast","depth":23,"bounds":{"left":0.042220745,"top":0.6783719,"width":0.011635638,"height":0.014365523},"role_description":"text"},{"role":"AXRadioButton","text":"Messages","depth":17,"bounds":{"left":0.10206117,"top":0.09177973,"width":0.030585106,"height":0.030327214},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Messages","depth":19,"bounds":{"left":0.111369684,"top":0.10055866,"width":0.01861702,"height":0.012769354},"role_description":"text"},{"role":"AXRadioButton","text":"Add canvas","depth":18,"bounds":{"left":0.13397606,"top":0.09177973,"width":0.033909574,"height":0.030327214},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Add canvas","depth":20,"bounds":{"left":0.14328457,"top":0.10055866,"width":0.021941489,"height":0.012769354},"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":17,"bounds":{"left":0.16921543,"top":0.09177973,"width":0.020944148,"height":0.030327214},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":19,"bounds":{"left":0.17852394,"top":0.10055866,"width":0.008976064,"height":0.012769354},"role_description":"text"},{"role":"AXPopUpButton","text":"Add and Edit Channel Tabs","depth":17,"bounds":{"left":0.19115691,"top":0.09177973,"width":0.010970744,"height":0.030327214},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Canvas","depth":17,"bounds":{"left":0.096409574,"top":0.0518755,"width":0.015625,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"List","depth":17,"bounds":{"left":0.096409574,"top":0.0518755,"width":0.0076462766,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Folder","depth":17,"bounds":{"left":0.096409574,"top":0.0518755,"width":0.013962766,"height":0.0007980846},"role_description":"text"},{"role":"AXPopUpButton","text":"Jump to date","depth":23,"bounds":{"left":0.15026596,"top":0.12689546,"width":0.025265958,"height":0.022346368},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:36:07 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:36","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"eto go reporta w kiosk","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"image.png","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"","depth":25,"role_description":"text"},{"role":"AXButton","text":"Toggle file","depth":25,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXLink","text":"image.png","depth":27,"role_description":"Unlabelled image","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:36:33 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:36","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"той трябва да се шерне само с Web Service Account 2","depth":25,"role_description":"text"},{"role":"AXLink","text":"Today at 5:40:40 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:40","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"вие нали използвате тази колона","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"groups","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"в момента при новите репорти за да сложите тимовете с които се шерва, а при репортите в киоска няма шерване с екипи и в тази колона за екипите от чиито активитита се филтрират активитита за репортите","depth":25,"role_description":"text"},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:41:02 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:41 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"да","depth":25,"role_description":"text"},{"role":"AXLink","text":"Today at 5:41:09 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:41","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"може ли да се чуем само да вид на прод","depth":25,"role_description":"text"},{"role":"AXLink","text":"Today at 5:41:47 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:41","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"или пак то може и без","depth":25,"role_description":"text"},{"role":"AXLink","text":"Today at 5:41:51 PM","depth":25,"bounds":{"left":0.107380316,"top":0.11572227,"width":0.007978723,"height":0.0071827616},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:41","depth":26,"bounds":{"left":0.107380316,"top":0.11572227,"width":0.007978723,"height":0.0071827616},"role_description":"text"},{"role":"AXStaticText","text":"сега ще видя","depth":25,"bounds":{"left":0.11801862,"top":0.11572227,"width":0.029920213,"height":0.007980846},"role_description":"text"},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"bounds":{"left":0.11801862,"top":0.13168396,"width":0.038896278,"height":0.017557861},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.15658244,"top":0.13328013,"width":0.0029920214,"height":0.014365523},"role_description":"text"},{"role":"AXLink","text":"Today at 5:43:08 PM","depth":24,"bounds":{"left":0.15924202,"top":0.13567439,"width":0.015292553,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:43 PM","depth":25,"bounds":{"left":0.15924202,"top":0.13567439,"width":0.015292553,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"може да се чуем да","depth":25,"bounds":{"left":0.11801862,"top":0.15083799,"width":0.045212764,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.11811652,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.11811652,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.11811652,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.11811652,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.11811652,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.11811652,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.11811652,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.11811652,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:43:09 PM","depth":25,"bounds":{"left":0.107380316,"top":0.17717478,"width":0.007978723,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:43","depth":26,"bounds":{"left":0.107380316,"top":0.17717478,"width":0.007978723,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"само кажи","depth":25,"bounds":{"left":0.11801862,"top":0.17478053,"width":0.024268618,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.15003991,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.15003991,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.15003991,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.15003991,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.15003991,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.15003991,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.15003991,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.15003991,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"bounds":{"left":0.11801862,"top":0.1971269,"width":0.030917553,"height":0.017557861},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.14860372,"top":0.19872306,"width":0.0029920214,"height":0.014365523},"role_description":"text"},{"role":"AXLink","text":"Today at 5:58:04 PM","depth":24,"bounds":{"left":0.1512633,"top":0.20111732,"width":0.015292553,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:58 PM","depth":25,"bounds":{"left":0.1512633,"top":0.20111732,"width":0.015292553,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"ок мисля че го оправих вече, само да го изтествам","depth":25,"bounds":{"left":0.11801862,"top":0.21628092,"width":0.09142287,"height":0.031923383},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.18355946,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.18355946,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.18355946,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.18355946,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.18355946,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.18355946,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.18355946,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.18355946,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:58:17 PM","depth":25,"bounds":{"left":0.107380316,"top":0.2601756,"width":0.007978723,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:58","depth":26,"bounds":{"left":0.107380316,"top":0.2601756,"width":0.007978723,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"за другите неща нещо се обръках","depth":25,"bounds":{"left":0.11801862,"top":0.25778133,"width":0.078125,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.2330407,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.2330407,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.2330407,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.2330407,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.2330407,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.2330407,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.2330407,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.2330407,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:58:20 PM","depth":25,"bounds":{"left":0.107380316,"top":0.28411812,"width":0.007978723,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:58","depth":26,"bounds":{"left":0.107380316,"top":0.28411812,"width":0.007978723,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"Галя иска в колоната SHARED","depth":25,"bounds":{"left":0.11801862,"top":0.28172386,"width":0.068484046,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като “Shared With”","depth":25,"bounds":{"left":0.11801862,"top":0.29928172,"width":0.10172872,"height":0.049481247},"role_description":"text"},{"role":"AXStaticText","text":"Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна","depth":25,"bounds":{"left":0.11801862,"top":0.3519553,"width":0.102726065,"height":0.049481247},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.25698325,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.25698325,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.25698325,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.25698325,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.25698325,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.25698325,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.25698325,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.25698325,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:59:30 PM","depth":25,"bounds":{"left":0.107380316,"top":0.41340783,"width":0.007978723,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:59","depth":26,"bounds":{"left":0.107380316,"top":0.41340783,"width":0.007978723,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"ако съм creator на template и на result трябва да виждам всички с който е споделено , включително и мен, така ли?","depth":25,"bounds":{"left":0.11801862,"top":0.41101357,"width":0.10305851,"height":0.049481247},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.38627294,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.38627294,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.38627294,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.38627294,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.38627294,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.38627294,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.38627294,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.38627294,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"bounds":{"left":0.11801862,"top":0.46847567,"width":0.038896278,"height":0.017557861},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.15658244,"top":0.47007182,"width":0.0029920214,"height":0.014365523},"role_description":"text"},{"role":"AXLink","text":"Today at 6:00:48 PM","depth":24,"bounds":{"left":0.15924202,"top":0.47246608,"width":0.015292553,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:00 PM","depth":25,"bounds":{"left":0.15924202,"top":0.47246608,"width":0.015292553,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"bez teb","depth":25,"bounds":{"left":0.11801862,"top":0.48762968,"width":0.016289894,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.45490822,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.45490822,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.45490822,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.45490822,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.45490822,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.45490822,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.45490822,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.45490822,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"bounds":{"left":0.11801862,"top":0.509976,"width":0.030917553,"height":0.017557861},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.14860372,"top":0.51157224,"width":0.0029920214,"height":0.014365523},"role_description":"text"},{"role":"AXLink","text":"Today at 6:00:49 PM","depth":24,"bounds":{"left":0.1512633,"top":0.5139665,"width":0.015292553,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:00 PM","depth":25,"bounds":{"left":0.1512633,"top":0.5139665,"width":0.015292553,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"или да се махне мое име","depth":25,"bounds":{"left":0.11801862,"top":0.5291301,"width":0.057513297,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.4964086,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.4964086,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.4964086,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.4964086,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.4964086,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.4964086,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.4964086,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.4964086,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 6:00:51 PM","depth":25,"bounds":{"left":0.107380316,"top":0.5554669,"width":0.007978723,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:00","depth":26,"bounds":{"left":0.107380316,"top":0.5554669,"width":0.007978723,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"ок","depth":25,"bounds":{"left":0.11801862,"top":0.55307263,"width":0.005319149,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.528332,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.528332,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.528332,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.528332,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.528332,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.528332,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.528332,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.528332,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"bounds":{"left":0.11801862,"top":0.575419,"width":0.038896278,"height":0.017557861},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.15658244,"top":0.57701516,"width":0.0029920214,"height":0.014365523},"role_description":"text"},{"role":"AXLink","text":"Today at 6:00:56 PM","depth":24,"bounds":{"left":0.15924202,"top":0.5794094,"width":0.015292553,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:00 PM","depth":25,"bounds":{"left":0.15924202,"top":0.5794094,"width":0.015292553,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"да","depth":25,"bounds":{"left":0.11801862,"top":0.594573,"width":0.0056515955,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.56185156,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.56185156,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.56185156,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.56185156,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.56185156,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.56185156,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.56185156,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.56185156,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"","depth":23,"bounds":{"left":0.10372341,"top":0.6272945,"width":0.118351065,"height":0.030327214},"value":"","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Todor Stamatov, Direct Message, 1 of 15 suggestions","depth":11,"bounds":{"left":0.0,"top":0.7126895,"width":0.026263298,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Channel","depth":11,"bounds":{"left":0.0,"top":0.7126895,"width":0.017287234,"height":0.0007980846},"role_description":"text"}]...
|
7610506607449357182
|
-1569190189884602040
|
visual_change
|
hybrid
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Aneliya Angelova
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Today at 5:36:07 PM
5:36
eto go reporta w kiosk
image.png
Toggle file
image.png
Today at 5:36:33 PM
5:36
той трябва да се шерне само с Web Service Account 2
Today at 5:40:40 PM
5:40
вие нали използвате тази колона
groups
в момента при новите репорти за да сложите тимовете с които се шерва, а при репортите в киоска няма шерване с екипи и в тази колона за екипите от чиито активитита се филтрират активитита за репортите
Lukas Kovalik
Today at 5:41:02 PM
5:41 PM
да
Today at 5:41:09 PM
5:41
може ли да се чуем само да вид на прод
Today at 5:41:47 PM
5:41
или пак то може и без
Today at 5:41:51 PM
5:41
сега ще видя
Aneliya Angelova
Today at 5:43:08 PM
5:43 PM
може да се чуем да
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:43:09 PM
5:43
само кажи
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 5:58:04 PM
5:58 PM
ок мисля че го оправих вече, само да го изтествам
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:58:17 PM
5:58
за другите неща нещо се обръках
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:58:20 PM
5:58
Галя иска в колоната SHARED
значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като “Shared With”
Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:59:30 PM
5:59
ако съм creator на template и на result трябва да виждам всички с който е споделено , включително и мен, така ли?
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 6:00:48 PM
6:00 PM
bez teb
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:00:49 PM
6:00 PM
или да се махне мое име
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:00:51 PM
6:00
ок
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 6:00:56 PM
6:00 PM
да
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Todor Stamatov, Direct Message, 1 of 15 suggestions
Channel
HomeActivityslackcalVIewJiminny ...# platform-tickets# product_launchesac random# releases# support# thank-yous# the_people_of jimi...• Direct messages(3) Aneliva Angelova.A. Aneliya Angelova&. Mario GeorgievFR. Nikolay YankovS: Todor StamatovP. Gabriela Dureva. Petko Kashinski€. Vasil VasilevNikolav Nikolov. Galya Dimitrovaa. Stefka Stoyanovaa Stoyan Tomov2o Stoyan Tanev EC. Nikolay IvanovP. Vesi AppsG Jira Cloud8 ToastmistonWindowhelp@ Describe what you are looking for. Aneliya Angelova• Messagest Add canvasur FilesAneliya Angelc Today ~може да се чуем дасамо кажиLukas Kovalik 5:58 PMок мисля че го оправих вече, само да гоза другите неща нещо се обрькахГаля иска в колоната SHAREDзначи сталателя на темплейта на ДИ.Рeпоптс стпаницата вижла винаги и себе сиkatо "Shared With"Галя иска да се махне creator-a ot SharedWith і ако не е шернал с никого, то колонатаwe e nраsнаако съм creator на template и на result трябвада виждам всички с които е споделено .РИПИЧИТОЛНА И МОН ТАКА Ли?Aneliya Angelova 6:00 PMhez tehuukaс Kovallk 4-00 pMили ла се махне мое имеAneliva Angelova 6:00 PMMessage Aneliya Angelova+ AalJy-18909-automated-reports-asYou are currently impersonating Aneliya Angelova €)•© Clear allFREQUENCY #One-OffOne-OffOne-OffOne-OffEõ3 Ask Jiminny reportsSHAREDDATE +31/03/202631/03/202621/02/202431/03/2026ACTIONS• Cao Cia® CorГРонInspectorConsoleT.l NetworkStvle Editon) PerformanceAll HTMI.200200200200200200200200MethodPOSTPOSTPOSTPOSTPOSTPOSTPOSTPOSTDebuggerInitiatorA g 036719.ingest.se.../api/5627310/envelope/?sentry_version=7&sentry_ke fetchA 5 036719.ingest.se.../api/5627310/envelope/?sentry_version=7&sentry_ke fetchA app.staging jiminny...search?status ()=completed&sort_by=dateHeld& a xhrA app.staging.jiminny....xhiA app. staging fjiminny...A xhA app.staging.jiminny...A find.userpilot.iointegrationsNX-094be170xhiA app.staging.jiminny....Ar.logr-in.comAr.logr-in.comi?a=ponxaf/platform-staging&r=6-019db076-93 +a xhri?a=ponxaf/platform-staging&r=6-019db076-935d-; xhri?a=ponxaf/platform-staging&r=6-019db076-935d-7 xhrA r.logr-in.comi?a=ponxaf/platform-staging&r=6-019db076-935d-7 xhrAr.logr-in.comi?a=ponxaf/platform-staging&r=6-019db076-935d-7 xhrA r.logr-in.comi?a=ponxaf/platform-staging&r=6-019db076-935d-7 xhr100% L2Tue 21 Apr 18:45:55U Memory »© 99+• Disable Cache No Throttling : dType2 B | 53 m2815712.94 kB | 501 г27.02 kB 90814.84 KB | 617 г5.53 kB 82062 B10 me96B 411гOB|173OB 474.56 kB17 roauocteload. 212 md...
|
67517
|
|
67521
|
NULL
|
0
|
2026-04-21T15:45:56.034021+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776786356034_m1.jpg...
|
Slack
|
Aneliya Angelova (DM) - Jiminny Inc - 1 new item - Aneliya Angelova (DM) - Jiminny Inc - 1 new item - Slack...
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Aneliya Angelova
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Today at 5:36:07 PM
5:36
eto go reporta w kiosk
image.png
Toggle file
image.png
Today at 5:36:33 PM
5:36
той трябва да се шерне само с Web Service Account 2
Today at 5:40:40 PM
5:40
вие нали използвате тази колона
groups
в момента при новите репорти за да сложите тимовете с които се шерва, а при репортите в киоска няма шерване с екипи и в тази колона за екипите от чиито активитита се филтрират активитита за репортите
Lukas Kovalik
Today at 5:41:02 PM
5:41 PM
да
Today at 5:41:09 PM
5:41
може ли да се чуем само да вид на прод
Today at 5:41:47 PM
5:41
или пак то може и без
Today at 5:41:51 PM
5:41
сега ще видя
Aneliya Angelova
Today at 5:43:08 PM
5:43 PM
може да се чуем да
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:43:09 PM
5:43
само кажи
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 5:58:04 PM
5:58 PM
ок мисля че го оправих вече, само да го изтествам
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:58:17 PM
5:58
за другите неща нещо се обръках
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:58:20 PM
5:58
Галя иска в колоната SHARED
значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като “Shared With”
Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:59:30 PM
5:59
ако съм creator на template и на result трябва да виждам всички с който е споделено , включително и мен, така ли?
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 6:00:48 PM
6:00 PM
bez teb
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:00:49 PM
6:00 PM
или да се махне мое име
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:00:51 PM
6:00
ок
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 6:00:56 PM
6:00 PM
да
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Todor Stamatov, Direct Message, 1 of 15 suggestions
Channel...
|
[{"role":"AXPopUpButton","text [{"role":"AXPopUpButton","text":"Switch workspaces… (Jiminny Inc) Has new messages","depth":14,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"Home","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Home","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"DMs","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"DMs","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"Activity","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Activity","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"Later","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Later","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"More…","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More","depth":16,"role_description":"text"},{"role":"AXStaticText","text":"Unreads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Threads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Huddles","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Drafts & sent","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Directories","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-x-integration-app","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-inner-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"ai-chapter","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"alerts","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"backend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"c-learning-people","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"confusion-clinic","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"curiosity_lab","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"engineering","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"frontend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"general","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"infra-changes","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-bg","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-copilot-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-zoom-phone-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-tickets","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"product_launches","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"random","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"releases","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"support","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"thank-yous","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"the_people_of_jiminny","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Steliyan Georgiev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Mario Georgiev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Todor Stamatov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Gabriela Dureva","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Petko Kashinski","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Vasil Vasilev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Nikolov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Galya Dimitrova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Stefka Stoyanova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tomov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tanev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Ivanov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Ves","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Jira Cloud","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Toast","depth":23,"role_description":"text"},{"role":"AXRadioButton","text":"Messages","depth":17,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Messages","depth":19,"role_description":"text"},{"role":"AXRadioButton","text":"Add canvas","depth":18,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Add canvas","depth":20,"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":17,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":19,"role_description":"text"},{"role":"AXPopUpButton","text":"Add and Edit Channel Tabs","depth":17,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Canvas","depth":17,"role_description":"text"},{"role":"AXStaticText","text":"List","depth":17,"role_description":"text"},{"role":"AXStaticText","text":"Folder","depth":17,"role_description":"text"},{"role":"AXPopUpButton","text":"Jump to date","depth":23,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:36:07 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:36","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"eto go reporta w kiosk","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"image.png","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"","depth":25,"role_description":"text"},{"role":"AXButton","text":"Toggle file","depth":25,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXLink","text":"image.png","depth":27,"role_description":"Unlabelled image","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:36:33 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:36","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"той трябва да се шерне само с Web Service Account 2","depth":25,"role_description":"text"},{"role":"AXLink","text":"Today at 5:40:40 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:40","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"вие нали използвате тази колона","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"groups","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"в момента при новите репорти за да сложите тимовете с които се шерва, а при репортите в киоска няма шерване с екипи и в тази колона за екипите от чиито активитита се филтрират активитита за репортите","depth":25,"role_description":"text"},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:41:02 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:41 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"да","depth":25,"role_description":"text"},{"role":"AXLink","text":"Today at 5:41:09 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:41","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"може ли да се чуем само да вид на прод","depth":25,"role_description":"text"},{"role":"AXLink","text":"Today at 5:41:47 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:41","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"или пак то може и без","depth":25,"role_description":"text"},{"role":"AXLink","text":"Today at 5:41:51 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:41","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"сега ще видя","depth":25,"role_description":"text"},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:43:08 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:43 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"може да се чуем да","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:43:09 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:43","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"само кажи","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:58:04 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:58 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"ок мисля че го оправих вече, само да го изтествам","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:58:17 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:58","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"за другите неща нещо се обръках","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:58:20 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:58","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"Галя иска в колоната SHARED","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като “Shared With”","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:59:30 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:59","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"ако съм creator на template и на result трябва да виждам всички с който е споделено , включително и мен, така ли?","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:00:48 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:00 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"bez teb","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:00:49 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:00 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"или да се махне мое име","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 6:00:51 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:00","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"ок","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:00:56 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:00 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"да","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"","depth":23,"value":"","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Todor Stamatov, Direct Message, 1 of 15 suggestions","depth":11,"role_description":"text"},{"role":"AXStaticText","text":"Channel","depth":11,"role_description":"text"}]...
|
7610506607449357182
|
-1569190189884602040
|
visual_change
|
hybrid
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Aneliya Angelova
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Today at 5:36:07 PM
5:36
eto go reporta w kiosk
image.png
Toggle file
image.png
Today at 5:36:33 PM
5:36
той трябва да се шерне само с Web Service Account 2
Today at 5:40:40 PM
5:40
вие нали използвате тази колона
groups
в момента при новите репорти за да сложите тимовете с които се шерва, а при репортите в киоска няма шерване с екипи и в тази колона за екипите от чиито активитита се филтрират активитита за репортите
Lukas Kovalik
Today at 5:41:02 PM
5:41 PM
да
Today at 5:41:09 PM
5:41
може ли да се чуем само да вид на прод
Today at 5:41:47 PM
5:41
или пак то може и без
Today at 5:41:51 PM
5:41
сега ще видя
Aneliya Angelova
Today at 5:43:08 PM
5:43 PM
може да се чуем да
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:43:09 PM
5:43
само кажи
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 5:58:04 PM
5:58 PM
ок мисля че го оправих вече, само да го изтествам
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:58:17 PM
5:58
за другите неща нещо се обръках
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:58:20 PM
5:58
Галя иска в колоната SHARED
значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като “Shared With”
Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:59:30 PM
5:59
ако съм creator на template и на result трябва да виждам всички с който е споделено , включително и мен, така ли?
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 6:00:48 PM
6:00 PM
bez teb
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:00:49 PM
6:00 PM
или да се махне мое име
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:00:51 PM
6:00
ок
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 6:00:56 PM
6:00 PM
да
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Todor Stamatov, Direct Message, 1 of 15 suggestions
Channel
iTerm2ShellEditViewSessionScriptsProfilesWindowHelp-zsh* Build full day activity...• *4|DOCKERO ₴1-zshworker-nudges:worker-nudges_00: started₴2-zshscreenpipe*What's next:Try Docker Debug for seamless, persistent debugging tools in any container or image + docker debug docker_lamp_1Learn moreat [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-18909-automated-reports-ask-jiminny) $ csfixdockerexec -it docker_lamp_1./vendor/bin/php-cs-fixer fix--config=.php-cs-fixer.dist.php -v --using-cache=no --diffPHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.PHPruntime:8.3.30Running analysis on 7 cores with 10 files per process.Parallel runner is an experimental feature and may be unstable, use it at your own risk. Feedback highly appreciated!Loadedconfigdefault from-php-cs-fixer.dist.php".5609/5609100%4285-zsh100% <7886Tue 21 Apr 18:45:56APP (-zsh)T₴1+Fixed 0 of 5609 files in 36.627 seconds, 60.00 MB memory usedWhat's next:Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-18909-automated-reports-ask-jiminny) $ ||...
|
67519
|
|
67522
|
1521
|
0
|
2026-04-21T15:46:26.420620+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776786386420_m2.jpg...
|
Slack
|
Aneliya Angelova (DM) - Jiminny Inc - 1 new item - Aneliya Angelova (DM) - Jiminny Inc - 1 new item - Slack...
|
1
|
NULL
|
monitor_2
|
NULL
|
NULL
|
NULL
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Aneliya Angelova
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Today at 5:36:07 PM
5:36
eto go reporta w kiosk
image.png
Toggle file
image.png
Today at 5:36:33 PM
5:36
той трябва да се шерне само с Web Service Account 2
Today at 5:40:40 PM
5:40
вие нали използвате тази колона
groups
в момента при новите репорти за да сложите тимовете с които се шерва, а при репортите в киоска няма шерване с екипи и в тази колона за екипите от чиито активитита се филтрират активитита за репортите
Lukas Kovalik
Today at 5:41:02 PM
5:41 PM
да
Today at 5:41:09 PM
5:41
може ли да се чуем само да вид на прод
Today at 5:41:47 PM
5:41
или пак то може и без
Today at 5:41:51 PM
5:41
сега ще видя
Aneliya Angelova
Today at 5:43:08 PM
5:43 PM
може да се чуем да
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:43:09 PM
5:43
само кажи
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 5:58:04 PM
5:58 PM
ок мисля че го оправих вече, само да го изтествам
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:58:17 PM
5:58
за другите неща нещо се обръках
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:58:20 PM
5:58
Галя иска в колоната SHARED
значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като “Shared With”
Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:59:30 PM
5:59
ако съм creator на template и на result трябва да виждам всички с който е споделено , включително и мен, така ли?
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 6:00:48 PM
6:00 PM
bez teb
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:00:49 PM
6:00 PM
или да се махне мое име
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:00:51 PM
6:00
ок
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 6:00:56 PM
6:00 PM
да
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Todor Stamatov, Direct Message, 1 of 15 suggestions
Channel...
|
[{"role":"AXPopUpButton","text [{"role":"AXPopUpButton","text":"Switch workspaces… (Jiminny Inc) Has new messages","depth":14,"bounds":{"left":0.0056515955,"top":0.058260176,"width":0.011968086,"height":0.028731046},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"Home","depth":14,"bounds":{"left":0.0029920214,"top":0.10055866,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Home","depth":16,"bounds":{"left":0.0066489363,"top":0.13806863,"width":0.009973404,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"DMs","depth":14,"bounds":{"left":0.0029920214,"top":0.15482841,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"DMs","depth":16,"bounds":{"left":0.0076462766,"top":0.19233839,"width":0.007978723,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Activity","depth":14,"bounds":{"left":0.0029920214,"top":0.20909816,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Activity","depth":16,"bounds":{"left":0.004986702,"top":0.24660814,"width":0.012965426,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":14,"bounds":{"left":0.0029920214,"top":0.26336792,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":16,"bounds":{"left":0.0076462766,"top":0.3008779,"width":0.0076462766,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"Later","depth":14,"bounds":{"left":0.0029920214,"top":0.31763768,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Later","depth":16,"bounds":{"left":0.00731383,"top":0.35514766,"width":0.008643617,"height":0.0103751},"role_description":"text"},{"role":"AXRadioButton","text":"More…","depth":14,"bounds":{"left":0.0029920214,"top":0.3719074,"width":0.017287234,"height":0.054269753},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More","depth":16,"bounds":{"left":0.006981383,"top":0.4094174,"width":0.008976064,"height":0.0103751},"role_description":"text"},{"role":"AXStaticText","text":"Unreads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Threads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Huddles","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Drafts & sent","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Directories","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-x-integration-app","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-inner-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"ai-chapter","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"alerts","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"backend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"c-learning-people","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"confusion-clinic","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"curiosity_lab","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"engineering","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"frontend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"general","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"infra-changes","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-bg","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-copilot-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-zoom-phone-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-team","depth":23,"bounds":{"left":0.042220745,"top":0.09177973,"width":0.03125,"height":0.003990423},"role_description":"text"},{"role":"AXStaticText","text":"platform-tickets","depth":23,"bounds":{"left":0.042220745,"top":0.103751,"width":0.034906916,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"product_launches","depth":23,"bounds":{"left":0.042220745,"top":0.12609737,"width":0.03856383,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"random","depth":23,"bounds":{"left":0.042220745,"top":0.14844373,"width":0.01662234,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"releases","depth":23,"bounds":{"left":0.042220745,"top":0.1707901,"width":0.01761968,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"support","depth":23,"bounds":{"left":0.042220745,"top":0.19313647,"width":0.016954787,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"thank-yous","depth":23,"bounds":{"left":0.042220745,"top":0.21548285,"width":0.024268618,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"the_people_of_jiminny","depth":23,"bounds":{"left":0.042220745,"top":0.23782921,"width":0.04488032,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"bounds":{"left":0.042220745,"top":0.2905028,"width":0.03756649,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"bounds":{"left":0.07945479,"top":0.2905028,"width":0.0063164895,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"bounds":{"left":0.08211436,"top":0.2905028,"width":0.014295213,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"bounds":{"left":0.09607713,"top":0.30806065,"width":0.0003324468,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Steliyan Georgiev","depth":23,"bounds":{"left":0.09607713,"top":0.30806065,"width":0.0003324468,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"bounds":{"left":0.042220745,"top":0.31284916,"width":0.03756649,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Mario Georgiev","depth":23,"bounds":{"left":0.042220745,"top":0.33519554,"width":0.033909574,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"bounds":{"left":0.042220745,"top":0.3575419,"width":0.032912236,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Todor Stamatov","depth":23,"bounds":{"left":0.042220745,"top":0.37988827,"width":0.034242023,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Gabriela Dureva","depth":23,"bounds":{"left":0.042220745,"top":0.40223464,"width":0.03523936,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Petko Kashinski","depth":23,"bounds":{"left":0.042220745,"top":0.424581,"width":0.034242023,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Vasil Vasilev","depth":23,"bounds":{"left":0.042220745,"top":0.44692737,"width":0.026263298,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Nikolov","depth":23,"bounds":{"left":0.042220745,"top":0.46927375,"width":0.034242023,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Galya Dimitrova","depth":23,"bounds":{"left":0.042220745,"top":0.49162012,"width":0.034906916,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Stefka Stoyanova","depth":23,"bounds":{"left":0.042220745,"top":0.5139665,"width":0.03756649,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tomov","depth":23,"bounds":{"left":0.042220745,"top":0.5363129,"width":0.030585106,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tanev","depth":23,"bounds":{"left":0.042220745,"top":0.5586592,"width":0.028922873,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Ivanov","depth":23,"bounds":{"left":0.042220745,"top":0.5810056,"width":0.031914894,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Ves","depth":23,"bounds":{"left":0.042220745,"top":0.60335195,"width":0.0076462766,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Jira Cloud","depth":23,"bounds":{"left":0.042220745,"top":0.6560255,"width":0.022273935,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"Toast","depth":23,"bounds":{"left":0.042220745,"top":0.6783719,"width":0.011635638,"height":0.014365523},"role_description":"text"},{"role":"AXRadioButton","text":"Messages","depth":17,"bounds":{"left":0.10206117,"top":0.09177973,"width":0.030585106,"height":0.030327214},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Messages","depth":19,"bounds":{"left":0.111369684,"top":0.10055866,"width":0.01861702,"height":0.012769354},"role_description":"text"},{"role":"AXRadioButton","text":"Add canvas","depth":18,"bounds":{"left":0.13397606,"top":0.09177973,"width":0.033909574,"height":0.030327214},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Add canvas","depth":20,"bounds":{"left":0.14328457,"top":0.10055866,"width":0.021941489,"height":0.012769354},"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":17,"bounds":{"left":0.16921543,"top":0.09177973,"width":0.020944148,"height":0.030327214},"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":19,"bounds":{"left":0.17852394,"top":0.10055866,"width":0.008976064,"height":0.012769354},"role_description":"text"},{"role":"AXPopUpButton","text":"Add and Edit Channel Tabs","depth":17,"bounds":{"left":0.19115691,"top":0.09177973,"width":0.010970744,"height":0.030327214},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Canvas","depth":17,"bounds":{"left":0.096409574,"top":0.0518755,"width":0.015625,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"List","depth":17,"bounds":{"left":0.096409574,"top":0.0518755,"width":0.0076462766,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Folder","depth":17,"bounds":{"left":0.096409574,"top":0.0518755,"width":0.013962766,"height":0.0007980846},"role_description":"text"},{"role":"AXPopUpButton","text":"Jump to date","depth":23,"bounds":{"left":0.15026596,"top":0.12689546,"width":0.025265958,"height":0.022346368},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:36:07 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:36","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"eto go reporta w kiosk","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"image.png","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"","depth":25,"role_description":"text"},{"role":"AXButton","text":"Toggle file","depth":25,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXLink","text":"image.png","depth":27,"role_description":"Unlabelled image","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:36:33 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:36","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"той трябва да се шерне само с Web Service Account 2","depth":25,"role_description":"text"},{"role":"AXLink","text":"Today at 5:40:40 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:40","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"вие нали използвате тази колона","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"groups","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"в момента при новите репорти за да сложите тимовете с които се шерва, а при репортите в киоска няма шерване с екипи и в тази колона за екипите от чиито активитита се филтрират активитита за репортите","depth":25,"role_description":"text"},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:41:02 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:41 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"да","depth":25,"role_description":"text"},{"role":"AXLink","text":"Today at 5:41:09 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:41","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"може ли да се чуем само да вид на прод","depth":25,"role_description":"text"},{"role":"AXLink","text":"Today at 5:41:47 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:41","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"или пак то може и без","depth":25,"role_description":"text"},{"role":"AXLink","text":"Today at 5:41:51 PM","depth":25,"bounds":{"left":0.107380316,"top":0.11572227,"width":0.007978723,"height":0.0071827616},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:41","depth":26,"bounds":{"left":0.107380316,"top":0.11572227,"width":0.007978723,"height":0.0071827616},"role_description":"text"},{"role":"AXStaticText","text":"сега ще видя","depth":25,"bounds":{"left":0.11801862,"top":0.11572227,"width":0.029920213,"height":0.007980846},"role_description":"text"},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"bounds":{"left":0.11801862,"top":0.13168396,"width":0.038896278,"height":0.017557861},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.15658244,"top":0.13328013,"width":0.0029920214,"height":0.014365523},"role_description":"text"},{"role":"AXLink","text":"Today at 5:43:08 PM","depth":24,"bounds":{"left":0.15924202,"top":0.13567439,"width":0.015292553,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:43 PM","depth":25,"bounds":{"left":0.15924202,"top":0.13567439,"width":0.015292553,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"може да се чуем да","depth":25,"bounds":{"left":0.11801862,"top":0.15083799,"width":0.045212764,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.11811652,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.11811652,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.11811652,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.11811652,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.11811652,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.11811652,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.11811652,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.11811652,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:43:09 PM","depth":25,"bounds":{"left":0.107380316,"top":0.17717478,"width":0.007978723,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:43","depth":26,"bounds":{"left":0.107380316,"top":0.17717478,"width":0.007978723,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"само кажи","depth":25,"bounds":{"left":0.11801862,"top":0.17478053,"width":0.024268618,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.15003991,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.15003991,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.15003991,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.15003991,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.15003991,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.15003991,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.15003991,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.15003991,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"bounds":{"left":0.11801862,"top":0.1971269,"width":0.030917553,"height":0.017557861},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.14860372,"top":0.19872306,"width":0.0029920214,"height":0.014365523},"role_description":"text"},{"role":"AXLink","text":"Today at 5:58:04 PM","depth":24,"bounds":{"left":0.1512633,"top":0.20111732,"width":0.015292553,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:58 PM","depth":25,"bounds":{"left":0.1512633,"top":0.20111732,"width":0.015292553,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"ок мисля че го оправих вече, само да го изтествам","depth":25,"bounds":{"left":0.11801862,"top":0.21628092,"width":0.09142287,"height":0.031923383},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.18355946,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.18355946,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.18355946,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.18355946,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.18355946,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.18355946,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.18355946,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.18355946,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:58:17 PM","depth":25,"bounds":{"left":0.107380316,"top":0.2601756,"width":0.007978723,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:58","depth":26,"bounds":{"left":0.107380316,"top":0.2601756,"width":0.007978723,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"за другите неща нещо се обръках","depth":25,"bounds":{"left":0.11801862,"top":0.25778133,"width":0.078125,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.2330407,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.2330407,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.2330407,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.2330407,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.2330407,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.2330407,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.2330407,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.2330407,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:58:20 PM","depth":25,"bounds":{"left":0.107380316,"top":0.28411812,"width":0.007978723,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:58","depth":26,"bounds":{"left":0.107380316,"top":0.28411812,"width":0.007978723,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"Галя иска в колоната SHARED","depth":25,"bounds":{"left":0.11801862,"top":0.28172386,"width":0.068484046,"height":0.014365523},"role_description":"text"},{"role":"AXStaticText","text":"значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като “Shared With”","depth":25,"bounds":{"left":0.11801862,"top":0.29928172,"width":0.10172872,"height":0.049481247},"role_description":"text"},{"role":"AXStaticText","text":"Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна","depth":25,"bounds":{"left":0.11801862,"top":0.3519553,"width":0.102726065,"height":0.049481247},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.25698325,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.25698325,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.25698325,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.25698325,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.25698325,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.25698325,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.25698325,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.25698325,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:59:30 PM","depth":25,"bounds":{"left":0.107380316,"top":0.41340783,"width":0.007978723,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:59","depth":26,"bounds":{"left":0.107380316,"top":0.41340783,"width":0.007978723,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"ако съм creator на template и на result трябва да виждам всички с който е споделено , включително и мен, така ли?","depth":25,"bounds":{"left":0.11801862,"top":0.41101357,"width":0.10305851,"height":0.049481247},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.38627294,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.38627294,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.38627294,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.38627294,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.38627294,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.38627294,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.38627294,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.38627294,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"bounds":{"left":0.11801862,"top":0.46847567,"width":0.038896278,"height":0.017557861},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.15658244,"top":0.47007182,"width":0.0029920214,"height":0.014365523},"role_description":"text"},{"role":"AXLink","text":"Today at 6:00:48 PM","depth":24,"bounds":{"left":0.15924202,"top":0.47246608,"width":0.015292553,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:00 PM","depth":25,"bounds":{"left":0.15924202,"top":0.47246608,"width":0.015292553,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"bez teb","depth":25,"bounds":{"left":0.11801862,"top":0.48762968,"width":0.016289894,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13696809,"top":0.4557063,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14760639,"top":0.4557063,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15824468,"top":0.4557063,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16888298,"top":0.4557063,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17952128,"top":0.4557063,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.19015957,"top":0.4557063,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.20079787,"top":0.4557063,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.21143617,"top":0.4557063,"width":0.010638298,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"bounds":{"left":0.11801862,"top":0.509976,"width":0.030917553,"height":0.017557861},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.14860372,"top":0.51157224,"width":0.0029920214,"height":0.014365523},"role_description":"text"},{"role":"AXLink","text":"Today at 6:00:49 PM","depth":24,"bounds":{"left":0.1512633,"top":0.5139665,"width":0.015292553,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:00 PM","depth":25,"bounds":{"left":0.1512633,"top":0.5139665,"width":0.015292553,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"или да се махне мое име","depth":25,"bounds":{"left":0.11801862,"top":0.5291301,"width":0.057513297,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.4964086,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.4964086,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.4964086,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.4964086,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.4964086,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.4964086,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.4964086,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.4964086,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 6:00:51 PM","depth":25,"bounds":{"left":0.107380316,"top":0.5554669,"width":0.007978723,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:00","depth":26,"bounds":{"left":0.107380316,"top":0.5554669,"width":0.007978723,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"ок","depth":25,"bounds":{"left":0.11801862,"top":0.55307263,"width":0.005319149,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.528332,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.528332,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.528332,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.528332,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.528332,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.528332,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.528332,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.528332,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"bounds":{"left":0.11801862,"top":0.575419,"width":0.038896278,"height":0.017557861},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"bounds":{"left":0.15658244,"top":0.57701516,"width":0.0029920214,"height":0.014365523},"role_description":"text"},{"role":"AXLink","text":"Today at 6:00:56 PM","depth":24,"bounds":{"left":0.15924202,"top":0.5794094,"width":0.015292553,"height":0.011173184},"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:00 PM","depth":25,"bounds":{"left":0.15924202,"top":0.5794094,"width":0.015292553,"height":0.011173184},"role_description":"text"},{"role":"AXStaticText","text":"да","depth":25,"bounds":{"left":0.11801862,"top":0.594573,"width":0.0056515955,"height":0.014365523},"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"bounds":{"left":0.13730054,"top":0.56185156,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"bounds":{"left":0.14793883,"top":0.56185156,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"bounds":{"left":0.15857713,"top":0.56185156,"width":0.010638298,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"bounds":{"left":0.16921543,"top":0.56185156,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"bounds":{"left":0.17985372,"top":0.56185156,"width":0.010638298,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"bounds":{"left":0.22340426,"top":0.56185156,"width":0.0003324468,"height":0.025538707},"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"bounds":{"left":0.22340426,"top":0.56185156,"width":0.0003324468,"height":0.025538707},"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"bounds":{"left":0.22340426,"top":0.56185156,"width":0.0003324468,"height":0.025538707},"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"","depth":23,"bounds":{"left":0.10372341,"top":0.6272945,"width":0.118351065,"height":0.030327214},"value":"","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Todor Stamatov, Direct Message, 1 of 15 suggestions","depth":11,"bounds":{"left":0.0,"top":0.7126895,"width":0.026263298,"height":0.0007980846},"role_description":"text"},{"role":"AXStaticText","text":"Channel","depth":11,"bounds":{"left":0.0,"top":0.7126895,"width":0.017287234,"height":0.0007980846},"role_description":"text"}]...
|
7610506607449357182
|
-1569190189884602040
|
idle
|
hybrid
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Aneliya Angelova
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Today at 5:36:07 PM
5:36
eto go reporta w kiosk
image.png
Toggle file
image.png
Today at 5:36:33 PM
5:36
той трябва да се шерне само с Web Service Account 2
Today at 5:40:40 PM
5:40
вие нали използвате тази колона
groups
в момента при новите репорти за да сложите тимовете с които се шерва, а при репортите в киоска няма шерване с екипи и в тази колона за екипите от чиито активитита се филтрират активитита за репортите
Lukas Kovalik
Today at 5:41:02 PM
5:41 PM
да
Today at 5:41:09 PM
5:41
може ли да се чуем само да вид на прод
Today at 5:41:47 PM
5:41
или пак то може и без
Today at 5:41:51 PM
5:41
сега ще видя
Aneliya Angelova
Today at 5:43:08 PM
5:43 PM
може да се чуем да
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:43:09 PM
5:43
само кажи
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 5:58:04 PM
5:58 PM
ок мисля че го оправих вече, само да го изтествам
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:58:17 PM
5:58
за другите неща нещо се обръках
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:58:20 PM
5:58
Галя иска в колоната SHARED
значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като “Shared With”
Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:59:30 PM
5:59
ако съм creator на template и на result трябва да виждам всички с който е споделено , включително и мен, така ли?
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 6:00:48 PM
6:00 PM
bez teb
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:00:49 PM
6:00 PM
или да се махне мое име
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:00:51 PM
6:00
ок
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 6:00:56 PM
6:00 PM
да
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Todor Stamatov, Direct Message, 1 of 15 suggestions
Channel
You are currently impersonating Aneliya Angelova €)© Clear all18888SHAREDEõ3 Ask Jiminny repo...
|
NULL
|
|
67523
|
1520
|
0
|
2026-04-21T15:46:26.948880+00:00
|
/Users/lukas/.screenpipe/data/data/2026-04-21/1776 /Users/lukas/.screenpipe/data/data/2026-04-21/1776786386948_m1.jpg...
|
Slack
|
Aneliya Angelova (DM) - Jiminny Inc - 1 new item - Aneliya Angelova (DM) - Jiminny Inc - 1 new item - Slack...
|
1
|
NULL
|
monitor_1
|
NULL
|
NULL
|
NULL
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Aneliya Angelova
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Today at 5:36:07 PM
5:36
eto go reporta w kiosk
image.png
Toggle file
image.png
Today at 5:36:33 PM
5:36
той трябва да се шерне само с Web Service Account 2
Today at 5:40:40 PM
5:40
вие нали използвате тази колона
groups
в момента при новите репорти за да сложите тимовете с които се шерва, а при репортите в киоска няма шерване с екипи и в тази колона за екипите от чиито активитита се филтрират активитита за репортите
Lukas Kovalik
Today at 5:41:02 PM
5:41 PM
да
Today at 5:41:09 PM
5:41
може ли да се чуем само да вид на прод
Today at 5:41:47 PM
5:41
или пак то може и без
Today at 5:41:51 PM
5:41
сега ще видя
Aneliya Angelova
Today at 5:43:08 PM
5:43 PM
може да се чуем да
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:43:09 PM
5:43
само кажи
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 5:58:04 PM
5:58 PM
ок мисля че го оправих вече, само да го изтествам
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:58:17 PM
5:58
за другите неща нещо се обръках
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:58:20 PM
5:58
Галя иска в колоната SHARED
значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като “Shared With”
Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:59:30 PM
5:59
ако съм creator на template и на result трябва да виждам всички с който е споделено , включително и мен, така ли?
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 6:00:48 PM
6:00 PM
bez teb
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:00:49 PM
6:00 PM
или да се махне мое име
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:00:51 PM
6:00
ок
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 6:00:56 PM
6:00 PM
да
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Todor Stamatov, Direct Message, 1 of 15 suggestions
Channel...
|
[{"role":"AXPopUpButton","text [{"role":"AXPopUpButton","text":"Switch workspaces… (Jiminny Inc) Has new messages","depth":14,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXRadioButton","text":"Home","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Home","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"DMs","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"DMs","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"Activity","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Activity","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"Later","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Later","depth":16,"role_description":"text"},{"role":"AXRadioButton","text":"More…","depth":14,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"More","depth":16,"role_description":"text"},{"role":"AXStaticText","text":"Unreads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Threads","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Huddles","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Drafts & sent","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"Directories","depth":21,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-x-integration-app","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-inner-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"ai-chapter","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"alerts","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"backend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"c-learning-people","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"confusion-clinic","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"curiosity_lab","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"engineering","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"frontend","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"general","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"infra-changes","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"jiminny-bg","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-copilot-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"people-with-zoom-phone-licences","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-team","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"platform-tickets","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"product_launches","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"random","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"releases","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"support","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"thank-yous","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"the_people_of_jiminny","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":",","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Steliyan Georgiev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Aneliya Angelova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Mario Georgiev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Yankov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Todor Stamatov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Gabriela Dureva","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Petko Kashinski","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Vasil Vasilev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Nikolov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Galya Dimitrova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Stefka Stoyanova","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tomov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Stoyan Tanev","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Nikolay Ivanov","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Ves","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Jira Cloud","depth":23,"role_description":"text"},{"role":"AXStaticText","text":"Toast","depth":23,"role_description":"text"},{"role":"AXRadioButton","text":"Messages","depth":17,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":true,"is_expanded":false},{"role":"AXStaticText","text":"Messages","depth":19,"role_description":"text"},{"role":"AXRadioButton","text":"Add canvas","depth":18,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Add canvas","depth":20,"role_description":"text"},{"role":"AXRadioButton","text":"Files","depth":17,"role_description":"tab","subrole":"AXTabButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Files","depth":19,"role_description":"text"},{"role":"AXPopUpButton","text":"Add and Edit Channel Tabs","depth":17,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Canvas","depth":17,"role_description":"text"},{"role":"AXStaticText","text":"List","depth":17,"role_description":"text"},{"role":"AXStaticText","text":"Folder","depth":17,"role_description":"text"},{"role":"AXPopUpButton","text":"Jump to date","depth":23,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:36:07 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:36","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"eto go reporta w kiosk","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"image.png","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"","depth":25,"role_description":"text"},{"role":"AXButton","text":"Toggle file","depth":25,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":true},{"role":"AXLink","text":"image.png","depth":27,"role_description":"Unlabelled image","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:36:33 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:36","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"той трябва да се шерне само с Web Service Account 2","depth":25,"role_description":"text"},{"role":"AXLink","text":"Today at 5:40:40 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:40","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"вие нали използвате тази колона","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"groups","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"в момента при новите репорти за да сложите тимовете с които се шерва, а при репортите в киоска няма шерване с екипи и в тази колона за екипите от чиито активитита се филтрират активитита за репортите","depth":25,"role_description":"text"},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:41:02 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:41 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"да","depth":25,"role_description":"text"},{"role":"AXLink","text":"Today at 5:41:09 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:41","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"може ли да се чуем само да вид на прод","depth":25,"role_description":"text"},{"role":"AXLink","text":"Today at 5:41:47 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:41","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"или пак то може и без","depth":25,"role_description":"text"},{"role":"AXLink","text":"Today at 5:41:51 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:41","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"сега ще видя","depth":25,"role_description":"text"},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:43:08 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:43 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"може да се чуем да","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:43:09 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:43","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"само кажи","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 5:58:04 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:58 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"ок мисля че го оправих вече, само да го изтествам","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:58:17 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:58","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"за другите неща нещо се обръках","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:58:20 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:58","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"Галя иска в колоната SHARED","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като “Shared With”","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 5:59:30 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"5:59","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"ако съм creator на template и на result трябва да виждам всички с който е споделено , включително и мен, така ли?","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:00:48 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:00 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"bez teb","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Lukas Kovalik","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:00:49 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:00 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"или да се махне мое име","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXLink","text":"Today at 6:00:51 PM","depth":25,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:00","depth":26,"role_description":"text"},{"role":"AXStaticText","text":"ок","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Aneliya Angelova","depth":24,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"","depth":24,"role_description":"text"},{"role":"AXLink","text":"Today at 6:00:56 PM","depth":24,"role_description":"link","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"6:00 PM","depth":25,"role_description":"text"},{"role":"AXStaticText","text":"да","depth":25,"role_description":"text"},{"role":"AXCheckBox","text":"React with white_check_mark","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with eyes","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"React with raised_hands","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Add reaction…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Reply in thread","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXButton","text":"Forward message…","depth":26,"role_description":"button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXCheckBox","text":"Save for later","depth":26,"role_description":"toggle button","subrole":"AXToggleButton","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXPopUpButton","text":"More actions","depth":26,"role_description":"pop-up button","is_enabled":true,"is_focused":false,"is_selected":false,"is_expanded":false},{"role":"AXTextArea","text":"","depth":23,"value":"","role_description":"text entry area","is_enabled":true,"is_focused":true,"is_selected":false,"is_expanded":false},{"role":"AXStaticText","text":"Todor Stamatov, Direct Message, 1 of 15 suggestions","depth":11,"role_description":"text"},{"role":"AXStaticText","text":"Channel","depth":11,"role_description":"text"}]...
|
7610506607449357182
|
-1569190189884602040
|
idle
|
hybrid
|
NULL
|
Switch workspaces… (Jiminny Inc) Has new messages
Switch workspaces… (Jiminny Inc) Has new messages
Home
Home
DMs
DMs
Activity
Activity
Files
Files
Later
Later
More…
More
Unreads
Threads
Huddles
Drafts & sent
Directories
jiminny-x-integration-app
platform-inner-team
ai-chapter
alerts
backend
c-learning-people
confusion-clinic
curiosity_lab
engineering
frontend
general
infra-changes
jiminny-bg
people-with-copilot-licences
people-with-zoom-phone-licences
platform-team
platform-tickets
product_launches
random
releases
support
thank-yous
the_people_of_jiminny
Aneliya Angelova
,
Nikolay Yankov
,
Steliyan Georgiev
Aneliya Angelova
Mario Georgiev
Nikolay Yankov
Todor Stamatov
Gabriela Dureva
Petko Kashinski
Vasil Vasilev
Nikolay Nikolov
Galya Dimitrova
Stefka Stoyanova
Stoyan Tomov
Stoyan Tanev
Nikolay Ivanov
Ves
Jira Cloud
Toast
Messages
Messages
Add canvas
Add canvas
Files
Files
Add and Edit Channel Tabs
Canvas
List
Folder
Jump to date
Today at 5:36:07 PM
5:36
eto go reporta w kiosk
image.png
Toggle file
image.png
Today at 5:36:33 PM
5:36
той трябва да се шерне само с Web Service Account 2
Today at 5:40:40 PM
5:40
вие нали използвате тази колона
groups
в момента при новите репорти за да сложите тимовете с които се шерва, а при репортите в киоска няма шерване с екипи и в тази колона за екипите от чиито активитита се филтрират активитита за репортите
Lukas Kovalik
Today at 5:41:02 PM
5:41 PM
да
Today at 5:41:09 PM
5:41
може ли да се чуем само да вид на прод
Today at 5:41:47 PM
5:41
или пак то може и без
Today at 5:41:51 PM
5:41
сега ще видя
Aneliya Angelova
Today at 5:43:08 PM
5:43 PM
може да се чуем да
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:43:09 PM
5:43
само кажи
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 5:58:04 PM
5:58 PM
ок мисля че го оправих вече, само да го изтествам
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:58:17 PM
5:58
за другите неща нещо се обръках
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:58:20 PM
5:58
Галя иска в колоната SHARED
значи създателя на темплейта на АИ Репортс страницата вижда винаги и себе си като “Shared With”
Галя иска да се махне creator-a ot Shared With i ако не е шернал с никого, то колоната ще е празна
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 5:59:30 PM
5:59
ако съм creator на template и на result трябва да виждам всички с който е споделено , включително и мен, така ли?
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 6:00:48 PM
6:00 PM
bez teb
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Lukas Kovalik
Today at 6:00:49 PM
6:00 PM
или да се махне мое име
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Today at 6:00:51 PM
6:00
ок
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Aneliya Angelova
Today at 6:00:56 PM
6:00 PM
да
React with white_check_mark
React with eyes
React with raised_hands
Add reaction…
Reply in thread
Forward message…
Save for later
More actions
Todor Stamatov, Direct Message, 1 of 15 suggestions
Channel
iTerm2ShellEditViewSessionScriptsProfilesWindowHelp100% <78-zsh* Build full day activity...• *4|DOCKER-zshworker-nudges:worker-nudges_00: started₴2-zshscreenpipe*What's next:Try Docker Debug for seamless, persistent debugging tools in any container or image + docker debug docker_lamp_1Learn moreat [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-18909-automated-reports-ask-jiminny) $ csfixdockerexec -it docker_lamp_1./vendor/bin/php-cs-fixer fix--config=.php-cs-fixer.dist.php -v --using-cache=no --diffPHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.PHPruntime:8.3.30Running analysis on 7 cores with 10 files per process.Parallel runner is an experimental feature and may be unstable, use it at your own risk. Feedback highly appreciated!Loadedconfigdefault from-php-cs-fixer.dist.php".5609/5609100%• ₴5-zsh86Tue 21 Apr 18:46:27APP (-zsh)181+Fixed 0 of 5609 files in 36.627 seconds, 60.00 MB memory usedWhat's next:Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-18909-automated-reports-ask-jiminny) $ ||...
|
NULL
|