|
root@docker_lamp_1:/home/jiminny# php artisan jimi root@docker_lamp_1:/home/jiminny# php artisan jiminny:debug
Now: 2026-04-22 12:21:40
Now: 0
From old: 2026-04-15 00:00:00
To old: 2026-04-21 23:59:59
From new: 2026-04-12 00:00:00
To new: 2026-04-18 23:59:59
root@docker_lamp_1:/home/jiminny# php artisan jiminny:debug
Now: 2026-04-22 12:22:16
Now: 0
From old: 2026-03-22 00:00:00
To old: 2026-04-21 23:59:59
From new: 2026-03-01 00:00:00
To new: 2026-03-31 23:59:59
root@docker_lamp_1:/home/jiminny# php artisan jiminny:debug
Now: 2026-04-22 12:22:32
Now: 0
From old: 2026-01-22 00:00:00
To old: 2026-04-21 23:59:59
From new: 2026-01-01 00:00:00
To new: 2026-03-31 23:59:59
root@docker_lamp_1:/home/jiminny#
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug 007d5da3af66
Learn more at [URL_WITH_CREDENTIALS] php artisan jiminny:debug
DOCKER
Close Tab
DEV (docker)
Close Tab
APP (-zsh)
Close Tab
screenpipe"
Close Tab
-zsh
Close Tab
-zsh
Close Tab
⌥⌘1
DEV (docker)...
|
iTerm2
|
DEV (docker)
|
NULL
|
77259
|
|
Project: faVsco.js, menu
JY-20738-debug-AJ-trackin Project: faVsco.js, menu
JY-20738-debug-AJ-tracking-UP, menu
Start Listening for PHP Debug Connections
ReportControllerTest
Run 'ReportControllerTest'
Debug 'ReportControllerTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
3
115
4
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use InvalidArgumentException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateAskJiminnyReportJob;
use Jiminny\Jobs\AutomatedReports\SendReportMailJob;
use Jiminny\Jobs\JobDispatcherInterface;
use Jiminny\Models\Activity;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Services\Activity\CrmOwnerResolver;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\UserPilot\UserPilotClient;
/**
* Class JiminnyDebugCommand
*
* @package Jiminny\Console\Commands
*/
class JiminnyDebugCommand extends Command
{
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';
protected $signature = 'jiminny:debug';
public function handle(
JobDispatcherInterface $jobDispatcher,
AutomatedReportsService $automatedReportsService,
AutomatedReportsRepository $automatedReportsRepository,
UserPilotClient $userPilotClient
): void {
$user = User::find(143);
// $count = $automatedReportsRepository->countUserReports($user);
// $this->info("Count: {$count}");
// $count = $automatedReportsRepository->countAllUserReports($user);
// $this->info("All count: {$count}");
$payload = [
'report_type' => 'ask_jiminny',
'frequency' => 'weekly',
];
$userPilotClient->track($user, 'ask-jiminny-report-generated', $payload);
exit(1);
$now = Carbon::now()->subDay(1);
$this->info("Now: {$now->toDateTimeString()}");
$weekStart = Carbon::getWeekStartsAt();
$this->info("Now: {$weekStart}");
// $from = $now->copy()->previousWeekday()->startOfDay();
// $to = $now->copy()->previousWeekday()->endOfDay();
// $fromOld = $now->copy()->subWeeks(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subWeek()->startOfWeek();
// $toNew = $now->copy()->subWeek()->endOfWeek();
// $fromOld = $now->copy()->subMonths(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
// $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
$fromOld = $now->copy()->subMonths(3)->startOfDay();
$toOld = $now->copy()->subDay()->endOfDay();
$fromNew = $now->copy()->subQuarterNoOverflow()->startOfQuarter();
$toNew = $now->copy()->subQuarterNoOverflow()->endOfQuarter();
$this->info("From old: {$fromOld->toDateTimeString()}");
$this->info("To old: {$toOld->toDateTimeString()}");
$this->info("From new: {$fromNew->toDateTimeString()}");
$this->info("To new: {$toNew->toDateTimeString()}");
exit(1);
$report = AutomatedReport::find(71);
$job = new RequestGenerateAskJiminnyReportJob($report->getUuid());
$jobDispatcher->dispatch($job);
exit(1);
// $this->formatDate($jobDispatcher);
// $this->sendMail($jobDispatcher, $automatedReportsService);
// $this->crmService();
$this->getPayload($automatedReportsService);
exit(1);
}
private function crmService()
{
$activity = Activity::find(418141);
$team = Team::find(19);
$config = $team->getCrmConfiguration();
$crmResolver = app(CrmOwnerResolver::class, [
'team' => $team,
'integrationAdmin' => $team->getOwner(),
'providerSlug' => $config->getProviderName(),
]);
$crmService = $crmResolver->prepareCrmService();
$crmService->createTranscriptNotes($activity);
}
private function sendMail(JobDispatcherInterface $jobDispatcher, AutomatedReportsService $automatedReportsService)
{
$reportUuid = '';
// $report = $automatedReportsService->getReportResult($reportUuid);
$report = AutomatedReportResult::find(275);
$validRecipients = $automatedReportsService->getValidRecipientUsers(
$report->getReport(),
includeJiminny: true,
);
$recipient = $validRecipients[0];
$fileName = $automatedReportsService->getReportFileName($report);
$typeName = $report->getReport()->getCustomName()
?? $automatedReportsService->getReportTypeName($report);
$teamsName = $automatedReportsService->getReportTeamsName($report);
$periodName = $automatedReportsService->getReportPeriodName($report);
$s3Path = $automatedReportsService->getMediaPath($report);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$fileName ' . PHP_EOL . print_r($fileName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$typeName ' . PHP_EOL . print_r($typeName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$teamsName ' . PHP_EOL . print_r($teamsName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$periodName ' . PHP_EOL . print_r($periodName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$s3Path ' . PHP_EOL . print_r($s3Path, true));
$jobDispatcher->dispatch(
new SendReportMailJob(
reportUuid: $report->getUuid(),
s3Path: $s3Path,
recipientEmail: $recipient['email'],
recipientName: $recipient['name'] ?? null,
fileName: $fileName,
typeName: $typeName,
teamsName: $teamsName,
periodName: $periodName,
isAskJiminny: true,
)
);
exit(1);
}
private function formatDate(JobDispatcherInterface $jobDispatcher): void
{
$customName = 'Custom report name';
// $frequency = self::FREQUENCY_DAILY;
// $frequency = self::FREQUENCY_WEEKLY;
$frequency = self::FREQUENCY_MONTHLY;
// $frequency = self::FREQUENCY_QUARTERLY;
// $frequency = self::FREQUENCY_ONE_OFF;
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
$periodName = $this->formatReportPeriodName($frequency, $from, $to);
$filenameSuffix = null;
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
$result = $this->sanitizeFileName("{$customName} - {$periodName}");
}
$this->info($result);
}
public function calculateFromAndToDatePeriod(
string $frequency,
?Carbon $fromDate = null,
?Carbon $toDate = null
): array {
if ($frequency === self::FREQUENCY_ONE_OFF) {
return [
'fromDate' => $fromDate,
'toDate' => $toDate,
];
}
$now = Carbon::now();
return match ($frequency) {
self::FREQUENCY_DAILY => [
'fromDate' => $now->copy()->subDay()->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_WEEKLY => [
'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_MONTHLY => [
'fromDate' => $now->copy()->subMonths(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_QUARTERLY => [
'fromDate' => $now->copy()->subMonths(3)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
default => throw new InvalidArgumentException("Unsupported frequency: {$frequency}"),
};
}
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 sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
private function getPayload(AutomatedReportsService $automatedReportsService)
{
$reportResult = AutomatedReportResult::find(269);
$automatedReport = $reportResult->getReport();
$activityIds = [1,2,3];
$payload = $automatedReportsService->getAskJiminnyGenerateReportPayload(
automatedReport: $automatedReport,
reportResult: $reportResult,
activityIds: $activityIds,
);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$payload ' . PHP_EOL . print_r($payload, true));
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
Editor for custom.log
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
PhpStorm
|
faVsco.js – custom.log
|
NULL
|
77260
|
|
root@docker_lamp_1:/home/jiminny# php artisan jimi root@docker_lamp_1:/home/jiminny# php artisan jiminny:debug
Now: 2026-04-22 12:21:40
Now: 0
From old: 2026-04-15 00:00:00
To old: 2026-04-21 23:59:59
From new: 2026-04-12 00:00:00
To new: 2026-04-18 23:59:59
root@docker_lamp_1:/home/jiminny# php artisan jiminny:debug
Now: 2026-04-22 12:22:16
Now: 0
From old: 2026-03-22 00:00:00
To old: 2026-04-21 23:59:59
From new: 2026-03-01 00:00:00
To new: 2026-03-31 23:59:59
root@docker_lamp_1:/home/jiminny# php artisan jiminny:debug
Now: 2026-04-22 12:22:32
Now: 0
From old: 2026-01-22 00:00:00
To old: 2026-04-21 23:59:59
From new: 2026-01-01 00:00:00
To new: 2026-03-31 23:59:59
root@docker_lamp_1:/home/jiminny#
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug 007d5da3af66
Learn more at [URL_WITH_CREDENTIALS] php artisan jiminny:debug
root@docker_lamp_1:/home/jiminny#
DOCKER
Close Tab
DEV (docker)
Close Tab
APP (-zsh)
Close Tab
screenpipe"
Close Tab
-zsh
Close Tab
-zsh
Close Tab
⌥⌘1
DEV (docker)...
|
iTerm2
|
DEV (docker)
|
NULL
|
77261
|
|
Project: faVsco.js, menu
JY-20738-debug-AJ-trackin Project: faVsco.js, menu
JY-20738-debug-AJ-tracking-UP, menu
Start Listening for PHP Debug Connections
ReportControllerTest
Run 'ReportControllerTest'
Debug 'ReportControllerTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
3
115
4
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use InvalidArgumentException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateAskJiminnyReportJob;
use Jiminny\Jobs\AutomatedReports\SendReportMailJob;
use Jiminny\Jobs\JobDispatcherInterface;
use Jiminny\Models\Activity;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Services\Activity\CrmOwnerResolver;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\UserPilot\UserPilotClient;
/**
* Class JiminnyDebugCommand
*
* @package Jiminny\Console\Commands
*/
class JiminnyDebugCommand extends Command
{
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';
protected $signature = 'jiminny:debug';
public function handle(
JobDispatcherInterface $jobDispatcher,
AutomatedReportsService $automatedReportsService,
AutomatedReportsRepository $automatedReportsRepository,
UserPilotClient $userPilotClient
): void {
$user = User::find(143);
// $count = $automatedReportsRepository->countUserReports($user);
// $this->info("Count: {$count}");
// $count = $automatedReportsRepository->countAllUserReports($user);
// $this->info("All count: {$count}");
$payload = [
'report_type' => 'ask_jiminny',
'frequency' => 'weekly',
];
$userPilotClient->track($user, 'ask-jiminny-report-generated', $payload);
exit(1);
$now = Carbon::now()->subDay(1);
$this->info("Now: {$now->toDateTimeString()}");
$weekStart = Carbon::getWeekStartsAt();
$this->info("Now: {$weekStart}");
// $from = $now->copy()->previousWeekday()->startOfDay();
// $to = $now->copy()->previousWeekday()->endOfDay();
// $fromOld = $now->copy()->subWeeks(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subWeek()->startOfWeek();
// $toNew = $now->copy()->subWeek()->endOfWeek();
// $fromOld = $now->copy()->subMonths(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
// $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
$fromOld = $now->copy()->subMonths(3)->startOfDay();
$toOld = $now->copy()->subDay()->endOfDay();
$fromNew = $now->copy()->subQuarterNoOverflow()->startOfQuarter();
$toNew = $now->copy()->subQuarterNoOverflow()->endOfQuarter();
$this->info("From old: {$fromOld->toDateTimeString()}");
$this->info("To old: {$toOld->toDateTimeString()}");
$this->info("From new: {$fromNew->toDateTimeString()}");
$this->info("To new: {$toNew->toDateTimeString()}");
exit(1);
$report = AutomatedReport::find(71);
$job = new RequestGenerateAskJiminnyReportJob($report->getUuid());
$jobDispatcher->dispatch($job);
exit(1);
// $this->formatDate($jobDispatcher);
// $this->sendMail($jobDispatcher, $automatedReportsService);
// $this->crmService();
$this->getPayload($automatedReportsService);
exit(1);
}
private function crmService()
{
$activity = Activity::find(418141);
$team = Team::find(19);
$config = $team->getCrmConfiguration();
$crmResolver = app(CrmOwnerResolver::class, [
'team' => $team,
'integrationAdmin' => $team->getOwner(),
'providerSlug' => $config->getProviderName(),
]);
$crmService = $crmResolver->prepareCrmService();
$crmService->createTranscriptNotes($activity);
}
private function sendMail(JobDispatcherInterface $jobDispatcher, AutomatedReportsService $automatedReportsService)
{
$reportUuid = '';
// $report = $automatedReportsService->getReportResult($reportUuid);
$report = AutomatedReportResult::find(275);
$validRecipients = $automatedReportsService->getValidRecipientUsers(
$report->getReport(),
includeJiminny: true,
);
$recipient = $validRecipients[0];
$fileName = $automatedReportsService->getReportFileName($report);
$typeName = $report->getReport()->getCustomName()
?? $automatedReportsService->getReportTypeName($report);
$teamsName = $automatedReportsService->getReportTeamsName($report);
$periodName = $automatedReportsService->getReportPeriodName($report);
$s3Path = $automatedReportsService->getMediaPath($report);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$fileName ' . PHP_EOL . print_r($fileName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$typeName ' . PHP_EOL . print_r($typeName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$teamsName ' . PHP_EOL . print_r($teamsName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$periodName ' . PHP_EOL . print_r($periodName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$s3Path ' . PHP_EOL . print_r($s3Path, true));
$jobDispatcher->dispatch(
new SendReportMailJob(
reportUuid: $report->getUuid(),
s3Path: $s3Path,
recipientEmail: $recipient['email'],
recipientName: $recipient['name'] ?? null,
fileName: $fileName,
typeName: $typeName,
teamsName: $teamsName,
periodName: $periodName,
isAskJiminny: true,
)
);
exit(1);
}
private function formatDate(JobDispatcherInterface $jobDispatcher): void
{
$customName = 'Custom report name';
// $frequency = self::FREQUENCY_DAILY;
// $frequency = self::FREQUENCY_WEEKLY;
$frequency = self::FREQUENCY_MONTHLY;
// $frequency = self::FREQUENCY_QUARTERLY;
// $frequency = self::FREQUENCY_ONE_OFF;
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
$periodName = $this->formatReportPeriodName($frequency, $from, $to);
$filenameSuffix = null;
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
$result = $this->sanitizeFileName("{$customName} - {$periodName}");
}
$this->info($result);
}
public function calculateFromAndToDatePeriod(
string $frequency,
?Carbon $fromDate = null,
?Carbon $toDate = null
): array {
if ($frequency === self::FREQUENCY_ONE_OFF) {
return [
'fromDate' => $fromDate,
'toDate' => $toDate,
];
}
$now = Carbon::now();
return match ($frequency) {
self::FREQUENCY_DAILY => [
'fromDate' => $now->copy()->subDay()->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_WEEKLY => [
'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_MONTHLY => [
'fromDate' => $now->copy()->subMonths(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_QUARTERLY => [
'fromDate' => $now->copy()->subMonths(3)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
default => throw new InvalidArgumentException("Unsupported frequency: {$frequency}"),
};
}
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 sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
private function getPayload(AutomatedReportsService $automatedReportsService)
{
$reportResult = AutomatedReportResult::find(269);
$automatedReport = $reportResult->getReport();
$activityIds = [1,2,3];
$payload = $automatedReportsService->getAskJiminnyGenerateReportPayload(
automatedReport: $automatedReport,
reportResult: $reportResult,
activityIds: $activityIds,
);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$payload ' . PHP_EOL . print_r($payload, true));
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
[2026-04-24 09:01:22] local.INFO: [HubSpot Journal Polling] Getting offset from database {"offset":"","jiminny_team_id":1} {"correlation_id":"bc159143-0c7f-48c9-a899-0e489969ecbf","trace_id":"06431955-f079-450f-b3ae-55daac9f2e00"}
[2026-04-24 09:01:22] local.INFO: [HubSpot Journal API] Fetching latest journal entry {"url":"https://api.hubapi.com/webhooks/v4/journal/latest"} {"correlation_id":"bc159143-0c7f-48c9-a899-0e489969ecbf","trace_id":"06431955-f079-450f-b3ae-55daac9f2e00"}
[2026-04-24 09:01:22] local.INFO: [HubSpot Journal Polling] No data {"correlation_id":"bc159143-0c7f-48c9-a899-0e489969ecbf","trace_id":"06431955-f079-450f-b3ae-55daac9f2e00"}
[2026-04-24 09:01:22] local.WARNING: [HubSpot Journal Polling] Maximum empty results reached, stopping {"empty_results":5,"max_empty_results":5} {"correlation_id":"bc159143-0c7f-48c9-a899-0e489969ecbf","trace_id":"06431955-f079-450f-b3ae-55daac9f2e00"}
[2026-04-24 09:01:22] local.WARNING: [HubSpot Journal Polling] Maximum empty results reached, stopping {"empty_results":5,"max_empty_results":5} {"correlation_id":"bc159143-0c7f-48c9-a899-0e489969ecbf","trace_id":"06431955-f079-450f-b3ae-55daac9f2e00"}
[2026-04-24 09:01:22] local.INFO: [HubSpot Journal Polling] Service ending {"runtime_seconds":56,"total_cycles":5,"files_downloaded":0,"empty_files":0,"other_portal_skipped":0,"total_events":0,"events_per_file":0,"avg_api_ms":266.4,"avg_download_ms":0.0,"avg_transform_ms":0.0,"avg_process_ms":0.0,"peak_memory_mb":99.72} {"correlation_id":"bc159143-0c7f-48c9-a899-0e489969ecbf","trace_id":"06431955-f079-450f-b3ae-55daac9f2e00"}
[2026-04-24 09:01:22] local.INFO: [HubSpot Journal Polling] Released polling lock {"correlation_id":"bc159143-0c7f-48c9-a899-0e489969ecbf","trace_id":"06431955-f079-450f-b3ae-55daac9f2e00"}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
PhpStorm
|
faVsco.js – laravel.log
|
NULL
|
77262
|
|
Project: faVsco.js, menu
JY-20738-debug-AJ-trackin Project: faVsco.js, menu
JY-20738-debug-AJ-tracking-UP, menu
Start Listening for PHP Debug Connections
ReportControllerTest
Run 'ReportControllerTest'
Debug 'ReportControllerTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
3
115
4
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use InvalidArgumentException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateAskJiminnyReportJob;
use Jiminny\Jobs\AutomatedReports\SendReportMailJob;
use Jiminny\Jobs\JobDispatcherInterface;
use Jiminny\Models\Activity;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Services\Activity\CrmOwnerResolver;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\UserPilot\UserPilotClient;
/**
* Class JiminnyDebugCommand
*
* @package Jiminny\Console\Commands
*/
class JiminnyDebugCommand extends Command
{
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';
protected $signature = 'jiminny:debug';
public function handle(
JobDispatcherInterface $jobDispatcher,
AutomatedReportsService $automatedReportsService,
AutomatedReportsRepository $automatedReportsRepository,
UserPilotClient $userPilotClient
): void {
$user = User::find(143);
// $count = $automatedReportsRepository->countUserReports($user);
// $this->info("Count: {$count}");
// $count = $automatedReportsRepository->countAllUserReports($user);
// $this->info("All count: {$count}");
$payload = [
'report_type' => 'ask_jiminny',
'frequency' => 'weekly',
];
$userPilotClient->track($user, 'ask-jiminny-report-generated', $payload);
exit(1);
$now = Carbon::now()->subDay(1);
$this->info("Now: {$now->toDateTimeString()}");
$weekStart = Carbon::getWeekStartsAt();
$this->info("Now: {$weekStart}");
// $from = $now->copy()->previousWeekday()->startOfDay();
// $to = $now->copy()->previousWeekday()->endOfDay();
// $fromOld = $now->copy()->subWeeks(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subWeek()->startOfWeek();
// $toNew = $now->copy()->subWeek()->endOfWeek();
// $fromOld = $now->copy()->subMonths(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
// $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
$fromOld = $now->copy()->subMonths(3)->startOfDay();
$toOld = $now->copy()->subDay()->endOfDay();
$fromNew = $now->copy()->subQuarterNoOverflow()->startOfQuarter();
$toNew = $now->copy()->subQuarterNoOverflow()->endOfQuarter();
$this->info("From old: {$fromOld->toDateTimeString()}");
$this->info("To old: {$toOld->toDateTimeString()}");
$this->info("From new: {$fromNew->toDateTimeString()}");
$this->info("To new: {$toNew->toDateTimeString()}");
exit(1);
$report = AutomatedReport::find(71);
$job = new RequestGenerateAskJiminnyReportJob($report->getUuid());
$jobDispatcher->dispatch($job);
exit(1);
// $this->formatDate($jobDispatcher);
// $this->sendMail($jobDispatcher, $automatedReportsService);
// $this->crmService();
$this->getPayload($automatedReportsService);
exit(1);
}
private function crmService()
{
$activity = Activity::find(418141);
$team = Team::find(19);
$config = $team->getCrmConfiguration();
$crmResolver = app(CrmOwnerResolver::class, [
'team' => $team,
'integrationAdmin' => $team->getOwner(),
'providerSlug' => $config->getProviderName(),
]);
$crmService = $crmResolver->prepareCrmService();
$crmService->createTranscriptNotes($activity);
}
private function sendMail(JobDispatcherInterface $jobDispatcher, AutomatedReportsService $automatedReportsService)
{
$reportUuid = '';
// $report = $automatedReportsService->getReportResult($reportUuid);
$report = AutomatedReportResult::find(275);
$validRecipients = $automatedReportsService->getValidRecipientUsers(
$report->getReport(),
includeJiminny: true,
);
$recipient = $validRecipients[0];
$fileName = $automatedReportsService->getReportFileName($report);
$typeName = $report->getReport()->getCustomName()
?? $automatedReportsService->getReportTypeName($report);
$teamsName = $automatedReportsService->getReportTeamsName($report);
$periodName = $automatedReportsService->getReportPeriodName($report);
$s3Path = $automatedReportsService->getMediaPath($report);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$fileName ' . PHP_EOL . print_r($fileName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$typeName ' . PHP_EOL . print_r($typeName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$teamsName ' . PHP_EOL . print_r($teamsName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$periodName ' . PHP_EOL . print_r($periodName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$s3Path ' . PHP_EOL . print_r($s3Path, true));
$jobDispatcher->dispatch(
new SendReportMailJob(
reportUuid: $report->getUuid(),
s3Path: $s3Path,
recipientEmail: $recipient['email'],
recipientName: $recipient['name'] ?? null,
fileName: $fileName,
typeName: $typeName,
teamsName: $teamsName,
periodName: $periodName,
isAskJiminny: true,
)
);
exit(1);
}
private function formatDate(JobDispatcherInterface $jobDispatcher): void
{
$customName = 'Custom report name';
// $frequency = self::FREQUENCY_DAILY;
// $frequency = self::FREQUENCY_WEEKLY;
$frequency = self::FREQUENCY_MONTHLY;
// $frequency = self::FREQUENCY_QUARTERLY;
// $frequency = self::FREQUENCY_ONE_OFF;
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
$periodName = $this->formatReportPeriodName($frequency, $from, $to);
$filenameSuffix = null;
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
$result = $this->sanitizeFileName("{$customName} - {$periodName}");
}
$this->info($result);
}
public function calculateFromAndToDatePeriod(
string $frequency,
?Carbon $fromDate = null,
?Carbon $toDate = null
): array {
if ($frequency === self::FREQUENCY_ONE_OFF) {
return [
'fromDate' => $fromDate,
'toDate' => $toDate,
];
}
$now = Carbon::now();
return match ($frequency) {
self::FREQUENCY_DAILY => [
'fromDate' => $now->copy()->subDay()->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_WEEKLY => [
'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_MONTHLY => [
'fromDate' => $now->copy()->subMonths(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_QUARTERLY => [
'fromDate' => $now->copy()->subMonths(3)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
default => throw new InvalidArgumentException("Unsupported frequency: {$frequency}"),
};
}
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 sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
private function getPayload(AutomatedReportsService $automatedReportsService)
{
$reportResult = AutomatedReportResult::find(269);
$automatedReport = $reportResult->getReport();
$activityIds = [1,2,3];
$payload = $automatedReportsService->getAskJiminnyGenerateReportPayload(
automatedReport: $automatedReport,
reportResult: $reportResult,
activityIds: $activityIds,
);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$payload ' . PHP_EOL . print_r($payload, true));
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
36
Previous Highlighted Error
Next Highlighted Error
[2026-04-24 09:01:25] local.INFO: B {"correlation_id":"f5851610-eb8f-43c9-b2fa-d3acfb0608a6","trace_id":"e8f54fb0-0b73-4607-9247-494e6af5abc4"}
[2026-04-24 09:01:26] local.INFO: $result
Illuminate\Http\Client\Response Object
(
[response:protected] => GuzzleHttp\Psr7\Response Object
(
[reasonPhrase:GuzzleHttp\Psr7\Response:private] => Unauthorized
[statusCode:GuzzleHttp\Psr7\Response:private] => 401
[headers:GuzzleHttp\Psr7\Response:private] => Array
(
[Date] => Array
(
[0] => Fri, 24 Apr 2026 09:01:26 GMT
)
[Content-Type] => Array
(
[0] => application/json; charset=utf-8
)
[Content-Length] => Array
(
[0] => 186
)
[Connection] => Array
(
[0] => keep-alive
)
[cache-control] => Array
(
[0] => max-age=0, private, must-revalidate
)
[server] => Array
(
[0] => Cowboy
)
[x-ratelimit-limit] => Array
(
[0] => 600
)
[x-ratelimit-remaining] => Array
(
[0] => 599
)
[x-ratelimit-reset] => Array
(
[0] => 1777081286
)
[x-request-id] => Array
(
[0] => GKk_cdj69Q_svKyLwxwN
)
)
[headerNames:GuzzleHttp\Psr7\Response:private] => Array
(
[date] => Date
[content-type] => Content-Type
[content-length] => Content-Length
[connection] => Connection
[cache-control] => cache-control
[server] => server
[x-ratelimit-limit] => x-ratelimit-limit
[x-ratelimit-remaining] => x-ratelimit-remaining
[x-ratelimit-reset] => x-ratelimit-reset
[x-request-id] => x-request-id
)
[protocol:GuzzleHttp\Psr7\Response:private] => 1.1
[stream:GuzzleHttp\Psr7\Response:private] => GuzzleHttp\Psr7\Stream Object
(
[stream:GuzzleHttp\Psr7\Stream:private] => Resource id #2511
[size:GuzzleHttp\Psr7\Stream:private] =>
[seekable:GuzzleHttp\Psr7\Stream:private] => 1
[readable:GuzzleHttp\Psr7\Stream:private] => 1
[writable:GuzzleHttp\Psr7\Stream:private] => 1
[uri:GuzzleHttp\Psr7\Stream:private] => php://temp
[customMetadata:GuzzleHttp\Psr7\Stream:private] => Array
(
)
)
)
[decoded:protected] =>
[cookies] => GuzzleHttp\Cookie\CookieJar Object
(
[cookies:GuzzleHttp\Cookie\CookieJar:private] => Array
(
)
[strictMode:GuzzleHttp\Cookie\CookieJar:private] =>
)
[transferStats] => GuzzleHttp\TransferStats Object
(
[request:GuzzleHttp\TransferStats:private] => GuzzleHttp\Psr7\Request Object
(
[method:GuzzleHttp\Psr7\Request:private] => POST
[requestTarget:GuzzleHttp\Psr7\Request:private] =>
[uri:GuzzleHttp\Psr7\Request:private] => GuzzleHttp\Psr7\Uri Object
(
[scheme:GuzzleHttp\Psr7\Uri:private] => https
[userInfo:GuzzleHttp\Psr7\Uri:private] =>
[host:GuzzleHttp\Psr7\Uri:private] => analytex.userpilot.io
[port:GuzzleHttp\Psr7\Uri:private] =>
[path:GuzzleHttp\Psr7\Uri:private] => /v1/track
[query:GuzzleHttp\Psr7\Uri:private] =>
[fragment:GuzzleHttp\Psr7\Uri:private] =>
[composedComponents:GuzzleHttp\Psr7\Uri:private] => https://analytex.userpilot.io/v1/track
)
[headers:GuzzleHttp\Psr7\Request:private] => Array
(
[Content-Length] => Array
(
[0] => 156
)
[User-Agent] => Array
(
[0] => GuzzleHttp/7
)
[Content-Type] => Array
(
[0] => application/json
)
[Host] => Array
(
[0] => analytex.userpilot.io
)
[X-API-Version] => Array
(
[0] => 2020-09-22
)
[Authorization] => Array
(
[0] => Token
)
)
[headerNames:GuzzleHttp\Psr7\Request:private] => Array
(
[content-length] => Content-Length
[user-agent] => User-Agent
[content-type] => Content-Type
[host] => Host
[x-api-version] => X-API-Version
[authorization] => Authorization
)
[protocol:GuzzleHttp\Psr7\Request:private] => 1.1
[stream:GuzzleHttp\Psr7\Request:private] => GuzzleHttp\Psr7\Stream Object
(
[stream:GuzzleHttp\Psr7\Stream:private] => Resource id #2502
[size:GuzzleHttp\Psr7\Stream:private] => 156
[seekable:GuzzleHttp\Psr7\Stream:private] => 1
[readable:GuzzleHttp\Psr7\Stream:private] => 1
[writable:GuzzleHttp\Psr7\Stream:private] => 1
[uri:GuzzleHttp\Psr7\Stream:private] => php://temp
[customMetadata:GuzzleHttp\Psr7\Stream:private] => Array
(
)
)
)
[response:GuzzleHttp\TransferStats:private] => GuzzleHttp\Psr7\Response Object
(
[reasonPhrase:GuzzleHttp\Psr7\Response:private] => Unauthorized
[statusCode:GuzzleHttp\Psr7\Response:private] => 401
[headers:GuzzleHttp\Psr7\Response:private] => Array
(
[Date] => Array
(
[0] => Fri, 24 Apr 2026 09:01:26 GMT
)
[Content-Type] => Array
(
[0] => application/json; charset=utf-8
)
[Content-Length] => Array
(
[0] => 186
)
[Connection] => Array
(
[0] => keep-alive
)
[cache-control] => Array
(
[0] => max-age=0, private, must-revalidate
)
[server] => Array
(
[0] => Cowboy
)
[x-ratelimit-limit] => Array
(
[0] => 600
)
[x-ratelimit-remaining] => Array
(
[0] => 599
)
[x-ratelimit-reset] => Array
(
[0] => 1777081286
)
[x-request-id] => Array
(
[0] => GKk_cdj69Q_svKyLwxwN
)
)
[headerNames:GuzzleHttp\Psr7\Response:private] => Array
(
[date] => Date
[content-type] => Content-Type
[content-length] => Content-Length
[connection] => Connection
[cache-control] => cache-control
[server] => server
[x-ratelimit-limit] => x-ratelimit-limit
[x-ratelimit-remaining] => x-ratelimit-remaining
[x-ratelimit-reset] => x-ratelimit-reset
[x-request-id] => x-request-id
)
[protocol:GuzzleHttp\Psr7\Response:private] => 1.1
[stream:GuzzleHttp\Psr7\Response:private] => GuzzleHttp\Psr7\Stream Object
(
[stream:GuzzleHttp\Psr7\Stream:private] => Resource id #2511
[size:GuzzleHttp\Psr7\Stream:private] =>
[seekable:GuzzleHttp\Psr7\Stream:private] => 1
[readable:GuzzleHttp\Psr7\Stream:private] => 1
[writable:GuzzleHttp\Psr7\Stream:private] => 1
[uri:GuzzleHttp\Psr7\Stream:private] => php://temp
[customMetadata:GuzzleHttp\Psr7\Stream:private] => Array
(
)
)
)
[transferTime:GuzzleHttp\TransferStats:private] => 0.590833
[handlerStats:GuzzleHttp\TransferStats:private] => Array
(
[url] => https://analytex.userpilot.io/v1/track
[content_type] => application/json; charset=utf-8
[http_code] => 401
[header_size] => 345
[request_size] => 340
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0.590833
[namelookup_time] => 0.075913
[connect_time] => 0.243629
[pretransfer_time] => 0.418428
[size_upload] => 156
[size_download] => 186
[speed_download] => 314
[speed_upload] => 264
[download_content_length] => 186
[upload_content_length] => 156
[starttransfer_time] => 0.587514
[redirect_time] => 0
[redirect_url] =>
[primary_ip] => [IP_ADDRESS]
[certinfo] => Array
(
)
[primary_port] => 443
[local_ip] => [IP_ADDRESS]
[local_port] => 60852
[http_version] => 2
[protocol] => 2
[ssl_verifyresult] => 0
[scheme] => HTTPS
[appconnect_time_us] => 418310
[connect_time_us] => 243629
[namelookup_time_us] => 75913
[pretransfer_time_us] => 418428
[redirect_time_us] => 0
[starttransfer_time_us] => 587514
[total_time_us] => 590833
[effective_method] => POST
[capath] => /etc/ssl/certs
[cainfo] => /etc/ssl/certs/ca-certificates.crt
[appconnect_time] => 0.41831
)
[handlerErrorData:GuzzleHttp\TransferStats:private] => 0
)
[truncateExceptionsAt:protected] =>
)
{"correlation_id":"f5851610-eb8f-43c9-b2fa-d3acfb0608a6","trace_id":"e8f54fb0-0b73-4607-9247-494e6af5abc4"}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
PhpStorm
|
faVsco.js – custom.log
|
NULL
|
77263
|
|
Project: faVsco.js, menu
JY-20738-debug-AJ-trackin Project: faVsco.js, menu
JY-20738-debug-AJ-tracking-UP, menu
Start Listening for PHP Debug Connections
ReportControllerTest
Run 'ReportControllerTest'
Debug 'ReportControllerTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
3
115
4
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use InvalidArgumentException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateAskJiminnyReportJob;
use Jiminny\Jobs\AutomatedReports\SendReportMailJob;
use Jiminny\Jobs\JobDispatcherInterface;
use Jiminny\Models\Activity;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Services\Activity\CrmOwnerResolver;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\UserPilot\UserPilotClient;
/**
* Class JiminnyDebugCommand
*
* @package Jiminny\Console\Commands
*/
class JiminnyDebugCommand extends Command
{
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';
protected $signature = 'jiminny:debug';
public function handle(
JobDispatcherInterface $jobDispatcher,
AutomatedReportsService $automatedReportsService,
AutomatedReportsRepository $automatedReportsRepository,
UserPilotClient $userPilotClient
): void {
$user = User::find(143);
// $count = $automatedReportsRepository->countUserReports($user);
// $this->info("Count: {$count}");
// $count = $automatedReportsRepository->countAllUserReports($user);
// $this->info("All count: {$count}");
$payload = [
'report_type' => 'ask_jiminny',
'frequency' => 'weekly',
];
$userPilotClient->track($user, 'ask-jiminny-report-generated', $payload);
exit(1);
$now = Carbon::now()->subDay(1);
$this->info("Now: {$now->toDateTimeString()}");
$weekStart = Carbon::getWeekStartsAt();
$this->info("Now: {$weekStart}");
// $from = $now->copy()->previousWeekday()->startOfDay();
// $to = $now->copy()->previousWeekday()->endOfDay();
// $fromOld = $now->copy()->subWeeks(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subWeek()->startOfWeek();
// $toNew = $now->copy()->subWeek()->endOfWeek();
// $fromOld = $now->copy()->subMonths(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
// $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
$fromOld = $now->copy()->subMonths(3)->startOfDay();
$toOld = $now->copy()->subDay()->endOfDay();
$fromNew = $now->copy()->subQuarterNoOverflow()->startOfQuarter();
$toNew = $now->copy()->subQuarterNoOverflow()->endOfQuarter();
$this->info("From old: {$fromOld->toDateTimeString()}");
$this->info("To old: {$toOld->toDateTimeString()}");
$this->info("From new: {$fromNew->toDateTimeString()}");
$this->info("To new: {$toNew->toDateTimeString()}");
exit(1);
$report = AutomatedReport::find(71);
$job = new RequestGenerateAskJiminnyReportJob($report->getUuid());
$jobDispatcher->dispatch($job);
exit(1);
// $this->formatDate($jobDispatcher);
// $this->sendMail($jobDispatcher, $automatedReportsService);
// $this->crmService();
$this->getPayload($automatedReportsService);
exit(1);
}
private function crmService()
{
$activity = Activity::find(418141);
$team = Team::find(19);
$config = $team->getCrmConfiguration();
$crmResolver = app(CrmOwnerResolver::class, [
'team' => $team,
'integrationAdmin' => $team->getOwner(),
'providerSlug' => $config->getProviderName(),
]);
$crmService = $crmResolver->prepareCrmService();
$crmService->createTranscriptNotes($activity);
}
private function sendMail(JobDispatcherInterface $jobDispatcher, AutomatedReportsService $automatedReportsService)
{
$reportUuid = '';
// $report = $automatedReportsService->getReportResult($reportUuid);
$report = AutomatedReportResult::find(275);
$validRecipients = $automatedReportsService->getValidRecipientUsers(
$report->getReport(),
includeJiminny: true,
);
$recipient = $validRecipients[0];
$fileName = $automatedReportsService->getReportFileName($report);
$typeName = $report->getReport()->getCustomName()
?? $automatedReportsService->getReportTypeName($report);
$teamsName = $automatedReportsService->getReportTeamsName($report);
$periodName = $automatedReportsService->getReportPeriodName($report);
$s3Path = $automatedReportsService->getMediaPath($report);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$fileName ' . PHP_EOL . print_r($fileName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$typeName ' . PHP_EOL . print_r($typeName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$teamsName ' . PHP_EOL . print_r($teamsName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$periodName ' . PHP_EOL . print_r($periodName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$s3Path ' . PHP_EOL . print_r($s3Path, true));
$jobDispatcher->dispatch(
new SendReportMailJob(
reportUuid: $report->getUuid(),
s3Path: $s3Path,
recipientEmail: $recipient['email'],
recipientName: $recipient['name'] ?? null,
fileName: $fileName,
typeName: $typeName,
teamsName: $teamsName,
periodName: $periodName,
isAskJiminny: true,
)
);
exit(1);
}
private function formatDate(JobDispatcherInterface $jobDispatcher): void
{
$customName = 'Custom report name';
// $frequency = self::FREQUENCY_DAILY;
// $frequency = self::FREQUENCY_WEEKLY;
$frequency = self::FREQUENCY_MONTHLY;
// $frequency = self::FREQUENCY_QUARTERLY;
// $frequency = self::FREQUENCY_ONE_OFF;
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
$periodName = $this->formatReportPeriodName($frequency, $from, $to);
$filenameSuffix = null;
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
$result = $this->sanitizeFileName("{$customName} - {$periodName}");
}
$this->info($result);
}
public function calculateFromAndToDatePeriod(
string $frequency,
?Carbon $fromDate = null,
?Carbon $toDate = null
): array {
if ($frequency === self::FREQUENCY_ONE_OFF) {
return [
'fromDate' => $fromDate,
'toDate' => $toDate,
];
}
$now = Carbon::now();
return match ($frequency) {
self::FREQUENCY_DAILY => [
'fromDate' => $now->copy()->subDay()->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_WEEKLY => [
'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_MONTHLY => [
'fromDate' => $now->copy()->subMonths(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_QUARTERLY => [
'fromDate' => $now->copy()->subMonths(3)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
default => throw new InvalidArgumentException("Unsupported frequency: {$frequency}"),
};
}
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 sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
private function getPayload(AutomatedReportsService $automatedReportsService)
{
$reportResult = AutomatedReportResult::find(269);
$automatedReport = $reportResult->getReport();
$activityIds = [1,2,3];
$payload = $automatedReportsService->getAskJiminnyGenerateReportPayload(
automatedReport: $automatedReport,
reportResult: $reportResult,
activityIds: $activityIds,
);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$payload ' . PHP_EOL . print_r($payload, true));
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
11
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Services\UserPilot;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Support\Facades\Http;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Partner;
use Jiminny\Models\Team;
use Jiminny\Models\User;
class UserPilotClient
{
private const API_ENDPOINT = 'https://api.userpilot.io/v1/';
private const ANALYTICS_ENDPOINT = 'https://analytex.userpilot.io/v1/';
private function createRequest(): PendingRequest
{
return Http::withHeaders([
'X-API-Version' => '2020-09-22',
'Authorization' => 'Token ' . config('services.userpilot.key'),
]);
}
public function track(User $user, string $event, array $payload = []): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
\Illuminate\Support\Facades\Log::channel('custom_channel')->info("A");
return;
}
\Illuminate\Support\Facades\Log::channel('custom_channel')->info("B");
try {
$result = $this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'track', [
'event_name' => $event,
'user_id' => $user->getUuid(),
'metadata' => $payload,
]);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$result ' . PHP_EOL . print_r($result, true));
} catch (\Throwable $e) {
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$e ' . PHP_EOL . print_r($e->getMessage(), true));
}
}
public function upsertUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$companyMetadata = $this->getCompanyMetadata($user->getTeam());
$companyMetadata['id'] = $user->getTeam()->getUuid();
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'identify', [
'user_id' => $user->getUuid(),
'metadata' => [
'name' => $user->name,
'first_name' => $user->getFirstName(),
'position' => $user->job ? $user->job->name : null,
'email' => $user->getEmailAddress(),
'created_at' => $user->getCreatedAt()->unix(),
'is_admin' => $user->hasRole(User::ROLE_ADMIN),
'is_manager' => $user->hasRole(User::ROLE_MANAGER),
'is_owner' => $user->isTeamOwner(),
'is_insights' => $user->hasRole(User::ROLE_ANALYST),
'is_recorder' => $user->hasRole(User::ROLE_RECORDER),
'is_jiminny_voice' => $user->hasRole(User::ROLE_RECORDER_AND_VOICE),
'is_listener' => $user->hasRole(User::ROLE_LISTENER),
'license' => null,
'team' => $user->group ? $user->group->name : null,
'language' => $user->getLanguage(),
'email_sync' => $user->isSyncEmailEnabled(),
],
'company' => $companyMetadata,
]);
}
public function upsertCompany(Team $team): void
{
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'companies/identify', [
'company_id' => $team->getUuid(),
'metadata' => $this->getCompanyMetadata($team),
]);
}
private function getCompanyMetadata(Team $team): array
{
return [
'created_at' => $team->getCreatedAt()->unix(),
'name' => $team->getName(),
'region' => config('jiminny.deploy_region'),
'crm' => $team->getCrmConfiguration()->getProviderName(),
'crm_installed_app_version' => $team->getCrmConfiguration()->getInstalledAppVersion(),
'calendar' => $team->getCalendarProvider(),
'notification_provider' => $team->getNotificationProvider(),
'has_jiminny_voice' => $team->hasFeature(FeatureEnum::DIALER),
'tier' => $team->getTier()?->getTitle(),
];
}
public function deleteUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'users', [
'users' => [$user->getUuid()],
]);
}
public function deleteCompany(Team $team): void
{
if ($this->shouldRequest($team) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'companies', [
'companies' => [$team->getUuid()],
]);
}
public function shouldRequest(Team $team): bool
{
return config('services.userpilot.key') !== null && $team->getPartnerId() === Partner::PARTNER_DEFAULT;
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
PhpStorm
|
faVsco.js – UserPilotClient.php
|
NULL
|
77264
|
|
Project: faVsco.js, menu
JY-20738-debug-AJ-trackin Project: faVsco.js, menu
JY-20738-debug-AJ-tracking-UP, menu
Start Listening for PHP Debug Connections
ReportControllerTest
Run 'ReportControllerTest'
Debug 'ReportControllerTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
3
115
4
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use InvalidArgumentException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateAskJiminnyReportJob;
use Jiminny\Jobs\AutomatedReports\SendReportMailJob;
use Jiminny\Jobs\JobDispatcherInterface;
use Jiminny\Models\Activity;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Services\Activity\CrmOwnerResolver;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\UserPilot\UserPilotClient;
/**
* Class JiminnyDebugCommand
*
* @package Jiminny\Console\Commands
*/
class JiminnyDebugCommand extends Command
{
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';
protected $signature = 'jiminny:debug';
public function handle(
JobDispatcherInterface $jobDispatcher,
AutomatedReportsService $automatedReportsService,
AutomatedReportsRepository $automatedReportsRepository,
UserPilotClient $userPilotClient
): void {
$user = User::find(143);
// $count = $automatedReportsRepository->countUserReports($user);
// $this->info("Count: {$count}");
// $count = $automatedReportsRepository->countAllUserReports($user);
// $this->info("All count: {$count}");
$payload = [
'report_type' => 'ask_jiminny',
'frequency' => 'weekly',
];
$userPilotClient->track($user, 'ask-jiminny-report-generated', $payload);
exit(1);
$now = Carbon::now()->subDay(1);
$this->info("Now: {$now->toDateTimeString()}");
$weekStart = Carbon::getWeekStartsAt();
$this->info("Now: {$weekStart}");
// $from = $now->copy()->previousWeekday()->startOfDay();
// $to = $now->copy()->previousWeekday()->endOfDay();
// $fromOld = $now->copy()->subWeeks(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subWeek()->startOfWeek();
// $toNew = $now->copy()->subWeek()->endOfWeek();
// $fromOld = $now->copy()->subMonths(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
// $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
$fromOld = $now->copy()->subMonths(3)->startOfDay();
$toOld = $now->copy()->subDay()->endOfDay();
$fromNew = $now->copy()->subQuarterNoOverflow()->startOfQuarter();
$toNew = $now->copy()->subQuarterNoOverflow()->endOfQuarter();
$this->info("From old: {$fromOld->toDateTimeString()}");
$this->info("To old: {$toOld->toDateTimeString()}");
$this->info("From new: {$fromNew->toDateTimeString()}");
$this->info("To new: {$toNew->toDateTimeString()}");
exit(1);
$report = AutomatedReport::find(71);
$job = new RequestGenerateAskJiminnyReportJob($report->getUuid());
$jobDispatcher->dispatch($job);
exit(1);
// $this->formatDate($jobDispatcher);
// $this->sendMail($jobDispatcher, $automatedReportsService);
// $this->crmService();
$this->getPayload($automatedReportsService);
exit(1);
}
private function crmService()
{
$activity = Activity::find(418141);
$team = Team::find(19);
$config = $team->getCrmConfiguration();
$crmResolver = app(CrmOwnerResolver::class, [
'team' => $team,
'integrationAdmin' => $team->getOwner(),
'providerSlug' => $config->getProviderName(),
]);
$crmService = $crmResolver->prepareCrmService();
$crmService->createTranscriptNotes($activity);
}
private function sendMail(JobDispatcherInterface $jobDispatcher, AutomatedReportsService $automatedReportsService)
{
$reportUuid = '';
// $report = $automatedReportsService->getReportResult($reportUuid);
$report = AutomatedReportResult::find(275);
$validRecipients = $automatedReportsService->getValidRecipientUsers(
$report->getReport(),
includeJiminny: true,
);
$recipient = $validRecipients[0];
$fileName = $automatedReportsService->getReportFileName($report);
$typeName = $report->getReport()->getCustomName()
?? $automatedReportsService->getReportTypeName($report);
$teamsName = $automatedReportsService->getReportTeamsName($report);
$periodName = $automatedReportsService->getReportPeriodName($report);
$s3Path = $automatedReportsService->getMediaPath($report);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$fileName ' . PHP_EOL . print_r($fileName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$typeName ' . PHP_EOL . print_r($typeName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$teamsName ' . PHP_EOL . print_r($teamsName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$periodName ' . PHP_EOL . print_r($periodName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$s3Path ' . PHP_EOL . print_r($s3Path, true));
$jobDispatcher->dispatch(
new SendReportMailJob(
reportUuid: $report->getUuid(),
s3Path: $s3Path,
recipientEmail: $recipient['email'],
recipientName: $recipient['name'] ?? null,
fileName: $fileName,
typeName: $typeName,
teamsName: $teamsName,
periodName: $periodName,
isAskJiminny: true,
)
);
exit(1);
}
private function formatDate(JobDispatcherInterface $jobDispatcher): void
{
$customName = 'Custom report name';
// $frequency = self::FREQUENCY_DAILY;
// $frequency = self::FREQUENCY_WEEKLY;
$frequency = self::FREQUENCY_MONTHLY;
// $frequency = self::FREQUENCY_QUARTERLY;
// $frequency = self::FREQUENCY_ONE_OFF;
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
$periodName = $this->formatReportPeriodName($frequency, $from, $to);
$filenameSuffix = null;
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
$result = $this->sanitizeFileName("{$customName} - {$periodName}");
}
$this->info($result);
}
public function calculateFromAndToDatePeriod(
string $frequency,
?Carbon $fromDate = null,
?Carbon $toDate = null
): array {
if ($frequency === self::FREQUENCY_ONE_OFF) {
return [
'fromDate' => $fromDate,
'toDate' => $toDate,
];
}
$now = Carbon::now();
return match ($frequency) {
self::FREQUENCY_DAILY => [
'fromDate' => $now->copy()->subDay()->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_WEEKLY => [
'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_MONTHLY => [
'fromDate' => $now->copy()->subMonths(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_QUARTERLY => [
'fromDate' => $now->copy()->subMonths(3)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
default => throw new InvalidArgumentException("Unsupported frequency: {$frequency}"),
};
}
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 sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
private function getPayload(AutomatedReportsService $automatedReportsService)
{
$reportResult = AutomatedReportResult::find(269);
$automatedReport = $reportResult->getReport();
$activityIds = [1,2,3];
$payload = $automatedReportsService->getAskJiminnyGenerateReportPayload(
automatedReport: $automatedReport,
reportResult: $reportResult,
activityIds: $activityIds,
);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$payload ' . PHP_EOL . print_r($payload, true));
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
11
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Services\UserPilot;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Support\Facades\Http;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Partner;
use Jiminny\Models\Team;
use Jiminny\Models\User;
class UserPilotClient
{
private const API_ENDPOINT = 'https://api.userpilot.io/v1/';
private const ANALYTICS_ENDPOINT = 'https://analytex.userpilot.io/v1/';
private function createRequest(): PendingRequest
{
return Http::withHeaders([
'X-API-Version' => '2020-09-22',
'Authorization' => 'Token ' . config('services.userpilot.key'),
]);
}
public function track(User $user, string $event, array $payload = []): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
\Illuminate\Support\Facades\Log::channel('custom_channel')->info("A");
return;
}
\Illuminate\Support\Facades\Log::channel('custom_channel')->info("B");
try {
$result = $this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'track', [
'event_name' => $event,
'user_id' => $user->getUuid(),
'metadata' => $payload,
]);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$result ' . PHP_EOL . print_r($result, true));
} catch (\Throwable $e) {
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$e ' . PHP_EOL . print_r($e->getMessage(), true));
}
}
public function upsertUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$companyMetadata = $this->getCompanyMetadata($user->getTeam());
$companyMetadata['id'] = $user->getTeam()->getUuid();
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'identify', [
'user_id' => $user->getUuid(),
'metadata' => [
'name' => $user->name,
'first_name' => $user->getFirstName(),
'position' => $user->job ? $user->job->name : null,
'email' => $user->getEmailAddress(),
'created_at' => $user->getCreatedAt()->unix(),
'is_admin' => $user->hasRole(User::ROLE_ADMIN),
'is_manager' => $user->hasRole(User::ROLE_MANAGER),
'is_owner' => $user->isTeamOwner(),
'is_insights' => $user->hasRole(User::ROLE_ANALYST),
'is_recorder' => $user->hasRole(User::ROLE_RECORDER),
'is_jiminny_voice' => $user->hasRole(User::ROLE_RECORDER_AND_VOICE),
'is_listener' => $user->hasRole(User::ROLE_LISTENER),
'license' => null,
'team' => $user->group ? $user->group->name : null,
'language' => $user->getLanguage(),
'email_sync' => $user->isSyncEmailEnabled(),
],
'company' => $companyMetadata,
]);
}
public function upsertCompany(Team $team): void
{
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'companies/identify', [
'company_id' => $team->getUuid(),
'metadata' => $this->getCompanyMetadata($team),
]);
}
private function getCompanyMetadata(Team $team): array
{
return [
'created_at' => $team->getCreatedAt()->unix(),
'name' => $team->getName(),
'region' => config('jiminny.deploy_region'),
'crm' => $team->getCrmConfiguration()->getProviderName(),
'crm_installed_app_version' => $team->getCrmConfiguration()->getInstalledAppVersion(),
'calendar' => $team->getCalendarProvider(),
'notification_provider' => $team->getNotificationProvider(),
'has_jiminny_voice' => $team->hasFeature(FeatureEnum::DIALER),
'tier' => $team->getTier()?->getTitle(),
];
}
public function deleteUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'users', [
'users' => [$user->getUuid()],
]);
}
public function deleteCompany(Team $team): void
{
if ($this->shouldRequest($team) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'companies', [
'companies' => [$team->getUuid()],
]);
}
public function shouldRequest(Team $team): bool
{
return config('services.userpilot.key') !== null && $team->getPartnerId() === Partner::PARTNER_DEFAULT;
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
PhpStorm
|
faVsco.js – UserPilotClient.php
|
NULL
|
77265
|
|
Project: faVsco.js, menu
JY-20738-debug-AJ-trackin Project: faVsco.js, menu
JY-20738-debug-AJ-tracking-UP, menu
Start Listening for PHP Debug Connections
ReportControllerTest
Run 'ReportControllerTest'
Debug 'ReportControllerTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
3
115
4
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use InvalidArgumentException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateAskJiminnyReportJob;
use Jiminny\Jobs\AutomatedReports\SendReportMailJob;
use Jiminny\Jobs\JobDispatcherInterface;
use Jiminny\Models\Activity;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Services\Activity\CrmOwnerResolver;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\UserPilot\UserPilotClient;
/**
* Class JiminnyDebugCommand
*
* @package Jiminny\Console\Commands
*/
class JiminnyDebugCommand extends Command
{
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';
protected $signature = 'jiminny:debug';
public function handle(
JobDispatcherInterface $jobDispatcher,
AutomatedReportsService $automatedReportsService,
AutomatedReportsRepository $automatedReportsRepository,
UserPilotClient $userPilotClient
): void {
$user = User::find(143);
// $count = $automatedReportsRepository->countUserReports($user);
// $this->info("Count: {$count}");
// $count = $automatedReportsRepository->countAllUserReports($user);
// $this->info("All count: {$count}");
$payload = [
'report_type' => 'ask_jiminny',
'frequency' => 'weekly',
];
$userPilotClient->track($user, 'ask-jiminny-report-generated', $payload);
exit(1);
$now = Carbon::now()->subDay(1);
$this->info("Now: {$now->toDateTimeString()}");
$weekStart = Carbon::getWeekStartsAt();
$this->info("Now: {$weekStart}");
// $from = $now->copy()->previousWeekday()->startOfDay();
// $to = $now->copy()->previousWeekday()->endOfDay();
// $fromOld = $now->copy()->subWeeks(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subWeek()->startOfWeek();
// $toNew = $now->copy()->subWeek()->endOfWeek();
// $fromOld = $now->copy()->subMonths(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
// $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
$fromOld = $now->copy()->subMonths(3)->startOfDay();
$toOld = $now->copy()->subDay()->endOfDay();
$fromNew = $now->copy()->subQuarterNoOverflow()->startOfQuarter();
$toNew = $now->copy()->subQuarterNoOverflow()->endOfQuarter();
$this->info("From old: {$fromOld->toDateTimeString()}");
$this->info("To old: {$toOld->toDateTimeString()}");
$this->info("From new: {$fromNew->toDateTimeString()}");
$this->info("To new: {$toNew->toDateTimeString()}");
exit(1);
$report = AutomatedReport::find(71);
$job = new RequestGenerateAskJiminnyReportJob($report->getUuid());
$jobDispatcher->dispatch($job);
exit(1);
// $this->formatDate($jobDispatcher);
// $this->sendMail($jobDispatcher, $automatedReportsService);
// $this->crmService();
$this->getPayload($automatedReportsService);
exit(1);
}
private function crmService()
{
$activity = Activity::find(418141);
$team = Team::find(19);
$config = $team->getCrmConfiguration();
$crmResolver = app(CrmOwnerResolver::class, [
'team' => $team,
'integrationAdmin' => $team->getOwner(),
'providerSlug' => $config->getProviderName(),
]);
$crmService = $crmResolver->prepareCrmService();
$crmService->createTranscriptNotes($activity);
}
private function sendMail(JobDispatcherInterface $jobDispatcher, AutomatedReportsService $automatedReportsService)
{
$reportUuid = '';
// $report = $automatedReportsService->getReportResult($reportUuid);
$report = AutomatedReportResult::find(275);
$validRecipients = $automatedReportsService->getValidRecipientUsers(
$report->getReport(),
includeJiminny: true,
);
$recipient = $validRecipients[0];
$fileName = $automatedReportsService->getReportFileName($report);
$typeName = $report->getReport()->getCustomName()
?? $automatedReportsService->getReportTypeName($report);
$teamsName = $automatedReportsService->getReportTeamsName($report);
$periodName = $automatedReportsService->getReportPeriodName($report);
$s3Path = $automatedReportsService->getMediaPath($report);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$fileName ' . PHP_EOL . print_r($fileName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$typeName ' . PHP_EOL . print_r($typeName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$teamsName ' . PHP_EOL . print_r($teamsName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$periodName ' . PHP_EOL . print_r($periodName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$s3Path ' . PHP_EOL . print_r($s3Path, true));
$jobDispatcher->dispatch(
new SendReportMailJob(
reportUuid: $report->getUuid(),
s3Path: $s3Path,
recipientEmail: $recipient['email'],
recipientName: $recipient['name'] ?? null,
fileName: $fileName,
typeName: $typeName,
teamsName: $teamsName,
periodName: $periodName,
isAskJiminny: true,
)
);
exit(1);
}
private function formatDate(JobDispatcherInterface $jobDispatcher): void
{
$customName = 'Custom report name';
// $frequency = self::FREQUENCY_DAILY;
// $frequency = self::FREQUENCY_WEEKLY;
$frequency = self::FREQUENCY_MONTHLY;
// $frequency = self::FREQUENCY_QUARTERLY;
// $frequency = self::FREQUENCY_ONE_OFF;
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
$periodName = $this->formatReportPeriodName($frequency, $from, $to);
$filenameSuffix = null;
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
$result = $this->sanitizeFileName("{$customName} - {$periodName}");
}
$this->info($result);
}
public function calculateFromAndToDatePeriod(
string $frequency,
?Carbon $fromDate = null,
?Carbon $toDate = null
): array {
if ($frequency === self::FREQUENCY_ONE_OFF) {
return [
'fromDate' => $fromDate,
'toDate' => $toDate,
];
}
$now = Carbon::now();
return match ($frequency) {
self::FREQUENCY_DAILY => [
'fromDate' => $now->copy()->subDay()->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_WEEKLY => [
'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_MONTHLY => [
'fromDate' => $now->copy()->subMonths(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_QUARTERLY => [
'fromDate' => $now->copy()->subMonths(3)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
default => throw new InvalidArgumentException("Unsupported frequency: {$frequency}"),
};
}
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 sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
private function getPayload(AutomatedReportsService $automatedReportsService)
{
$reportResult = AutomatedReportResult::find(269);
$automatedReport = $reportResult->getReport();
$activityIds = [1,2,3];
$payload = $automatedReportsService->getAskJiminnyGenerateReportPayload(
automatedReport: $automatedReport,
reportResult: $reportResult,
activityIds: $activityIds,
);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$payload ' . PHP_EOL . print_r($payload, true));
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
11
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Services\UserPilot;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Support\Facades\Http;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Partner;
use Jiminny\Models\Team;
use Jiminny\Models\User;
class UserPilotClient
{
private const API_ENDPOINT = 'https://api.userpilot.io/v1/';
private const ANALYTICS_ENDPOINT = 'https://analytex.userpilot.io/v1/';
private function createRequest(): PendingRequest
{
return Http::withHeaders([
'X-API-Version' => '2020-09-22',
'Authorization' => 'Token ' . config('services.userpilot.key'),
]);
}
public function track(User $user, string $event, array $payload = []): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
\Illuminate\Support\Facades\Log::channel('custom_channel')->info("A");
return;
}
\Illuminate\Support\Facades\Log::channel('custom_channel')->info("B");
try {
$result = $this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'track', [
'event_name' => $event,
'user_id' => $user->getUuid(),
'metadata' => $payload,
]);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$result ' . PHP_EOL . print_r($result, true));
} catch (\Throwable $e) {
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$e ' . PHP_EOL . print_r($e->getMessage(), true));
}
}
public function upsertUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$companyMetadata = $this->getCompanyMetadata($user->getTeam());
$companyMetadata['id'] = $user->getTeam()->getUuid();
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'identify', [
'user_id' => $user->getUuid(),
'metadata' => [
'name' => $user->name,
'first_name' => $user->getFirstName(),
'position' => $user->job ? $user->job->name : null,
'email' => $user->getEmailAddress(),
'created_at' => $user->getCreatedAt()->unix(),
'is_admin' => $user->hasRole(User::ROLE_ADMIN),
'is_manager' => $user->hasRole(User::ROLE_MANAGER),
'is_owner' => $user->isTeamOwner(),
'is_insights' => $user->hasRole(User::ROLE_ANALYST),
'is_recorder' => $user->hasRole(User::ROLE_RECORDER),
'is_jiminny_voice' => $user->hasRole(User::ROLE_RECORDER_AND_VOICE),
'is_listener' => $user->hasRole(User::ROLE_LISTENER),
'license' => null,
'team' => $user->group ? $user->group->name : null,
'language' => $user->getLanguage(),
'email_sync' => $user->isSyncEmailEnabled(),
],
'company' => $companyMetadata,
]);
}
public function upsertCompany(Team $team): void
{
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'companies/identify', [
'company_id' => $team->getUuid(),
'metadata' => $this->getCompanyMetadata($team),
]);
}
private function getCompanyMetadata(Team $team): array
{
return [
'created_at' => $team->getCreatedAt()->unix(),
'name' => $team->getName(),
'region' => config('jiminny.deploy_region'),
'crm' => $team->getCrmConfiguration()->getProviderName(),
'crm_installed_app_version' => $team->getCrmConfiguration()->getInstalledAppVersion(),
'calendar' => $team->getCalendarProvider(),
'notification_provider' => $team->getNotificationProvider(),
'has_jiminny_voice' => $team->hasFeature(FeatureEnum::DIALER),
'tier' => $team->getTier()?->getTitle(),
];
}
public function deleteUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'users', [
'users' => [$user->getUuid()],
]);
}
public function deleteCompany(Team $team): void
{
if ($this->shouldRequest($team) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'companies', [
'companies' => [$team->getUuid()],
]);
}
public function shouldRequest(Team $team): bool
{
return config('services.userpilot.key') !== null && $team->getPartnerId() === Partner::PARTNER_DEFAULT;
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
PhpStorm
|
faVsco.js – UserPilotClient.php
|
NULL
|
77266
|
|
Diff
Changelist:
Changelist:
Changes
Show Diff
Rol Diff
Changelist:
Changelist:
Changes
Show Diff
Rollback...
Refresh
Group By
Expand All
Collapse All
11 files, folder partially checked
app 7 files, folder partially checked
Console/Commands 1 file, folder not checked
Http/Controllers 2 files, folder not checked
Jobs/Team 1 file, folder not checked
Listeners/AutomatedReports/UserPilot 1 file, folder not checked
Services 2 files, folder partially checked
UserPilot 1 file, folder checked
UserPilotClient.php, class checked
PlaybackService.php, class not checked
config 1 file, folder not checked...
|
PhpStorm
|
Shelve Changes
|
NULL
|
77267
|
|
Diff
Changelist:
Changelist:
Changes
Show Diff
Rol Diff
Changelist:
Changelist:
Changes
Show Diff
Rollback...
Refresh
Group By
Expand All
Collapse All
11 files, folder partially checked
app 7 files, folder partially checked
Console/Commands 1 file, folder not checked
Http/Controllers 2 files, folder not checked
Jobs/Team 1 file, folder not checked
Listeners/AutomatedReports/UserPilot 1 file, folder not checked
Services 2 files, folder partially checked
UserPilot 1 file, folder checked
UserPilotClient.php, class checked
PlaybackService.php, class not checked...
|
PhpStorm
|
Shelve Changes
|
NULL
|
77268
|
|
Diff
Changelist:
Changelist:
Changes
Show Diff
Rol Diff
Changelist:
Changelist:
Changes
Show Diff
Rollback...
Refresh
Group By
Expand All
Collapse All
11 files, folder partially checked
app 7 files, folder partially checked
Console/Commands 1 file, folder not checked
Http/Controllers 2 files, folder not checked
Jobs/Team 1 file, folder not checked
Listeners/AutomatedReports/UserPilot 1 file, folder not checked
Services 2 files, folder partially checked
UserPilot 1 file, folder checked
UserPilotClient.php, class checked
PlaybackService.php, class not checked
config 1 file, folder not checked
tests/Unit 2 files, folder not checked
.env.local not checked
app 7 files, folder partially checked
Console/Commands 1 file, folder not checked
Http/Controllers 2 files, folder not checked
Jobs/Team 1 file, folder not checked
Listeners/AutomatedReports/UserPilot 1 file, folder not checked
Services 2 files, folder partially checked
UserPilot 1 file, folder checked
UserPilotClient.php, class checked
PlaybackService.php, class not checked
Console/Commands 1 file, folder not checked
Http/Controllers 2 files, folder not checked
Jobs/Team 1 file, folder not checked
Listeners/AutomatedReports/UserPilot 1 file, folder not checked
Services 2 files, folder partially checked
UserPilot 1 file, folder checked
UserPilotClient.php, class checked
PlaybackService.php, class not checked
UserPilot 1 file, folder checked
UserPilotClient.php, class checked
UserPilotClient.php, class checked
PlaybackService.php, class not checked
config 1 file, folder not checked
tests/Unit 2 files, folder not checked
.env.local not checked
1 modified
UP dev logs
Commit Message
Commit Message History
Previous Difference
Next Difference
Jump to Source
Compare Previous File
Compare Next File
Go to Changed File…
Side-by-side viewer
Do not ignore
Highlight words
Collapse Unchanged Fragments
Synchronize Scrolling
Disable Editing
Settings
Help...
|
PhpStorm
|
Shelve Changes
|
NULL
|
77269
|
|
Diff
Changelist:
Changelist:
Changes
Show Diff
Rol Diff
Changelist:
Changelist:
Changes
Show Diff
Rollback...
Refresh
Group By
Expand All
Collapse All
11 files, folder partially checked
app 7 files, folder partially checked
Console/Commands 1 file, folder not checked
Http/Controllers 2 files, folder not checked
Jobs/Team 1 file, folder not checked
Listeners/AutomatedReports/UserPilot 1 file, folder not checked
Services 2 files, folder partially checked
UserPilot 1 file, folder checked
UserPilotClient.php, class checked
PlaybackService.php, class not checked
config 1 file, folder not checked
tests/Unit 2 files, folder not checked
.env.local not checked
app 7 files, folder partially checked
Console/Commands 1 file, folder not checked
Http/Controllers 2 files, folder not checked
Jobs/Team 1 file, folder not checked
Listeners/AutomatedReports/UserPilot 1 file, folder not checked
Services 2 files, folder partially checked
UserPilot 1 file, folder checked
UserPilotClient.php, class checked
PlaybackService.php, class not checked
Console/Commands 1 file, folder not checked
Http/Controllers 2 files, folder not checked
Jobs/Team 1 file, folder not checked
Listeners/AutomatedReports/UserPilot 1 file, folder not checked
Services 2 files, folder partially checked
UserPilot 1 file, folder checked
UserPilotClient.php, class checked
PlaybackService.php, class not checked
UserPilot 1 file, folder checked
UserPilotClient.php, class checked
UserPilotClient.php, class checked
PlaybackService.php, class not checked
config 1 file, folder not checked
tests/Unit 2 files, folder not checked
.env.local not checked
1 modified
UP dev logs
Commit Message
Commit Message History
Previous Difference
Next Difference
Jump to Source...
|
PhpStorm
|
Shelve Changes
|
NULL
|
77270
|
|
Project: faVsco.js, menu
JY-20738-debug-AJ-trackin Project: faVsco.js, menu
JY-20738-debug-AJ-tracking-UP, menu
Start Listening for PHP Debug Connections
ReportControllerTest
Run 'ReportControllerTest'
Debug 'ReportControllerTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
3
115
4
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use InvalidArgumentException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateAskJiminnyReportJob;
use Jiminny\Jobs\AutomatedReports\SendReportMailJob;
use Jiminny\Jobs\JobDispatcherInterface;
use Jiminny\Models\Activity;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Services\Activity\CrmOwnerResolver;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\UserPilot\UserPilotClient;
/**
* Class JiminnyDebugCommand
*
* @package Jiminny\Console\Commands
*/
class JiminnyDebugCommand extends Command
{
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';
protected $signature = 'jiminny:debug';
public function handle(
JobDispatcherInterface $jobDispatcher,
AutomatedReportsService $automatedReportsService,
AutomatedReportsRepository $automatedReportsRepository,
UserPilotClient $userPilotClient
): void {
$user = User::find(143);
// $count = $automatedReportsRepository->countUserReports($user);
// $this->info("Count: {$count}");
// $count = $automatedReportsRepository->countAllUserReports($user);
// $this->info("All count: {$count}");
$payload = [
'report_type' => 'ask_jiminny',
'frequency' => 'weekly',
];
$userPilotClient->track($user, 'ask-jiminny-report-generated', $payload);
exit(1);
$now = Carbon::now()->subDay(1);
$this->info("Now: {$now->toDateTimeString()}");
$weekStart = Carbon::getWeekStartsAt();
$this->info("Now: {$weekStart}");
// $from = $now->copy()->previousWeekday()->startOfDay();
// $to = $now->copy()->previousWeekday()->endOfDay();
// $fromOld = $now->copy()->subWeeks(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subWeek()->startOfWeek();
// $toNew = $now->copy()->subWeek()->endOfWeek();
// $fromOld = $now->copy()->subMonths(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
// $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
$fromOld = $now->copy()->subMonths(3)->startOfDay();
$toOld = $now->copy()->subDay()->endOfDay();
$fromNew = $now->copy()->subQuarterNoOverflow()->startOfQuarter();
$toNew = $now->copy()->subQuarterNoOverflow()->endOfQuarter();
$this->info("From old: {$fromOld->toDateTimeString()}");
$this->info("To old: {$toOld->toDateTimeString()}");
$this->info("From new: {$fromNew->toDateTimeString()}");
$this->info("To new: {$toNew->toDateTimeString()}");
exit(1);
$report = AutomatedReport::find(71);
$job = new RequestGenerateAskJiminnyReportJob($report->getUuid());
$jobDispatcher->dispatch($job);
exit(1);
// $this->formatDate($jobDispatcher);
// $this->sendMail($jobDispatcher, $automatedReportsService);
// $this->crmService();
$this->getPayload($automatedReportsService);
exit(1);
}
private function crmService()
{
$activity = Activity::find(418141);
$team = Team::find(19);
$config = $team->getCrmConfiguration();
$crmResolver = app(CrmOwnerResolver::class, [
'team' => $team,
'integrationAdmin' => $team->getOwner(),
'providerSlug' => $config->getProviderName(),
]);
$crmService = $crmResolver->prepareCrmService();
$crmService->createTranscriptNotes($activity);
}
private function sendMail(JobDispatcherInterface $jobDispatcher, AutomatedReportsService $automatedReportsService)
{
$reportUuid = '';
// $report = $automatedReportsService->getReportResult($reportUuid);
$report = AutomatedReportResult::find(275);
$validRecipients = $automatedReportsService->getValidRecipientUsers(
$report->getReport(),
includeJiminny: true,
);
$recipient = $validRecipients[0];
$fileName = $automatedReportsService->getReportFileName($report);
$typeName = $report->getReport()->getCustomName()
?? $automatedReportsService->getReportTypeName($report);
$teamsName = $automatedReportsService->getReportTeamsName($report);
$periodName = $automatedReportsService->getReportPeriodName($report);
$s3Path = $automatedReportsService->getMediaPath($report);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$fileName ' . PHP_EOL . print_r($fileName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$typeName ' . PHP_EOL . print_r($typeName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$teamsName ' . PHP_EOL . print_r($teamsName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$periodName ' . PHP_EOL . print_r($periodName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$s3Path ' . PHP_EOL . print_r($s3Path, true));
$jobDispatcher->dispatch(
new SendReportMailJob(
reportUuid: $report->getUuid(),
s3Path: $s3Path,
recipientEmail: $recipient['email'],
recipientName: $recipient['name'] ?? null,
fileName: $fileName,
typeName: $typeName,
teamsName: $teamsName,
periodName: $periodName,
isAskJiminny: true,
)
);
exit(1);
}
private function formatDate(JobDispatcherInterface $jobDispatcher): void
{
$customName = 'Custom report name';
// $frequency = self::FREQUENCY_DAILY;
// $frequency = self::FREQUENCY_WEEKLY;
$frequency = self::FREQUENCY_MONTHLY;
// $frequency = self::FREQUENCY_QUARTERLY;
// $frequency = self::FREQUENCY_ONE_OFF;
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
$periodName = $this->formatReportPeriodName($frequency, $from, $to);
$filenameSuffix = null;
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
$result = $this->sanitizeFileName("{$customName} - {$periodName}");
}
$this->info($result);
}
public function calculateFromAndToDatePeriod(
string $frequency,
?Carbon $fromDate = null,
?Carbon $toDate = null
): array {
if ($frequency === self::FREQUENCY_ONE_OFF) {
return [
'fromDate' => $fromDate,
'toDate' => $toDate,
];
}
$now = Carbon::now();
return match ($frequency) {
self::FREQUENCY_DAILY => [
'fromDate' => $now->copy()->subDay()->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_WEEKLY => [
'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_MONTHLY => [
'fromDate' => $now->copy()->subMonths(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_QUARTERLY => [
'fromDate' => $now->copy()->subMonths(3)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
default => throw new InvalidArgumentException("Unsupported frequency: {$frequency}"),
};
}
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 sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
private function getPayload(AutomatedReportsService $automatedReportsService)
{
$reportResult = AutomatedReportResult::find(269);
$automatedReport = $reportResult->getReport();
$activityIds = [1,2,3];
$payload = $automatedReportsService->getAskJiminnyGenerateReportPayload(
automatedReport: $automatedReport,
reportResult: $reportResult,
activityIds: $activityIds,
);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$payload ' . PHP_EOL . print_r($payload, true));
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
7
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Services\UserPilot;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Support\Facades\Http;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Partner;
use Jiminny\Models\Team;
use Jiminny\Models\User;
class UserPilotClient
{
private const API_ENDPOINT = 'https://api.userpilot.io/v1/';
private const ANALYTICS_ENDPOINT = 'https://analytex.userpilot.io/v1/';
private function createRequest(): PendingRequest
{
return Http::withHeaders([
'X-API-Version' => '2020-09-22',
'Authorization' => 'Token ' . config('services.userpilot.key'),
]);
}
public function track(User $user, string $event, array $payload = []): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'track', [
'event_name' => $event,
'user_id' => $user->getUuid(),
'metadata' => $payload,
]);
}
public function upsertUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$companyMetadata = $this->getCompanyMetadata($user->getTeam());
$companyMetadata['id'] = $user->getTeam()->getUuid();
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'identify', [
'user_id' => $user->getUuid(),
'metadata' => [
'name' => $user->name,
'first_name' => $user->getFirstName(),
'position' => $user->job ? $user->job->name : null,
'email' => $user->getEmailAddress(),
'created_at' => $user->getCreatedAt()->unix(),
'is_admin' => $user->hasRole(User::ROLE_ADMIN),
'is_manager' => $user->hasRole(User::ROLE_MANAGER),
'is_owner' => $user->isTeamOwner(),
'is_insights' => $user->hasRole(User::ROLE_ANALYST),
'is_recorder' => $user->hasRole(User::ROLE_RECORDER),
'is_jiminny_voice' => $user->hasRole(User::ROLE_RECORDER_AND_VOICE),
'is_listener' => $user->hasRole(User::ROLE_LISTENER),
'license' => null,
'team' => $user->group ? $user->group->name : null,
'language' => $user->getLanguage(),
'email_sync' => $user->isSyncEmailEnabled(),
],
'company' => $companyMetadata,
]);
}
public function upsertCompany(Team $team): void
{
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'companies/identify', [
'company_id' => $team->getUuid(),
'metadata' => $this->getCompanyMetadata($team),
]);
}
private function getCompanyMetadata(Team $team): array
{
return [
'created_at' => $team->getCreatedAt()->unix(),
'name' => $team->getName(),
'region' => config('jiminny.deploy_region'),
'crm' => $team->getCrmConfiguration()->getProviderName(),
'crm_installed_app_version' => $team->getCrmConfiguration()->getInstalledAppVersion(),
'calendar' => $team->getCalendarProvider(),
'notification_provider' => $team->getNotificationProvider(),
'has_jiminny_voice' => $team->hasFeature(FeatureEnum::DIALER),
'tier' => $team->getTier()?->getTitle(),
];
}
public function deleteUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'users', [
'users' => [$user->getUuid()],
]);
}
public function deleteCompany(Team $team): void
{
if ($this->shouldRequest($team) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'companies', [
'companies' => [$team->getUuid()],
]);
}
public function shouldRequest(Team $team): bool
{
return config('services.userpilot.key') !== null && $team->getPartnerId() === Partner::PARTNER_DEFAULT;
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
PhpStorm
|
faVsco.js – JiminnyDebugCommand.php
|
NULL
|
77271
|
|
Project: faVsco.js, menu
JY-20738-debug-AJ-trackin Project: faVsco.js, menu
JY-20738-debug-AJ-tracking-UP, menu
Start Listening for PHP Debug Connections
ReportControllerTest
Run 'ReportControllerTest'
Debug 'ReportControllerTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
3
115
4
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use InvalidArgumentException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateAskJiminnyReportJob;
use Jiminny\Jobs\AutomatedReports\SendReportMailJob;
use Jiminny\Jobs\JobDispatcherInterface;
use Jiminny\Models\Activity;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Services\Activity\CrmOwnerResolver;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\UserPilot\UserPilotClient;
/**
* Class JiminnyDebugCommand
*
* @package Jiminny\Console\Commands
*/
class JiminnyDebugCommand extends Command
{
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';
protected $signature = 'jiminny:debug';
public function handle(
JobDispatcherInterface $jobDispatcher,
AutomatedReportsService $automatedReportsService,
AutomatedReportsRepository $automatedReportsRepository,
UserPilotClient $userPilotClient
): void {
$user = User::find(143);
// $count = $automatedReportsRepository->countUserReports($user);
// $this->info("Count: {$count}");
// $count = $automatedReportsRepository->countAllUserReports($user);
// $this->info("All count: {$count}");
$payload = [
'report_type' => 'ask_jiminny',
'frequency' => 'weekly',
];
$userPilotClient->track($user, 'ask-jiminny-report-generated', $payload);
exit(1);
$now = Carbon::now()->subDay(1);
$this->info("Now: {$now->toDateTimeString()}");
$weekStart = Carbon::getWeekStartsAt();
$this->info("Now: {$weekStart}");
// $from = $now->copy()->previousWeekday()->startOfDay();
// $to = $now->copy()->previousWeekday()->endOfDay();
// $fromOld = $now->copy()->subWeeks(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subWeek()->startOfWeek();
// $toNew = $now->copy()->subWeek()->endOfWeek();
// $fromOld = $now->copy()->subMonths(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
// $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
$fromOld = $now->copy()->subMonths(3)->startOfDay();
$toOld = $now->copy()->subDay()->endOfDay();
$fromNew = $now->copy()->subQuarterNoOverflow()->startOfQuarter();
$toNew = $now->copy()->subQuarterNoOverflow()->endOfQuarter();
$this->info("From old: {$fromOld->toDateTimeString()}");
$this->info("To old: {$toOld->toDateTimeString()}");
$this->info("From new: {$fromNew->toDateTimeString()}");
$this->info("To new: {$toNew->toDateTimeString()}");
exit(1);
$report = AutomatedReport::find(71);
$job = new RequestGenerateAskJiminnyReportJob($report->getUuid());
$jobDispatcher->dispatch($job);
exit(1);
// $this->formatDate($jobDispatcher);
// $this->sendMail($jobDispatcher, $automatedReportsService);
// $this->crmService();
$this->getPayload($automatedReportsService);
exit(1);
}
private function crmService()
{
$activity = Activity::find(418141);
$team = Team::find(19);
$config = $team->getCrmConfiguration();
$crmResolver = app(CrmOwnerResolver::class, [
'team' => $team,
'integrationAdmin' => $team->getOwner(),
'providerSlug' => $config->getProviderName(),
]);
$crmService = $crmResolver->prepareCrmService();
$crmService->createTranscriptNotes($activity);
}
private function sendMail(JobDispatcherInterface $jobDispatcher, AutomatedReportsService $automatedReportsService)
{
$reportUuid = '';
// $report = $automatedReportsService->getReportResult($reportUuid);
$report = AutomatedReportResult::find(275);
$validRecipients = $automatedReportsService->getValidRecipientUsers(
$report->getReport(),
includeJiminny: true,
);
$recipient = $validRecipients[0];
$fileName = $automatedReportsService->getReportFileName($report);
$typeName = $report->getReport()->getCustomName()
?? $automatedReportsService->getReportTypeName($report);
$teamsName = $automatedReportsService->getReportTeamsName($report);
$periodName = $automatedReportsService->getReportPeriodName($report);
$s3Path = $automatedReportsService->getMediaPath($report);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$fileName ' . PHP_EOL . print_r($fileName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$typeName ' . PHP_EOL . print_r($typeName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$teamsName ' . PHP_EOL . print_r($teamsName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$periodName ' . PHP_EOL . print_r($periodName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$s3Path ' . PHP_EOL . print_r($s3Path, true));
$jobDispatcher->dispatch(
new SendReportMailJob(
reportUuid: $report->getUuid(),
s3Path: $s3Path,
recipientEmail: $recipient['email'],
recipientName: $recipient['name'] ?? null,
fileName: $fileName,
typeName: $typeName,
teamsName: $teamsName,
periodName: $periodName,
isAskJiminny: true,
)
);
exit(1);
}
private function formatDate(JobDispatcherInterface $jobDispatcher): void
{
$customName = 'Custom report name';
// $frequency = self::FREQUENCY_DAILY;
// $frequency = self::FREQUENCY_WEEKLY;
$frequency = self::FREQUENCY_MONTHLY;
// $frequency = self::FREQUENCY_QUARTERLY;
// $frequency = self::FREQUENCY_ONE_OFF;
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
$periodName = $this->formatReportPeriodName($frequency, $from, $to);
$filenameSuffix = null;
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
$result = $this->sanitizeFileName("{$customName} - {$periodName}");
}
$this->info($result);
}
public function calculateFromAndToDatePeriod(
string $frequency,
?Carbon $fromDate = null,
?Carbon $toDate = null
): array {
if ($frequency === self::FREQUENCY_ONE_OFF) {
return [
'fromDate' => $fromDate,
'toDate' => $toDate,
];
}
$now = Carbon::now();
return match ($frequency) {
self::FREQUENCY_DAILY => [
'fromDate' => $now->copy()->subDay()->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_WEEKLY => [
'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_MONTHLY => [
'fromDate' => $now->copy()->subMonths(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_QUARTERLY => [
'fromDate' => $now->copy()->subMonths(3)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
default => throw new InvalidArgumentException("Unsupported frequency: {$frequency}"),
};
}
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 sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
private function getPayload(AutomatedReportsService $automatedReportsService)
{
$reportResult = AutomatedReportResult::find(269);
$automatedReport = $reportResult->getReport();
$activityIds = [1,2,3];
$payload = $automatedReportsService->getAskJiminnyGenerateReportPayload(
automatedReport: $automatedReport,
reportResult: $reportResult,
activityIds: $activityIds,
);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$payload ' . PHP_EOL . print_r($payload, true));
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
7
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Services\UserPilot;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Support\Facades\Http;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Partner;
use Jiminny\Models\Team;
use Jiminny\Models\User;
class UserPilotClient
{
private const API_ENDPOINT = 'https://api.userpilot.io/v1/';
private const ANALYTICS_ENDPOINT = 'https://analytex.userpilot.io/v1/';
private function createRequest(): PendingRequest
{
return Http::withHeaders([
'X-API-Version' => '2020-09-22',
'Authorization' => 'Token ' . config('services.userpilot.key'),
]);
}
public function track(User $user, string $event, array $payload = []): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'track', [
'event_name' => $event,
'user_id' => $user->getUuid(),
'metadata' => $payload,
]);
}
public function upsertUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$companyMetadata = $this->getCompanyMetadata($user->getTeam());
$companyMetadata['id'] = $user->getTeam()->getUuid();
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'identify', [
'user_id' => $user->getUuid(),
'metadata' => [
'name' => $user->name,
'first_name' => $user->getFirstName(),
'position' => $user->job ? $user->job->name : null,
'email' => $user->getEmailAddress(),
'created_at' => $user->getCreatedAt()->unix(),
'is_admin' => $user->hasRole(User::ROLE_ADMIN),
'is_manager' => $user->hasRole(User::ROLE_MANAGER),
'is_owner' => $user->isTeamOwner(),
'is_insights' => $user->hasRole(User::ROLE_ANALYST),
'is_recorder' => $user->hasRole(User::ROLE_RECORDER),
'is_jiminny_voice' => $user->hasRole(User::ROLE_RECORDER_AND_VOICE),
'is_listener' => $user->hasRole(User::ROLE_LISTENER),
'license' => null,
'team' => $user->group ? $user->group->name : null,
'language' => $user->getLanguage(),
'email_sync' => $user->isSyncEmailEnabled(),
],
'company' => $companyMetadata,
]);
}
public function upsertCompany(Team $team): void
{
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'companies/identify', [
'company_id' => $team->getUuid(),
'metadata' => $this->getCompanyMetadata($team),
]);
}
private function getCompanyMetadata(Team $team): array
{
return [
'created_at' => $team->getCreatedAt()->unix(),
'name' => $team->getName(),
'region' => config('jiminny.deploy_region'),
'crm' => $team->getCrmConfiguration()->getProviderName(),
'crm_installed_app_version' => $team->getCrmConfiguration()->getInstalledAppVersion(),
'calendar' => $team->getCalendarProvider(),
'notification_provider' => $team->getNotificationProvider(),
'has_jiminny_voice' => $team->hasFeature(FeatureEnum::DIALER),
'tier' => $team->getTier()?->getTitle(),
];
}
public function deleteUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'users', [
'users' => [$user->getUuid()],
]);
}
public function deleteCompany(Team $team): void
{
if ($this->shouldRequest($team) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'companies', [
'companies' => [$team->getUuid()],
]);
}
public function shouldRequest(Team $team): bool
{
return config('services.userpilot.key') !== null && $team->getPartnerId() === Partner::PARTNER_DEFAULT;
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
PhpStorm
|
faVsco.js – JiminnyDebugCommand.php
|
NULL
|
77272
|
|
Project: faVsco.js, menu
JY-20738-debug-AJ-trackin Project: faVsco.js, menu
JY-20738-debug-AJ-tracking-UP, menu
Start Listening for PHP Debug Connections
ReportControllerTest
Run 'ReportControllerTest'
Debug 'ReportControllerTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
3
115
4
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use InvalidArgumentException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateAskJiminnyReportJob;
use Jiminny\Jobs\AutomatedReports\SendReportMailJob;
use Jiminny\Jobs\JobDispatcherInterface;
use Jiminny\Models\Activity;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Services\Activity\CrmOwnerResolver;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\UserPilot\UserPilotClient;
/**
* Class JiminnyDebugCommand
*
* @package Jiminny\Console\Commands
*/
class JiminnyDebugCommand extends Command
{
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';
protected $signature = 'jiminny:debug';
public function handle(
JobDispatcherInterface $jobDispatcher,
AutomatedReportsService $automatedReportsService,
AutomatedReportsRepository $automatedReportsRepository,
UserPilotClient $userPilotClient
): void {
$user = User::find(143);
// $count = $automatedReportsRepository->countUserReports($user);
// $this->info("Count: {$count}");
// $count = $automatedReportsRepository->countAllUserReports($user);
// $this->info("All count: {$count}");
$payload = [
'report_type' => 'ask_jiminny',
'frequency' => 'weekly',
];
$userPilotClient->track($user, 'ask-jiminny-report-generated', $payload);
exit(1);
$now = Carbon::now()->subDay(1);
$this->info("Now: {$now->toDateTimeString()}");
$weekStart = Carbon::getWeekStartsAt();
$this->info("Now: {$weekStart}");
// $from = $now->copy()->previousWeekday()->startOfDay();
// $to = $now->copy()->previousWeekday()->endOfDay();
// $fromOld = $now->copy()->subWeeks(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subWeek()->startOfWeek();
// $toNew = $now->copy()->subWeek()->endOfWeek();
// $fromOld = $now->copy()->subMonths(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
// $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
$fromOld = $now->copy()->subMonths(3)->startOfDay();
$toOld = $now->copy()->subDay()->endOfDay();
$fromNew = $now->copy()->subQuarterNoOverflow()->startOfQuarter();
$toNew = $now->copy()->subQuarterNoOverflow()->endOfQuarter();
$this->info("From old: {$fromOld->toDateTimeString()}");
$this->info("To old: {$toOld->toDateTimeString()}");
$this->info("From new: {$fromNew->toDateTimeString()}");
$this->info("To new: {$toNew->toDateTimeString()}");
exit(1);
$report = AutomatedReport::find(71);
$job = new RequestGenerateAskJiminnyReportJob($report->getUuid());
$jobDispatcher->dispatch($job);
exit(1);
// $this->formatDate($jobDispatcher);
// $this->sendMail($jobDispatcher, $automatedReportsService);
// $this->crmService();
$this->getPayload($automatedReportsService);
exit(1);
}
private function crmService()
{
$activity = Activity::find(418141);
$team = Team::find(19);
$config = $team->getCrmConfiguration();
$crmResolver = app(CrmOwnerResolver::class, [
'team' => $team,
'integrationAdmin' => $team->getOwner(),
'providerSlug' => $config->getProviderName(),
]);
$crmService = $crmResolver->prepareCrmService();
$crmService->createTranscriptNotes($activity);
}
private function sendMail(JobDispatcherInterface $jobDispatcher, AutomatedReportsService $automatedReportsService)
{
$reportUuid = '';
// $report = $automatedReportsService->getReportResult($reportUuid);
$report = AutomatedReportResult::find(275);
$validRecipients = $automatedReportsService->getValidRecipientUsers(
$report->getReport(),
includeJiminny: true,
);
$recipient = $validRecipients[0];
$fileName = $automatedReportsService->getReportFileName($report);
$typeName = $report->getReport()->getCustomName()
?? $automatedReportsService->getReportTypeName($report);
$teamsName = $automatedReportsService->getReportTeamsName($report);
$periodName = $automatedReportsService->getReportPeriodName($report);
$s3Path = $automatedReportsService->getMediaPath($report);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$fileName ' . PHP_EOL . print_r($fileName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$typeName ' . PHP_EOL . print_r($typeName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$teamsName ' . PHP_EOL . print_r($teamsName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$periodName ' . PHP_EOL . print_r($periodName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$s3Path ' . PHP_EOL . print_r($s3Path, true));
$jobDispatcher->dispatch(
new SendReportMailJob(
reportUuid: $report->getUuid(),
s3Path: $s3Path,
recipientEmail: $recipient['email'],
recipientName: $recipient['name'] ?? null,
fileName: $fileName,
typeName: $typeName,
teamsName: $teamsName,
periodName: $periodName,
isAskJiminny: true,
)
);
exit(1);
}
private function formatDate(JobDispatcherInterface $jobDispatcher): void
{
$customName = 'Custom report name';
// $frequency = self::FREQUENCY_DAILY;
// $frequency = self::FREQUENCY_WEEKLY;
$frequency = self::FREQUENCY_MONTHLY;
// $frequency = self::FREQUENCY_QUARTERLY;
// $frequency = self::FREQUENCY_ONE_OFF;
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
$periodName = $this->formatReportPeriodName($frequency, $from, $to);
$filenameSuffix = null;
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
$result = $this->sanitizeFileName("{$customName} - {$periodName}");
}
$this->info($result);
}
public function calculateFromAndToDatePeriod(
string $frequency,
?Carbon $fromDate = null,
?Carbon $toDate = null
): array {
if ($frequency === self::FREQUENCY_ONE_OFF) {
return [
'fromDate' => $fromDate,
'toDate' => $toDate,
];
}
$now = Carbon::now();
return match ($frequency) {
self::FREQUENCY_DAILY => [
'fromDate' => $now->copy()->subDay()->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_WEEKLY => [
'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_MONTHLY => [
'fromDate' => $now->copy()->subMonths(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_QUARTERLY => [
'fromDate' => $now->copy()->subMonths(3)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
default => throw new InvalidArgumentException("Unsupported frequency: {$frequency}"),
};
}
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 sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
private function getPayload(AutomatedReportsService $automatedReportsService)
{
$reportResult = AutomatedReportResult::find(269);
$automatedReport = $reportResult->getReport();
$activityIds = [1,2,3];
$payload = $automatedReportsService->getAskJiminnyGenerateReportPayload(
automatedReport: $automatedReport,
reportResult: $reportResult,
activityIds: $activityIds,
);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$payload ' . PHP_EOL . print_r($payload, true));
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
7
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Services\UserPilot;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Support\Facades\Http;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Partner;
use Jiminny\Models\Team;
use Jiminny\Models\User;
class UserPilotClient
{
private const API_ENDPOINT = 'https://api.userpilot.io/v1/';
private const ANALYTICS_ENDPOINT = 'https://analytex.userpilot.io/v1/';
private function createRequest(): PendingRequest
{
return Http::withHeaders([
'X-API-Version' => '2020-09-22',
'Authorization' => 'Token ' . config('services.userpilot.key'),
]);
}
public function track(User $user, string $event, array $payload = []): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'track', [
'event_name' => $event,
'user_id' => $user->getUuid(),
'metadata' => $payload,
]);
}
public function upsertUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$companyMetadata = $this->getCompanyMetadata($user->getTeam());
$companyMetadata['id'] = $user->getTeam()->getUuid();
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'identify', [
'user_id' => $user->getUuid(),
'metadata' => [
'name' => $user->name,
'first_name' => $user->getFirstName(),
'position' => $user->job ? $user->job->name : null,
'email' => $user->getEmailAddress(),
'created_at' => $user->getCreatedAt()->unix(),
'is_admin' => $user->hasRole(User::ROLE_ADMIN),
'is_manager' => $user->hasRole(User::ROLE_MANAGER),
'is_owner' => $user->isTeamOwner(),
'is_insights' => $user->hasRole(User::ROLE_ANALYST),
'is_recorder' => $user->hasRole(User::ROLE_RECORDER),
'is_jiminny_voice' => $user->hasRole(User::ROLE_RECORDER_AND_VOICE),
'is_listener' => $user->hasRole(User::ROLE_LISTENER),
'license' => null,
'team' => $user->group ? $user->group->name : null,
'language' => $user->getLanguage(),
'email_sync' => $user->isSyncEmailEnabled(),
],
'company' => $companyMetadata,
]);
}
public function upsertCompany(Team $team): void
{
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'companies/identify', [
'company_id' => $team->getUuid(),
'metadata' => $this->getCompanyMetadata($team),
]);
}
private function getCompanyMetadata(Team $team): array
{
return [
'created_at' => $team->getCreatedAt()->unix(),
'name' => $team->getName(),
'region' => config('jiminny.deploy_region'),
'crm' => $team->getCrmConfiguration()->getProviderName(),
'crm_installed_app_version' => $team->getCrmConfiguration()->getInstalledAppVersion(),
'calendar' => $team->getCalendarProvider(),
'notification_provider' => $team->getNotificationProvider(),
'has_jiminny_voice' => $team->hasFeature(FeatureEnum::DIALER),
'tier' => $team->getTier()?->getTitle(),
];
}
public function deleteUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'users', [
'users' => [$user->getUuid()],
]);
}
public function deleteCompany(Team $team): void
{
if ($this->shouldRequest($team) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'companies', [
'companies' => [$team->getUuid()],
]);
}
public function shouldRequest(Team $team): bool
{
return config('services.userpilot.key') !== null && $team->getPartnerId() === Partner::PARTNER_DEFAULT;
}
}
Project
Project
New File or Directory…...
|
PhpStorm
|
faVsco.js – JiminnyDebugCommand.php
|
NULL
|
77273
|
|
Project: faVsco.js, menu
JY-20738-debug-AJ-trackin Project: faVsco.js, menu
JY-20738-debug-AJ-tracking-UP, menu
Start Listening for PHP Debug Connections
ReportControllerTest
Run 'ReportControllerTest'
Debug 'ReportControllerTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
3
115
4
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use InvalidArgumentException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateAskJiminnyReportJob;
use Jiminny\Jobs\AutomatedReports\SendReportMailJob;
use Jiminny\Jobs\JobDispatcherInterface;
use Jiminny\Models\Activity;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Services\Activity\CrmOwnerResolver;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\UserPilot\UserPilotClient;
/**
* Class JiminnyDebugCommand
*
* @package Jiminny\Console\Commands
*/
class JiminnyDebugCommand extends Command
{
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';
protected $signature = 'jiminny:debug';
public function handle(
JobDispatcherInterface $jobDispatcher,
AutomatedReportsService $automatedReportsService,
AutomatedReportsRepository $automatedReportsRepository,
UserPilotClient $userPilotClient
): void {
$user = User::find(143);
// $count = $automatedReportsRepository->countUserReports($user);
// $this->info("Count: {$count}");
// $count = $automatedReportsRepository->countAllUserReports($user);
// $this->info("All count: {$count}");
$payload = [
'report_type' => 'ask_jiminny',
'frequency' => 'weekly',
];
$userPilotClient->track($user, 'ask-jiminny-report-generated', $payload);
exit(1);
$now = Carbon::now()->subDay(1);
$this->info("Now: {$now->toDateTimeString()}");
$weekStart = Carbon::getWeekStartsAt();
$this->info("Now: {$weekStart}");
// $from = $now->copy()->previousWeekday()->startOfDay();
// $to = $now->copy()->previousWeekday()->endOfDay();
// $fromOld = $now->copy()->subWeeks(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subWeek()->startOfWeek();
// $toNew = $now->copy()->subWeek()->endOfWeek();
// $fromOld = $now->copy()->subMonths(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
// $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
$fromOld = $now->copy()->subMonths(3)->startOfDay();
$toOld = $now->copy()->subDay()->endOfDay();
$fromNew = $now->copy()->subQuarterNoOverflow()->startOfQuarter();
$toNew = $now->copy()->subQuarterNoOverflow()->endOfQuarter();
$this->info("From old: {$fromOld->toDateTimeString()}");
$this->info("To old: {$toOld->toDateTimeString()}");
$this->info("From new: {$fromNew->toDateTimeString()}");
$this->info("To new: {$toNew->toDateTimeString()}");
exit(1);
$report = AutomatedReport::find(71);
$job = new RequestGenerateAskJiminnyReportJob($report->getUuid());
$jobDispatcher->dispatch($job);
exit(1);
// $this->formatDate($jobDispatcher);
// $this->sendMail($jobDispatcher, $automatedReportsService);
// $this->crmService();
$this->getPayload($automatedReportsService);
exit(1);
}
private function crmService()
{
$activity = Activity::find(418141);
$team = Team::find(19);
$config = $team->getCrmConfiguration();
$crmResolver = app(CrmOwnerResolver::class, [
'team' => $team,
'integrationAdmin' => $team->getOwner(),
'providerSlug' => $config->getProviderName(),
]);
$crmService = $crmResolver->prepareCrmService();
$crmService->createTranscriptNotes($activity);
}
private function sendMail(JobDispatcherInterface $jobDispatcher, AutomatedReportsService $automatedReportsService)
{
$reportUuid = '';
// $report = $automatedReportsService->getReportResult($reportUuid);
$report = AutomatedReportResult::find(275);
$validRecipients = $automatedReportsService->getValidRecipientUsers(
$report->getReport(),
includeJiminny: true,
);
$recipient = $validRecipients[0];
$fileName = $automatedReportsService->getReportFileName($report);
$typeName = $report->getReport()->getCustomName()
?? $automatedReportsService->getReportTypeName($report);
$teamsName = $automatedReportsService->getReportTeamsName($report);
$periodName = $automatedReportsService->getReportPeriodName($report);
$s3Path = $automatedReportsService->getMediaPath($report);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$fileName ' . PHP_EOL . print_r($fileName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$typeName ' . PHP_EOL . print_r($typeName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$teamsName ' . PHP_EOL . print_r($teamsName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$periodName ' . PHP_EOL . print_r($periodName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$s3Path ' . PHP_EOL . print_r($s3Path, true));
$jobDispatcher->dispatch(
new SendReportMailJob(
reportUuid: $report->getUuid(),
s3Path: $s3Path,
recipientEmail: $recipient['email'],
recipientName: $recipient['name'] ?? null,
fileName: $fileName,
typeName: $typeName,
teamsName: $teamsName,
periodName: $periodName,
isAskJiminny: true,
)
);
exit(1);
}
private function formatDate(JobDispatcherInterface $jobDispatcher): void
{
$customName = 'Custom report name';
// $frequency = self::FREQUENCY_DAILY;
// $frequency = self::FREQUENCY_WEEKLY;
$frequency = self::FREQUENCY_MONTHLY;
// $frequency = self::FREQUENCY_QUARTERLY;
// $frequency = self::FREQUENCY_ONE_OFF;
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
$periodName = $this->formatReportPeriodName($frequency, $from, $to);
$filenameSuffix = null;
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
$result = $this->sanitizeFileName("{$customName} - {$periodName}");
}
$this->info($result);
}
public function calculateFromAndToDatePeriod(
string $frequency,
?Carbon $fromDate = null,
?Carbon $toDate = null
): array {
if ($frequency === self::FREQUENCY_ONE_OFF) {
return [
'fromDate' => $fromDate,
'toDate' => $toDate,
];
}
$now = Carbon::now();
return match ($frequency) {
self::FREQUENCY_DAILY => [
'fromDate' => $now->copy()->subDay()->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_WEEKLY => [
'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_MONTHLY => [
'fromDate' => $now->copy()->subMonths(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_QUARTERLY => [
'fromDate' => $now->copy()->subMonths(3)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
default => throw new InvalidArgumentException("Unsupported frequency: {$frequency}"),
};
}
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 sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
private function getPayload(AutomatedReportsService $automatedReportsService)
{
$reportResult = AutomatedReportResult::find(269);
$automatedReport = $reportResult->getReport();
$activityIds = [1,2,3];
$payload = $automatedReportsService->getAskJiminnyGenerateReportPayload(
automatedReport: $automatedReport,
reportResult: $reportResult,
activityIds: $activityIds,
);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$payload ' . PHP_EOL . print_r($payload, true));
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
7
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Services\UserPilot;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Support\Facades\Http;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Partner;
use Jiminny\Models\Team;
use Jiminny\Models\User;
class UserPilotClient
{
private const API_ENDPOINT = 'https://api.userpilot.io/v1/';
private const ANALYTICS_ENDPOINT = 'https://analytex.userpilot.io/v1/';
private function createRequest(): PendingRequest
{
return Http::withHeaders([
'X-API-Version' => '2020-09-22',
'Authorization' => 'Token ' . config('services.userpilot.key'),
]);
}
public function track(User $user, string $event, array $payload = []): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'track', [
'event_name' => $event,
'user_id' => $user->getUuid(),
'metadata' => $payload,
]);
}
public function upsertUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$companyMetadata = $this->getCompanyMetadata($user->getTeam());
$companyMetadata['id'] = $user->getTeam()->getUuid();
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'identify', [
'user_id' => $user->getUuid(),
'metadata' => [
'name' => $user->name,
'first_name' => $user->getFirstName(),
'position' => $user->job ? $user->job->name : null,
'email' => $user->getEmailAddress(),
'created_at' => $user->getCreatedAt()->unix(),
'is_admin' => $user->hasRole(User::ROLE_ADMIN),
'is_manager' => $user->hasRole(User::ROLE_MANAGER),
'is_owner' => $user->isTeamOwner(),
'is_insights' => $user->hasRole(User::ROLE_ANALYST),
'is_recorder' => $user->hasRole(User::ROLE_RECORDER),
'is_jiminny_voice' => $user->hasRole(User::ROLE_RECORDER_AND_VOICE),
'is_listener' => $user->hasRole(User::ROLE_LISTENER),
'license' => null,
'team' => $user->group ? $user->group->name : null,
'language' => $user->getLanguage(),
'email_sync' => $user->isSyncEmailEnabled(),
],
'company' => $companyMetadata,
]);
}
public function upsertCompany(Team $team): void
{
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'companies/identify', [
'company_id' => $team->getUuid(),
'metadata' => $this->getCompanyMetadata($team),
]);
}
private function getCompanyMetadata(Team $team): array
{
return [
'created_at' => $team->getCreatedAt()->unix(),
'name' => $team->getName(),
'region' => config('jiminny.deploy_region'),
'crm' => $team->getCrmConfiguration()->getProviderName(),
'crm_installed_app_version' => $team->getCrmConfiguration()->getInstalledAppVersion(),
'calendar' => $team->getCalendarProvider(),
'notification_provider' => $team->getNotificationProvider(),
'has_jiminny_voice' => $team->hasFeature(FeatureEnum::DIALER),
'tier' => $team->getTier()?->getTitle(),
];
}
public function deleteUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'users', [
'users' => [$user->getUuid()],
]);
}
public function deleteCompany(Team $team): void
{
if ($this->shouldRequest($team) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'companies', [
'companies' => [$team->getUuid()],
]);
}
public function shouldRequest(Team $team): bool
{
return config('services.userpilot.key') !== null && $team->getPartnerId() === Partner::PARTNER_DEFAULT;
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
PhpStorm
|
faVsco.js – JiminnyDebugCommand.php
|
NULL
|
77274
|
|
Last login: Thu Apr 23 14:01:28 on ttys007
Poetry Last login: Thu Apr 23 14:01:28 on ttys007
Poetry could not find a pyproject.toml file in /Users/lukas/jiminny/app or its parents
Poetry could not find a pyproject.toml file in /Users/lukas/jiminny/app or its parents
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ git status
On branch JY-20157-AJ-report-not-send-notification
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .env.local
modified: app/Console/Commands/JiminnyDebugCommand.php
modified: app/Http/Controllers/API/ActivityController.php
modified: app/Jobs/Team/SyncToIntercom.php
modified: app/Services/PlaybackService.php
modified: config/logging.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
.env.nikilocal
.env.other
WEBHOOK_FILTERING_IMPLEMENTATION.md
app/Console/Commands/Crm/Hubspot/SimulateWebhooksCommand.php
app/Console/Commands/Reports/CreateMockAskJiminnyReportResultCommand.php
ids.txt
raw_sql_query.sql
tests/Unit/Policies/CanAccessAiReportsTest.php
no changes added to commit (use "git add" and/or "git commit -a")
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ git status
On branch JY-20372-ai-reports-promotion-pages
Your branch is up to date with 'origin/JY-20372-ai-reports-promotion-pages'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .env.local
modified: app/Console/Commands/JiminnyDebugCommand.php
modified: app/Http/Controllers/API/ActivityController.php
modified: app/Jobs/Team/SyncToIntercom.php
modified: app/Services/PlaybackService.php
modified: config/logging.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
.env.nikilocal
.env.other
WEBHOOK_FILTERING_IMPLEMENTATION.md
app/Console/Commands/Crm/Hubspot/SimulateWebhooksCommand.php
app/Console/Commands/Reports/CreateMockAskJiminnyReportResultCommand.php
ids.txt
raw_sql_query.sql
tests/Unit/Policies/CanAccessAiReportsTest.php
no changes added to commit (use "git add" and/or "git commit -a")
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20372-ai-reports-promotion-pages) $ git pull
remote: Enumerating objects: 1015, done.
remote: Counting objects: 100% (262/262), done.
remote: Compressing objects: 100% (143/143), done.
remote: Total 1015 (delta 167), reused 129 (delta 119), pack-reused 753 (from 3)
Receiving objects: 100% (1015/1015), 851.14 KiB | 2.09 MiB/s, done.
Resolving deltas: 100% (613/613), completed with 65 local objects.
From github.com:jiminny/app
c3c8d86b22..68bb20c72a JY-20372-ai-reports-promotion-pages -> origin/JY-20372-ai-reports-promotion-pages
3ac71c265a..595c95b7e0 JY-19995-delete-leftover-tracks-command -> origin/JY-19995-delete-leftover-tracks-command
* [new branch] JY-20352-sync-opportunities-without-a-local-owner-user-id-is-null -> origin/JY-20352-sync-opportunities-without-a-local-owner-user-id-is-null
* [new branch] JY-20478-stop-sync-calendar-emails -> origin/JY-20478-stop-sync-calendar-emails
d4d05c775b..b11048beed JY-20541-cleanup-stale-tasks-and-events -> origin/JY-20541-cleanup-stale-tasks-and-events
10d290c778..a250abe939 JY-20663-partner-rockeed -> origin/JY-20663-partner-rockeed
* [new branch] JY-20713-activity-sync-job-restart -> origin/JY-20713-activity-sync-job-restart
242cf1b554..96a22e59f2 JY-9712-change-forever-nudges-to-1-year-expiration -> origin/JY-9712-change-forever-nudges-to-1-year-expiration
* [new branch] fix-close-missing-logger-error -> origin/fix-close-missing-logger-error
0dd5b23990..60fa1787c1 master -> origin/master
f044edca5b..e7e0e50b27 secfix/npm-20260416 -> origin/secfix/npm-20260416
* [new branch] secfix/npm-20260423 -> origin/secfix/npm-20260423
Updating c3c8d86b22..68bb20c72a
Fast-forward
Makefile | 5 +
app/Component/Activity/Services/UpdateActivityService.php | 5 +
app/Component/ActivitySearch/FilterDefinition/ActivityUpdatedDate.php | 7 +-
app/Component/ActivitySearch/Service/ActivitySearch.php | 15 ++
app/Component/AiCallScoring/Services/GenerateAiCallScoringService.php | 6 +
app/Component/AiCallScoring/Services/GetAiCallScoringService.php | 5 +-
app/Component/AiCallScoring/Transformers/AiCallScoringTransformer.php | 2 +-
app/Component/ProphetAi/ProphetClient.php | 5 +
app/Console/Commands/Crm/SyncHubspotObjects.php | 84 +++++++++++
app/Console/Commands/Crm/SyncObjects.php | 82 ++++++-----
app/Console/Commands/Crm/Traits/SyncObjectsCommandTrait.php | 81 +++++++++++
app/Console/Commands/Reports/AutomatedReportsCommand.php | 91 +++++++++++-
app/Console/Commands/Reports/AutomatedReportsSendCommand.php | 40 +++++-
app/Console/Kernel.php | 4 +
app/Contracts/Services/Crm/ImportsBusinessProcessesInterface.php | 15 ++
app/Contracts/Services/Crm/Provider/SalesforceInterface.php | 12 +-
app/Contracts/Services/Crm/ServiceInterface.php | 29 ----
app/Contracts/Services/Crm/SyncCrmMetadataInterface.php | 6 +-
app/Events/AutomatedReports/AutomatedReportGenerated.php | 15 ++
app/Http/Controllers/API/CrmController.php | 19 ++-
app/Http/Controllers/API/UserAutomatedReports/UserAutomatedReportsController.php | 33 ++++-
app/Http/Controllers/Internal/WebhookReceiver/HubspotController.php | 2 +-
app/Http/Controllers/Webhook/Hubspot/EventsController.php | 2 +-
app/Http/Controllers/Webhook/Hubspot/ProcessesWebhooksTrait.php | 64 ++++++---
app/Http/Controllers/Webhook/ReportController.php | 5 +
app/Http/Requests/Settings/AiCallScoring/CreateOrUpdateAiScorecardRequest.php | 2 +-
app/Http/Requests/Settings/AiCallScoring/CreateOrUpdateAiScorecardRuleRequest.php | 2 +-
app/Http/Requests/Settings/AiCallScoring/TestAiCallScoringPromptRequest.php | 2 +-
app/Jobs/Activity/SyncActivity.php | 3 +-
app/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJob.php | 210 ++++++++++++++++++++++++++++
app/Jobs/AutomatedReports/SendReportJob.php | 2 +
app/Jobs/AutomatedReports/SendReportMailJob.php | 6 +-
app/Jobs/Crm/SyncActivity.php | 10 ++
app/Jobs/Crm/SyncHubspotObjects.php | 120 ++++++++++++++++
app/Jobs/Crm/SyncObjects.php | 26 ++--
app/Jobs/Crm/SyncTeamMetadata.php | 14 +-
app/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEvent.php | 82 +++++++++++
app/Listeners/Crm/ResolveOwner.php | 21 +--
app/Mail/Reports/ReportWithAttachment.php | 7 +-
app/Models/Ai/AiScorecardRuleRun.php | 4 +-
app/Models/Ai/AiScorecardRun.php | 4 +-
app/Models/Contracts/UserContract.php | 6 +
app/Providers/EventServiceProvider.php | 4 +
app/Repositories/AutomatedReportsRepository.php | 76 +++++++++-
app/Repositories/Crm/CrmEntityRepository.php | 40 ++++++
app/Services/Crm/BaseService.php | 13 --
app/Services/Crm/Bullhorn/BullhornService.php | 21 ---
app/Services/Crm/Close/Service.php | 38 -----
app/Services/Crm/Copper/Service.php | 37 -----
app/Services/Crm/Dummy/Service.php | 25 ----
app/Services/Crm/Hubspot/Service.php | 37 -----
app/Services/Crm/Hubspot/ServiceTraits/OpportunitySyncTrait.php | 174 +++++++++++++++++------
app/Services/Crm/Hubspot/ServiceTraits/SyncCrmEntitiesTrait.php | 27 ++--
app/Services/Crm/IntegrationApp/Service.php | 2 +
app/Services/Crm/IntegrationApp/ServiceTraits/NotSupportedTrait.php | 12 +-
app/Services/Crm/IntegrationApp/ServiceTraits/SyncCrmMetadataTrait.php | 5 -
app/Services/Crm/Pipedrive/Service.php | 43 +-----
app/Services/Crm/Salesforce/Service.php | 13 +-
app/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityService.php | 143 +++++++++++++++++++
app/Services/Kiosk/AutomatedReports/AutomatedReportsService.php | 222 +++++++++++++++++++++++++----
front-end/package.json | 2 +-
front-end/src/__mocks__/kit/endpoints/team-insights.js | 1 +
front-end/src/components/AiReports/AiReports.vue | 9 +-
front-end/src/components/AiReports/GridCells/ActionsCell.vue | 107 +++++++++++---
front-end/src/components/AiReports/GridCells/NameCell.vue | 13 +-
front-end/src/components/AiReports/GridCells/TypeIndicator.vue | 26 ++--
front-end/src/components/AiReports/Manage/CreateDefinition/CreateDefinitionDrawer.vue | 4 +-
front-end/src/components/AiReports/Manage/ExpiringCell.vue | 86 ++++++++++++
front-end/src/components/AiReports/Manage/ManageAiReports.less | 6 +
front-end/src/components/AiReports/Manage/ManageAiReports.vue | 6 +-
front-end/src/components/AiReports/Manage/__tests__/ExpiringCell.spec.js | 116 +++++++++++++++
front-end/src/components/AiReports/Manage/__tests__/ManageAiReports.spec.js | 32 +++--
front-end/src/components/AiReports/Manage/__tests__/__snapshots__/create-definition-drawer.output.html | 83 ++++++++---
front-end/src/components/AiReports/Manage/__tests__/__snapshots__/edit-definition-drawer.output.html | 83 ++++++++---
front-end/src/components/AiReports/Manage/__tests__/__snapshots__/manage-ai-reports.output.html | 83 ++++++++---
front-end/src/components/AiReports/Manage/gridConfig.js | 12 +-
front-end/src/components/AiReports/__tests__/AiReports.spec.js | 45 +++++-
front-end/src/components/AiReports/__tests__/__mocks__/data.js | 49 +++++++
front-end/src/components/AiReports/__tests__/__mocks__/requestHandlers.js | 3 +
front-end/src/components/AiReports/__tests__/__snapshots__/ai-reports.output.html | 319 +++++++++++++++++++++++++++++++++++++++++-
front-end/src/components/AiReports/constants.js | 1 +
front-end/src/components/AiReports/gridConfig.js | 2 +-
front-end/src/components/AiReports/useAiReportsGrid.js | 27 ++++
front-end/src/components/Settings/Kiosk/AutomatedReports/RecipientsCell.vue | 36 ++++-
front-end/src/components/Settings/Kiosk/AutomatedReports/UsersCell.vue | 9 +-
front-end/src/components/Settings/Kiosk/AutomatedReports/__tests__/RecipientsCell.spec.js | 171 ++++++++++++++++++++++
front-end/src/components/Settings/OrgSettings/AiAutomation/CallScoring/ScorecardRuleForm.vue | 2 +-
front-end/src/components/TeamInsights/CoachingFrameworks/AICallScoring/aiCallScoringOverTime.ts | 18 ++-
front-end/src/components/shared/GridView/useOrder.js | 6 +-
front-end/src/components/shared/GridView/usePaginationList.js | 7 +-
front-end/yarn.lock | 8 +-
resources/views/emails/reports/ask-jiminny-report-generated.blade.php | 25 ++++
routes/api.php | 1 +
tests/Unit/Component/Activity/Services/UpdateActivityServiceTest.php | 62 ++++++++
tests/Unit/Component/AiCallScoring/Services/GenerateAiCallScoringServiceTest.php | 13 +-
tests/Unit/Console/Commands/Reports/AutomatedReportsCommandTest.php | 468 ++++++++++++++++++++++++++++++++++++++++++-------------------
tests/Unit/Http/Controllers/Webhook/Hubspot/ProcessesWebhooksTraitTest.php | 5 +-
tests/Unit/Http/Controllers/Webhook/ReportControllerTest.php | 9 +-
tests/Unit/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJobTest.php | 407 +++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Unit/Jobs/Crm/SyncActivityTest.php | 74 +++++++---
tests/Unit/Jobs/Crm/SyncHubspotObjectsTest.php | 455 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Unit/Jobs/Crm/SyncTeamMetadataTest.php | 8 +-
tests/Unit/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEventTest.php | 199 ++++++++++++++++++++++++++
tests/Unit/Listeners/Crm/ResolveOwnerTest.php | 64 ++++-----
tests/Unit/Repositories/AutomatedReportsRepositoryTest.php | 55 ++++++++
tests/Unit/Services/Crm/Copper/ServiceTest.php | 19 ---
tests/Unit/Services/Crm/Hubspot/ServiceTraits/OpportunitySyncTest.php | 74 ++++++----
tests/Unit/Services/Crm/Hubspot/ServiceTraits/SyncCrmEntitiesTraitTest.php | 8 +-
tests/Unit/Services/Crm/IntegrationApp/ServiceTraits/NotSupportedTraitTest.php | 76 ++--------
tests/Unit/Services/Crm/IntegrationApp/ServiceTraits/SyncCrmMetadataTraitTest.php | 5 -
tests/Unit/Services/Crm/Pipedrive/ServiceTest.php | 11 --
tests/Unit/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityServiceTest.php | 430 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Unit/Services/Kiosk/AutomatedReports/AutomatedReportsServiceTest.php | 521 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
113 files changed, 5468 insertions(+), 980 deletions(-)
create mode 100644 app/Console/Commands/Crm/SyncHubspotObjects.php
create mode 100644 app/Console/Commands/Crm/Traits/SyncObjectsCommandTrait.php
create mode 100644 app/Contracts/Services/Crm/ImportsBusinessProcessesInterface.php
create mode 100644 app/Events/AutomatedReports/AutomatedReportGenerated.php
create mode 100644 app/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJob.php
create mode 100644 app/Jobs/Crm/SyncHubspotObjects.php
create mode 100644 app/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEvent.php
create mode 100644 app/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityService.php
create mode 100644 front-end/src/components/AiReports/Manage/ExpiringCell.vue
create mode 100644 front-end/src/components/AiReports/Manage/__tests__/ExpiringCell.spec.js
create mode 100644 front-end/src/components/AiReports/constants.js
create mode 100644 front-end/src/components/AiReports/useAiReportsGrid.js
create mode 100644 front-end/src/components/Settings/Kiosk/AutomatedReports/__tests__/RecipientsCell.spec.js
create mode 100644 resources/views/emails/reports/ask-jiminny-report-generated.blade.php
create mode 100644 tests/Unit/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJobTest.php
create mode 100644 tests/Unit/Jobs/Crm/SyncHubspotObjectsTest.php
create mode 100644 tests/Unit/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEventTest.php
create mode 100644 tests/Unit/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityServiceTest.php
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20372-ai-reports-promotion-pages) $ git status
On branch JY-20372-ai-reports-promotion-pages
Your branch is up to date with 'origin/JY-20372-ai-reports-promotion-pages'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .env.local
modified: app/Console/Commands/JiminnyDebugCommand.php
modified: app/Http/Controllers/API/ActivityController.php
modified: app/Http/Transformers/UserTransformer.php
modified: app/Jobs/Team/SyncToIntercom.php
modified: app/Repositories/AutomatedReportsRepository.php
modified: app/Services/PlaybackService.php
modified: config/logging.php
modified: tests/Unit/Repositories/AutomatedReportsRepositoryTest.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
.env.nikilocal
.env.other
WEBHOOK_FILTERING_IMPLEMENTATION.md
app/Console/Commands/Crm/Hubspot/SimulateWebhooksCommand.php
app/Console/Commands/Reports/CreateMockAskJiminnyReportResultCommand.php
ids.txt
raw_sql_query.sql
tests/Unit/Policies/CanAccessAiReportsTest.php
no changes added to commit (use "git add" and/or "git commit -a")
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20372-ai-reports-promotion-pages) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5613/5613 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
1) app/Console/Commands/JiminnyDebugCommand.php (braces_position, statement_indentation)
---------- begin diff ----------
--- /home/jiminny/app/Console/Commands/JiminnyDebugCommand.php
+++ /home/jiminny/app/Console/Commands/JiminnyDebugCommand.php
@@ -37,15 +37,14 @@
JobDispatcherInterface $jobDispatcher,
AutomatedReportsService $automatedReportsService,
AutomatedReportsRepository $automatedReportsRepository,
- ): void
- {
-// $user = User::find(143);
-// $count = $automatedReportsRepository->countUserReports($user);
-// $this->info("Count: {$count}");
-// $count = $automatedReportsRepository->countAllUserReports($user);
-// $this->info("All count: {$count}");
-//
-// exit(1);
+ ): void {
+ // $user = User::find(143);
+ // $count = $automatedReportsRepository->countUserReports($user);
+ // $this->info("Count: {$count}");
+ // $count = $automatedReportsRepository->countAllUserReports($user);
+ // $this->info("All count: {$count}");
+ //
+ // exit(1);
$now = Carbon::now()->subDay(1);
$this->info("Now: {$now->toDateTimeString()}");
@@ -52,18 +51,18 @@
$weekStart = Carbon::getWeekStartsAt();
$this->info("Now: {$weekStart}");
-// $from = $now->copy()->previousWeekday()->startOfDay();
-// $to = $now->copy()->previousWeekday()->endOfDay();
+ // $from = $now->copy()->previousWeekday()->startOfDay();
+ // $to = $now->copy()->previousWeekday()->endOfDay();
-// $fromOld = $now->copy()->subWeeks(1)->startOfDay();
-// $toOld = $now->copy()->subDay()->endOfDay();
-// $fromNew = $now->copy()->subWeek()->startOfWeek();
-// $toNew = $now->copy()->subWeek()->endOfWeek();
+ // $fromOld = $now->copy()->subWeeks(1)->startOfDay();
+ // $toOld = $now->copy()->subDay()->endOfDay();
+ // $fromNew = $now->copy()->subWeek()->startOfWeek();
+ // $toNew = $now->copy()->subWeek()->endOfWeek();
-// $fromOld = $now->copy()->subMonths(1)->startOfDay();
-// $toOld = $now->copy()->subDay()->endOfDay();
-// $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
-// $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
+ // $fromOld = $now->copy()->subMonths(1)->startOfDay();
+ // $toOld = $now->copy()->subDay()->endOfDay();
+ // $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
+ // $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
$fromOld = $now->copy()->subMonths(3)->startOfDay();
$toOld = $now->copy()->subDay()->endOfDay();
----------- end diff -----------
Fixed 1 of 5613 files in 66.818 seconds, 67.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5616/5616 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Fixed 0 of 5616 files in 65.183 seconds, 60.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ ;xd
docker exec -it docker_lamp_1 bash -c "mv /usr/local/etc/php/conf.d/xdebug.ini ~/xdebug.ini"
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5616/5616 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Fixed 0 of 5616 files in 40.863 seconds, 60.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (master) $ git pull
remote: Enumerating objects: 53, done.
remote: Counting objects: 100% (53/53), done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 53 (delta 33), reused 49 (delta 30), pack-reused 0 (from 0)
Unpacking objects: 100% (53/53), 46.00 KiB | 523.00 KiB/s, done.
From github.com:jiminny/app
b1d5c77ad1..dfc8da14d2 JY-20372-ai-reports-promotion-pages -> origin/JY-20372-ai-reports-promotion-pages
+ 47037d2c29...5138acf14e secfix/npm-20260423 -> origin/secfix/npm-20260423 (forced update)
Already up to date.
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (master) $ co -b JY-20738-debug-AJ-tracking-UP
Switched to a new branch 'JY-20738-debug-AJ-tracking-UP'
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20738-debug-AJ-tracking-UP) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5621/5621 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Fixed 0 of 5621 files in 22.942 seconds, 60.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at https://docs.docker.com/go/debug-cli/
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20738-debug-AJ-tracking-UP) $
DOCKER
Close Tab
DEV (docker)
Close Tab
APP (-zsh)
Close Tab
screenpipe"
Close Tab
-zsh
Close Tab
-zsh
Close Tab
⌥⌘1
APP (-zsh)...
|
iTerm2
|
APP (-zsh)
|
NULL
|
77275
|
|
Last login: Thu Apr 23 14:01:28 on ttys007
Poetry Last login: Thu Apr 23 14:01:28 on ttys007
Poetry could not find a pyproject.toml file in /Users/lukas/jiminny/app or its parents
Poetry could not find a pyproject.toml file in /Users/lukas/jiminny/app or its parents
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ git status
On branch JY-20157-AJ-report-not-send-notification
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .env.local
modified: app/Console/Commands/JiminnyDebugCommand.php
modified: app/Http/Controllers/API/ActivityController.php
modified: app/Jobs/Team/SyncToIntercom.php
modified: app/Services/PlaybackService.php
modified: config/logging.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
.env.nikilocal
.env.other
WEBHOOK_FILTERING_IMPLEMENTATION.md
app/Console/Commands/Crm/Hubspot/SimulateWebhooksCommand.php
app/Console/Commands/Reports/CreateMockAskJiminnyReportResultCommand.php
ids.txt
raw_sql_query.sql
tests/Unit/Policies/CanAccessAiReportsTest.php
no changes added to commit (use "git add" and/or "git commit -a")
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ git status
On branch JY-20372-ai-reports-promotion-pages
Your branch is up to date with 'origin/JY-20372-ai-reports-promotion-pages'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .env.local
modified: app/Console/Commands/JiminnyDebugCommand.php
modified: app/Http/Controllers/API/ActivityController.php
modified: app/Jobs/Team/SyncToIntercom.php
modified: app/Services/PlaybackService.php
modified: config/logging.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
.env.nikilocal
.env.other
WEBHOOK_FILTERING_IMPLEMENTATION.md
app/Console/Commands/Crm/Hubspot/SimulateWebhooksCommand.php
app/Console/Commands/Reports/CreateMockAskJiminnyReportResultCommand.php
ids.txt
raw_sql_query.sql
tests/Unit/Policies/CanAccessAiReportsTest.php
no changes added to commit (use "git add" and/or "git commit -a")
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20372-ai-reports-promotion-pages) $ git pull
remote: Enumerating objects: 1015, done.
remote: Counting objects: 100% (262/262), done.
remote: Compressing objects: 100% (143/143), done.
remote: Total 1015 (delta 167), reused 129 (delta 119), pack-reused 753 (from 3)
Receiving objects: 100% (1015/1015), 851.14 KiB | 2.09 MiB/s, done.
Resolving deltas: 100% (613/613), completed with 65 local objects.
From github.com:jiminny/app
c3c8d86b22..68bb20c72a JY-20372-ai-reports-promotion-pages -> origin/JY-20372-ai-reports-promotion-pages
3ac71c265a..595c95b7e0 JY-19995-delete-leftover-tracks-command -> origin/JY-19995-delete-leftover-tracks-command
* [new branch] JY-20352-sync-opportunities-without-a-local-owner-user-id-is-null -> origin/JY-20352-sync-opportunities-without-a-local-owner-user-id-is-null
* [new branch] JY-20478-stop-sync-calendar-emails -> origin/JY-20478-stop-sync-calendar-emails
d4d05c775b..b11048beed JY-20541-cleanup-stale-tasks-and-events -> origin/JY-20541-cleanup-stale-tasks-and-events
10d290c778..a250abe939 JY-20663-partner-rockeed -> origin/JY-20663-partner-rockeed
* [new branch] JY-20713-activity-sync-job-restart -> origin/JY-20713-activity-sync-job-restart
242cf1b554..96a22e59f2 JY-9712-change-forever-nudges-to-1-year-expiration -> origin/JY-9712-change-forever-nudges-to-1-year-expiration
* [new branch] fix-close-missing-logger-error -> origin/fix-close-missing-logger-error
0dd5b23990..60fa1787c1 master -> origin/master
f044edca5b..e7e0e50b27 secfix/npm-20260416 -> origin/secfix/npm-20260416
* [new branch] secfix/npm-20260423 -> origin/secfix/npm-20260423
Updating c3c8d86b22..68bb20c72a
Fast-forward
Makefile | 5 +
app/Component/Activity/Services/UpdateActivityService.php | 5 +
app/Component/ActivitySearch/FilterDefinition/ActivityUpdatedDate.php | 7 +-
app/Component/ActivitySearch/Service/ActivitySearch.php | 15 ++
app/Component/AiCallScoring/Services/GenerateAiCallScoringService.php | 6 +
app/Component/AiCallScoring/Services/GetAiCallScoringService.php | 5 +-
app/Component/AiCallScoring/Transformers/AiCallScoringTransformer.php | 2 +-
app/Component/ProphetAi/ProphetClient.php | 5 +
app/Console/Commands/Crm/SyncHubspotObjects.php | 84 +++++++++++
app/Console/Commands/Crm/SyncObjects.php | 82 ++++++-----
app/Console/Commands/Crm/Traits/SyncObjectsCommandTrait.php | 81 +++++++++++
app/Console/Commands/Reports/AutomatedReportsCommand.php | 91 +++++++++++-
app/Console/Commands/Reports/AutomatedReportsSendCommand.php | 40 +++++-
app/Console/Kernel.php | 4 +
app/Contracts/Services/Crm/ImportsBusinessProcessesInterface.php | 15 ++
app/Contracts/Services/Crm/Provider/SalesforceInterface.php | 12 +-
app/Contracts/Services/Crm/ServiceInterface.php | 29 ----
app/Contracts/Services/Crm/SyncCrmMetadataInterface.php | 6 +-
app/Events/AutomatedReports/AutomatedReportGenerated.php | 15 ++
app/Http/Controllers/API/CrmController.php | 19 ++-
app/Http/Controllers/API/UserAutomatedReports/UserAutomatedReportsController.php | 33 ++++-
app/Http/Controllers/Internal/WebhookReceiver/HubspotController.php | 2 +-
app/Http/Controllers/Webhook/Hubspot/EventsController.php | 2 +-
app/Http/Controllers/Webhook/Hubspot/ProcessesWebhooksTrait.php | 64 ++++++---
app/Http/Controllers/Webhook/ReportController.php | 5 +
app/Http/Requests/Settings/AiCallScoring/CreateOrUpdateAiScorecardRequest.php | 2 +-
app/Http/Requests/Settings/AiCallScoring/CreateOrUpdateAiScorecardRuleRequest.php | 2 +-
app/Http/Requests/Settings/AiCallScoring/TestAiCallScoringPromptRequest.php | 2 +-
app/Jobs/Activity/SyncActivity.php | 3 +-
app/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJob.php | 210 ++++++++++++++++++++++++++++
app/Jobs/AutomatedReports/SendReportJob.php | 2 +
app/Jobs/AutomatedReports/SendReportMailJob.php | 6 +-
app/Jobs/Crm/SyncActivity.php | 10 ++
app/Jobs/Crm/SyncHubspotObjects.php | 120 ++++++++++++++++
app/Jobs/Crm/SyncObjects.php | 26 ++--
app/Jobs/Crm/SyncTeamMetadata.php | 14 +-
app/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEvent.php | 82 +++++++++++
app/Listeners/Crm/ResolveOwner.php | 21 +--
app/Mail/Reports/ReportWithAttachment.php | 7 +-
app/Models/Ai/AiScorecardRuleRun.php | 4 +-
app/Models/Ai/AiScorecardRun.php | 4 +-
app/Models/Contracts/UserContract.php | 6 +
app/Providers/EventServiceProvider.php | 4 +
app/Repositories/AutomatedReportsRepository.php | 76 +++++++++-
app/Repositories/Crm/CrmEntityRepository.php | 40 ++++++
app/Services/Crm/BaseService.php | 13 --
app/Services/Crm/Bullhorn/BullhornService.php | 21 ---
app/Services/Crm/Close/Service.php | 38 -----
app/Services/Crm/Copper/Service.php | 37 -----
app/Services/Crm/Dummy/Service.php | 25 ----
app/Services/Crm/Hubspot/Service.php | 37 -----
app/Services/Crm/Hubspot/ServiceTraits/OpportunitySyncTrait.php | 174 +++++++++++++++++------
app/Services/Crm/Hubspot/ServiceTraits/SyncCrmEntitiesTrait.php | 27 ++--
app/Services/Crm/IntegrationApp/Service.php | 2 +
app/Services/Crm/IntegrationApp/ServiceTraits/NotSupportedTrait.php | 12 +-
app/Services/Crm/IntegrationApp/ServiceTraits/SyncCrmMetadataTrait.php | 5 -
app/Services/Crm/Pipedrive/Service.php | 43 +-----
app/Services/Crm/Salesforce/Service.php | 13 +-
app/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityService.php | 143 +++++++++++++++++++
app/Services/Kiosk/AutomatedReports/AutomatedReportsService.php | 222 +++++++++++++++++++++++++----
front-end/package.json | 2 +-
front-end/src/__mocks__/kit/endpoints/team-insights.js | 1 +
front-end/src/components/AiReports/AiReports.vue | 9 +-
front-end/src/components/AiReports/GridCells/ActionsCell.vue | 107 +++++++++++---
front-end/src/components/AiReports/GridCells/NameCell.vue | 13 +-
front-end/src/components/AiReports/GridCells/TypeIndicator.vue | 26 ++--
front-end/src/components/AiReports/Manage/CreateDefinition/CreateDefinitionDrawer.vue | 4 +-
front-end/src/components/AiReports/Manage/ExpiringCell.vue | 86 ++++++++++++
front-end/src/components/AiReports/Manage/ManageAiReports.less | 6 +
front-end/src/components/AiReports/Manage/ManageAiReports.vue | 6 +-
front-end/src/components/AiReports/Manage/__tests__/ExpiringCell.spec.js | 116 +++++++++++++++
front-end/src/components/AiReports/Manage/__tests__/ManageAiReports.spec.js | 32 +++--
front-end/src/components/AiReports/Manage/__tests__/__snapshots__/create-definition-drawer.output.html | 83 ++++++++---
front-end/src/components/AiReports/Manage/__tests__/__snapshots__/edit-definition-drawer.output.html | 83 ++++++++---
front-end/src/components/AiReports/Manage/__tests__/__snapshots__/manage-ai-reports.output.html | 83 ++++++++---
front-end/src/components/AiReports/Manage/gridConfig.js | 12 +-
front-end/src/components/AiReports/__tests__/AiReports.spec.js | 45 +++++-
front-end/src/components/AiReports/__tests__/__mocks__/data.js | 49 +++++++
front-end/src/components/AiReports/__tests__/__mocks__/requestHandlers.js | 3 +
front-end/src/components/AiReports/__tests__/__snapshots__/ai-reports.output.html | 319 +++++++++++++++++++++++++++++++++++++++++-
front-end/src/components/AiReports/constants.js | 1 +
front-end/src/components/AiReports/gridConfig.js | 2 +-
front-end/src/components/AiReports/useAiReportsGrid.js | 27 ++++
front-end/src/components/Settings/Kiosk/AutomatedReports/RecipientsCell.vue | 36 ++++-
front-end/src/components/Settings/Kiosk/AutomatedReports/UsersCell.vue | 9 +-
front-end/src/components/Settings/Kiosk/AutomatedReports/__tests__/RecipientsCell.spec.js | 171 ++++++++++++++++++++++
front-end/src/components/Settings/OrgSettings/AiAutomation/CallScoring/ScorecardRuleForm.vue | 2 +-
front-end/src/components/TeamInsights/CoachingFrameworks/AICallScoring/aiCallScoringOverTime.ts | 18 ++-
front-end/src/components/shared/GridView/useOrder.js | 6 +-
front-end/src/components/shared/GridView/usePaginationList.js | 7 +-
front-end/yarn.lock | 8 +-
resources/views/emails/reports/ask-jiminny-report-generated.blade.php | 25 ++++
routes/api.php | 1 +
tests/Unit/Component/Activity/Services/UpdateActivityServiceTest.php | 62 ++++++++
tests/Unit/Component/AiCallScoring/Services/GenerateAiCallScoringServiceTest.php | 13 +-
tests/Unit/Console/Commands/Reports/AutomatedReportsCommandTest.php | 468 ++++++++++++++++++++++++++++++++++++++++++-------------------
tests/Unit/Http/Controllers/Webhook/Hubspot/ProcessesWebhooksTraitTest.php | 5 +-
tests/Unit/Http/Controllers/Webhook/ReportControllerTest.php | 9 +-
tests/Unit/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJobTest.php | 407 +++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Unit/Jobs/Crm/SyncActivityTest.php | 74 +++++++---
tests/Unit/Jobs/Crm/SyncHubspotObjectsTest.php | 455 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Unit/Jobs/Crm/SyncTeamMetadataTest.php | 8 +-
tests/Unit/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEventTest.php | 199 ++++++++++++++++++++++++++
tests/Unit/Listeners/Crm/ResolveOwnerTest.php | 64 ++++-----
tests/Unit/Repositories/AutomatedReportsRepositoryTest.php | 55 ++++++++
tests/Unit/Services/Crm/Copper/ServiceTest.php | 19 ---
tests/Unit/Services/Crm/Hubspot/ServiceTraits/OpportunitySyncTest.php | 74 ++++++----
tests/Unit/Services/Crm/Hubspot/ServiceTraits/SyncCrmEntitiesTraitTest.php | 8 +-
tests/Unit/Services/Crm/IntegrationApp/ServiceTraits/NotSupportedTraitTest.php | 76 ++--------
tests/Unit/Services/Crm/IntegrationApp/ServiceTraits/SyncCrmMetadataTraitTest.php | 5 -
tests/Unit/Services/Crm/Pipedrive/ServiceTest.php | 11 --
tests/Unit/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityServiceTest.php | 430 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Unit/Services/Kiosk/AutomatedReports/AutomatedReportsServiceTest.php | 521 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
113 files changed, 5468 insertions(+), 980 deletions(-)
create mode 100644 app/Console/Commands/Crm/SyncHubspotObjects.php
create mode 100644 app/Console/Commands/Crm/Traits/SyncObjectsCommandTrait.php
create mode 100644 app/Contracts/Services/Crm/ImportsBusinessProcessesInterface.php
create mode 100644 app/Events/AutomatedReports/AutomatedReportGenerated.php
create mode 100644 app/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJob.php
create mode 100644 app/Jobs/Crm/SyncHubspotObjects.php
create mode 100644 app/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEvent.php
create mode 100644 app/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityService.php
create mode 100644 front-end/src/components/AiReports/Manage/ExpiringCell.vue
create mode 100644 front-end/src/components/AiReports/Manage/__tests__/ExpiringCell.spec.js
create mode 100644 front-end/src/components/AiReports/constants.js
create mode 100644 front-end/src/components/AiReports/useAiReportsGrid.js
create mode 100644 front-end/src/components/Settings/Kiosk/AutomatedReports/__tests__/RecipientsCell.spec.js
create mode 100644 resources/views/emails/reports/ask-jiminny-report-generated.blade.php
create mode 100644 tests/Unit/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJobTest.php
create mode 100644 tests/Unit/Jobs/Crm/SyncHubspotObjectsTest.php
create mode 100644 tests/Unit/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEventTest.php
create mode 100644 tests/Unit/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityServiceTest.php
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20372-ai-reports-promotion-pages) $ git status
On branch JY-20372-ai-reports-promotion-pages
Your branch is up to date with 'origin/JY-20372-ai-reports-promotion-pages'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .env.local
modified: app/Console/Commands/JiminnyDebugCommand.php
modified: app/Http/Controllers/API/ActivityController.php
modified: app/Http/Transformers/UserTransformer.php
modified: app/Jobs/Team/SyncToIntercom.php
modified: app/Repositories/AutomatedReportsRepository.php
modified: app/Services/PlaybackService.php
modified: config/logging.php
modified: tests/Unit/Repositories/AutomatedReportsRepositoryTest.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
.env.nikilocal
.env.other
WEBHOOK_FILTERING_IMPLEMENTATION.md
app/Console/Commands/Crm/Hubspot/SimulateWebhooksCommand.php
app/Console/Commands/Reports/CreateMockAskJiminnyReportResultCommand.php
ids.txt
raw_sql_query.sql
tests/Unit/Policies/CanAccessAiReportsTest.php
no changes added to commit (use "git add" and/or "git commit -a")
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20372-ai-reports-promotion-pages) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5613/5613 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
1) app/Console/Commands/JiminnyDebugCommand.php (braces_position, statement_indentation)
---------- begin diff ----------
--- /home/jiminny/app/Console/Commands/JiminnyDebugCommand.php
+++ /home/jiminny/app/Console/Commands/JiminnyDebugCommand.php
@@ -37,15 +37,14 @@
JobDispatcherInterface $jobDispatcher,
AutomatedReportsService $automatedReportsService,
AutomatedReportsRepository $automatedReportsRepository,
- ): void
- {
-// $user = User::find(143);
-// $count = $automatedReportsRepository->countUserReports($user);
-// $this->info("Count: {$count}");
-// $count = $automatedReportsRepository->countAllUserReports($user);
-// $this->info("All count: {$count}");
-//
-// exit(1);
+ ): void {
+ // $user = User::find(143);
+ // $count = $automatedReportsRepository->countUserReports($user);
+ // $this->info("Count: {$count}");
+ // $count = $automatedReportsRepository->countAllUserReports($user);
+ // $this->info("All count: {$count}");
+ //
+ // exit(1);
$now = Carbon::now()->subDay(1);
$this->info("Now: {$now->toDateTimeString()}");
@@ -52,18 +51,18 @@
$weekStart = Carbon::getWeekStartsAt();
$this->info("Now: {$weekStart}");
-// $from = $now->copy()->previousWeekday()->startOfDay();
-// $to = $now->copy()->previousWeekday()->endOfDay();
+ // $from = $now->copy()->previousWeekday()->startOfDay();
+ // $to = $now->copy()->previousWeekday()->endOfDay();
-// $fromOld = $now->copy()->subWeeks(1)->startOfDay();
-// $toOld = $now->copy()->subDay()->endOfDay();
-// $fromNew = $now->copy()->subWeek()->startOfWeek();
-// $toNew = $now->copy()->subWeek()->endOfWeek();
+ // $fromOld = $now->copy()->subWeeks(1)->startOfDay();
+ // $toOld = $now->copy()->subDay()->endOfDay();
+ // $fromNew = $now->copy()->subWeek()->startOfWeek();
+ // $toNew = $now->copy()->subWeek()->endOfWeek();
-// $fromOld = $now->copy()->subMonths(1)->startOfDay();
-// $toOld = $now->copy()->subDay()->endOfDay();
-// $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
-// $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
+ // $fromOld = $now->copy()->subMonths(1)->startOfDay();
+ // $toOld = $now->copy()->subDay()->endOfDay();
+ // $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
+ // $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
$fromOld = $now->copy()->subMonths(3)->startOfDay();
$toOld = $now->copy()->subDay()->endOfDay();
----------- end diff -----------
Fixed 1 of 5613 files in 66.818 seconds, 67.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5616/5616 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Fixed 0 of 5616 files in 65.183 seconds, 60.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ ;xd
docker exec -it docker_lamp_1 bash -c "mv /usr/local/etc/php/conf.d/xdebug.ini ~/xdebug.ini"
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5616/5616 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Fixed 0 of 5616 files in 40.863 seconds, 60.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (master) $ git pull
remote: Enumerating objects: 53, done.
remote: Counting objects: 100% (53/53), done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 53 (delta 33), reused 49 (delta 30), pack-reused 0 (from 0)
Unpacking objects: 100% (53/53), 46.00 KiB | 523.00 KiB/s, done.
From github.com:jiminny/app
b1d5c77ad1..dfc8da14d2 JY-20372-ai-reports-promotion-pages -> origin/JY-20372-ai-reports-promotion-pages
+ 47037d2c29...5138acf14e secfix/npm-20260423 -> origin/secfix/npm-20260423 (forced update)
Already up to date.
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (master) $ co -b JY-20738-debug-AJ-tracking-UP
Switched to a new branch 'JY-20738-debug-AJ-tracking-UP'
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20738-debug-AJ-tracking-UP) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5621/5621 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Fixed 0 of 5621 files in 22.942 seconds, 60.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at https://docs.docker.com/go/debug-cli/
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20738-debug-AJ-tracking-UP) $
DOCKER
Close Tab
DEV (docker)
Close Tab
APP (-zsh)
Close Tab
screenpipe"
Close Tab
-zsh
Close Tab
-zsh
Close Tab
⌥⌘1
APP (-zsh)...
|
iTerm2
|
APP (-zsh)
|
NULL
|
77276
|
|
Last login: Thu Apr 23 14:01:28 on ttys007
Poetry Last login: Thu Apr 23 14:01:28 on ttys007
Poetry could not find a pyproject.toml file in /Users/lukas/jiminny/app or its parents
Poetry could not find a pyproject.toml file in /Users/lukas/jiminny/app or its parents
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ git status
On branch JY-20157-AJ-report-not-send-notification
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .env.local
modified: app/Console/Commands/JiminnyDebugCommand.php
modified: app/Http/Controllers/API/ActivityController.php
modified: app/Jobs/Team/SyncToIntercom.php
modified: app/Services/PlaybackService.php
modified: config/logging.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
.env.nikilocal
.env.other
WEBHOOK_FILTERING_IMPLEMENTATION.md
app/Console/Commands/Crm/Hubspot/SimulateWebhooksCommand.php
app/Console/Commands/Reports/CreateMockAskJiminnyReportResultCommand.php
ids.txt
raw_sql_query.sql
tests/Unit/Policies/CanAccessAiReportsTest.php
no changes added to commit (use "git add" and/or "git commit -a")
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ git status
On branch JY-20372-ai-reports-promotion-pages
Your branch is up to date with 'origin/JY-20372-ai-reports-promotion-pages'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .env.local
modified: app/Console/Commands/JiminnyDebugCommand.php
modified: app/Http/Controllers/API/ActivityController.php
modified: app/Jobs/Team/SyncToIntercom.php
modified: app/Services/PlaybackService.php
modified: config/logging.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
.env.nikilocal
.env.other
WEBHOOK_FILTERING_IMPLEMENTATION.md
app/Console/Commands/Crm/Hubspot/SimulateWebhooksCommand.php
app/Console/Commands/Reports/CreateMockAskJiminnyReportResultCommand.php
ids.txt
raw_sql_query.sql
tests/Unit/Policies/CanAccessAiReportsTest.php
no changes added to commit (use "git add" and/or "git commit -a")
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20372-ai-reports-promotion-pages) $ git pull
remote: Enumerating objects: 1015, done.
remote: Counting objects: 100% (262/262), done.
remote: Compressing objects: 100% (143/143), done.
remote: Total 1015 (delta 167), reused 129 (delta 119), pack-reused 753 (from 3)
Receiving objects: 100% (1015/1015), 851.14 KiB | 2.09 MiB/s, done.
Resolving deltas: 100% (613/613), completed with 65 local objects.
From github.com:jiminny/app
c3c8d86b22..68bb20c72a JY-20372-ai-reports-promotion-pages -> origin/JY-20372-ai-reports-promotion-pages
3ac71c265a..595c95b7e0 JY-19995-delete-leftover-tracks-command -> origin/JY-19995-delete-leftover-tracks-command
* [new branch] JY-20352-sync-opportunities-without-a-local-owner-user-id-is-null -> origin/JY-20352-sync-opportunities-without-a-local-owner-user-id-is-null
* [new branch] JY-20478-stop-sync-calendar-emails -> origin/JY-20478-stop-sync-calendar-emails
d4d05c775b..b11048beed JY-20541-cleanup-stale-tasks-and-events -> origin/JY-20541-cleanup-stale-tasks-and-events
10d290c778..a250abe939 JY-20663-partner-rockeed -> origin/JY-20663-partner-rockeed
* [new branch] JY-20713-activity-sync-job-restart -> origin/JY-20713-activity-sync-job-restart
242cf1b554..96a22e59f2 JY-9712-change-forever-nudges-to-1-year-expiration -> origin/JY-9712-change-forever-nudges-to-1-year-expiration
* [new branch] fix-close-missing-logger-error -> origin/fix-close-missing-logger-error
0dd5b23990..60fa1787c1 master -> origin/master
f044edca5b..e7e0e50b27 secfix/npm-20260416 -> origin/secfix/npm-20260416
* [new branch] secfix/npm-20260423 -> origin/secfix/npm-20260423
Updating c3c8d86b22..68bb20c72a
Fast-forward
Makefile | 5 +
app/Component/Activity/Services/UpdateActivityService.php | 5 +
app/Component/ActivitySearch/FilterDefinition/ActivityUpdatedDate.php | 7 +-
app/Component/ActivitySearch/Service/ActivitySearch.php | 15 ++
app/Component/AiCallScoring/Services/GenerateAiCallScoringService.php | 6 +
app/Component/AiCallScoring/Services/GetAiCallScoringService.php | 5 +-
app/Component/AiCallScoring/Transformers/AiCallScoringTransformer.php | 2 +-
app/Component/ProphetAi/ProphetClient.php | 5 +
app/Console/Commands/Crm/SyncHubspotObjects.php | 84 +++++++++++
app/Console/Commands/Crm/SyncObjects.php | 82 ++++++-----
app/Console/Commands/Crm/Traits/SyncObjectsCommandTrait.php | 81 +++++++++++
app/Console/Commands/Reports/AutomatedReportsCommand.php | 91 +++++++++++-
app/Console/Commands/Reports/AutomatedReportsSendCommand.php | 40 +++++-
app/Console/Kernel.php | 4 +
app/Contracts/Services/Crm/ImportsBusinessProcessesInterface.php | 15 ++
app/Contracts/Services/Crm/Provider/SalesforceInterface.php | 12 +-
app/Contracts/Services/Crm/ServiceInterface.php | 29 ----
app/Contracts/Services/Crm/SyncCrmMetadataInterface.php | 6 +-
app/Events/AutomatedReports/AutomatedReportGenerated.php | 15 ++
app/Http/Controllers/API/CrmController.php | 19 ++-
app/Http/Controllers/API/UserAutomatedReports/UserAutomatedReportsController.php | 33 ++++-
app/Http/Controllers/Internal/WebhookReceiver/HubspotController.php | 2 +-
app/Http/Controllers/Webhook/Hubspot/EventsController.php | 2 +-
app/Http/Controllers/Webhook/Hubspot/ProcessesWebhooksTrait.php | 64 ++++++---
app/Http/Controllers/Webhook/ReportController.php | 5 +
app/Http/Requests/Settings/AiCallScoring/CreateOrUpdateAiScorecardRequest.php | 2 +-
app/Http/Requests/Settings/AiCallScoring/CreateOrUpdateAiScorecardRuleRequest.php | 2 +-
app/Http/Requests/Settings/AiCallScoring/TestAiCallScoringPromptRequest.php | 2 +-
app/Jobs/Activity/SyncActivity.php | 3 +-
app/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJob.php | 210 ++++++++++++++++++++++++++++
app/Jobs/AutomatedReports/SendReportJob.php | 2 +
app/Jobs/AutomatedReports/SendReportMailJob.php | 6 +-
app/Jobs/Crm/SyncActivity.php | 10 ++
app/Jobs/Crm/SyncHubspotObjects.php | 120 ++++++++++++++++
app/Jobs/Crm/SyncObjects.php | 26 ++--
app/Jobs/Crm/SyncTeamMetadata.php | 14 +-
app/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEvent.php | 82 +++++++++++
app/Listeners/Crm/ResolveOwner.php | 21 +--
app/Mail/Reports/ReportWithAttachment.php | 7 +-
app/Models/Ai/AiScorecardRuleRun.php | 4 +-
app/Models/Ai/AiScorecardRun.php | 4 +-
app/Models/Contracts/UserContract.php | 6 +
app/Providers/EventServiceProvider.php | 4 +
app/Repositories/AutomatedReportsRepository.php | 76 +++++++++-
app/Repositories/Crm/CrmEntityRepository.php | 40 ++++++
app/Services/Crm/BaseService.php | 13 --
app/Services/Crm/Bullhorn/BullhornService.php | 21 ---
app/Services/Crm/Close/Service.php | 38 -----
app/Services/Crm/Copper/Service.php | 37 -----
app/Services/Crm/Dummy/Service.php | 25 ----
app/Services/Crm/Hubspot/Service.php | 37 -----
app/Services/Crm/Hubspot/ServiceTraits/OpportunitySyncTrait.php | 174 +++++++++++++++++------
app/Services/Crm/Hubspot/ServiceTraits/SyncCrmEntitiesTrait.php | 27 ++--
app/Services/Crm/IntegrationApp/Service.php | 2 +
app/Services/Crm/IntegrationApp/ServiceTraits/NotSupportedTrait.php | 12 +-
app/Services/Crm/IntegrationApp/ServiceTraits/SyncCrmMetadataTrait.php | 5 -
app/Services/Crm/Pipedrive/Service.php | 43 +-----
app/Services/Crm/Salesforce/Service.php | 13 +-
app/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityService.php | 143 +++++++++++++++++++
app/Services/Kiosk/AutomatedReports/AutomatedReportsService.php | 222 +++++++++++++++++++++++++----
front-end/package.json | 2 +-
front-end/src/__mocks__/kit/endpoints/team-insights.js | 1 +
front-end/src/components/AiReports/AiReports.vue | 9 +-
front-end/src/components/AiReports/GridCells/ActionsCell.vue | 107 +++++++++++---
front-end/src/components/AiReports/GridCells/NameCell.vue | 13 +-
front-end/src/components/AiReports/GridCells/TypeIndicator.vue | 26 ++--
front-end/src/components/AiReports/Manage/CreateDefinition/CreateDefinitionDrawer.vue | 4 +-
front-end/src/components/AiReports/Manage/ExpiringCell.vue | 86 ++++++++++++
front-end/src/components/AiReports/Manage/ManageAiReports.less | 6 +
front-end/src/components/AiReports/Manage/ManageAiReports.vue | 6 +-
front-end/src/components/AiReports/Manage/__tests__/ExpiringCell.spec.js | 116 +++++++++++++++
front-end/src/components/AiReports/Manage/__tests__/ManageAiReports.spec.js | 32 +++--
front-end/src/components/AiReports/Manage/__tests__/__snapshots__/create-definition-drawer.output.html | 83 ++++++++---
front-end/src/components/AiReports/Manage/__tests__/__snapshots__/edit-definition-drawer.output.html | 83 ++++++++---
front-end/src/components/AiReports/Manage/__tests__/__snapshots__/manage-ai-reports.output.html | 83 ++++++++---
front-end/src/components/AiReports/Manage/gridConfig.js | 12 +-
front-end/src/components/AiReports/__tests__/AiReports.spec.js | 45 +++++-
front-end/src/components/AiReports/__tests__/__mocks__/data.js | 49 +++++++
front-end/src/components/AiReports/__tests__/__mocks__/requestHandlers.js | 3 +
front-end/src/components/AiReports/__tests__/__snapshots__/ai-reports.output.html | 319 +++++++++++++++++++++++++++++++++++++++++-
front-end/src/components/AiReports/constants.js | 1 +
front-end/src/components/AiReports/gridConfig.js | 2 +-
front-end/src/components/AiReports/useAiReportsGrid.js | 27 ++++
front-end/src/components/Settings/Kiosk/AutomatedReports/RecipientsCell.vue | 36 ++++-
front-end/src/components/Settings/Kiosk/AutomatedReports/UsersCell.vue | 9 +-
front-end/src/components/Settings/Kiosk/AutomatedReports/__tests__/RecipientsCell.spec.js | 171 ++++++++++++++++++++++
front-end/src/components/Settings/OrgSettings/AiAutomation/CallScoring/ScorecardRuleForm.vue | 2 +-
front-end/src/components/TeamInsights/CoachingFrameworks/AICallScoring/aiCallScoringOverTime.ts | 18 ++-
front-end/src/components/shared/GridView/useOrder.js | 6 +-
front-end/src/components/shared/GridView/usePaginationList.js | 7 +-
front-end/yarn.lock | 8 +-
resources/views/emails/reports/ask-jiminny-report-generated.blade.php | 25 ++++
routes/api.php | 1 +
tests/Unit/Component/Activity/Services/UpdateActivityServiceTest.php | 62 ++++++++
tests/Unit/Component/AiCallScoring/Services/GenerateAiCallScoringServiceTest.php | 13 +-
tests/Unit/Console/Commands/Reports/AutomatedReportsCommandTest.php | 468 ++++++++++++++++++++++++++++++++++++++++++-------------------
tests/Unit/Http/Controllers/Webhook/Hubspot/ProcessesWebhooksTraitTest.php | 5 +-
tests/Unit/Http/Controllers/Webhook/ReportControllerTest.php | 9 +-
tests/Unit/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJobTest.php | 407 +++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Unit/Jobs/Crm/SyncActivityTest.php | 74 +++++++---
tests/Unit/Jobs/Crm/SyncHubspotObjectsTest.php | 455 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Unit/Jobs/Crm/SyncTeamMetadataTest.php | 8 +-
tests/Unit/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEventTest.php | 199 ++++++++++++++++++++++++++
tests/Unit/Listeners/Crm/ResolveOwnerTest.php | 64 ++++-----
tests/Unit/Repositories/AutomatedReportsRepositoryTest.php | 55 ++++++++
tests/Unit/Services/Crm/Copper/ServiceTest.php | 19 ---
tests/Unit/Services/Crm/Hubspot/ServiceTraits/OpportunitySyncTest.php | 74 ++++++----
tests/Unit/Services/Crm/Hubspot/ServiceTraits/SyncCrmEntitiesTraitTest.php | 8 +-
tests/Unit/Services/Crm/IntegrationApp/ServiceTraits/NotSupportedTraitTest.php | 76 ++--------
tests/Unit/Services/Crm/IntegrationApp/ServiceTraits/SyncCrmMetadataTraitTest.php | 5 -
tests/Unit/Services/Crm/Pipedrive/ServiceTest.php | 11 --
tests/Unit/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityServiceTest.php | 430 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Unit/Services/Kiosk/AutomatedReports/AutomatedReportsServiceTest.php | 521 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
113 files changed, 5468 insertions(+), 980 deletions(-)
create mode 100644 app/Console/Commands/Crm/SyncHubspotObjects.php
create mode 100644 app/Console/Commands/Crm/Traits/SyncObjectsCommandTrait.php
create mode 100644 app/Contracts/Services/Crm/ImportsBusinessProcessesInterface.php
create mode 100644 app/Events/AutomatedReports/AutomatedReportGenerated.php
create mode 100644 app/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJob.php
create mode 100644 app/Jobs/Crm/SyncHubspotObjects.php
create mode 100644 app/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEvent.php
create mode 100644 app/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityService.php
create mode 100644 front-end/src/components/AiReports/Manage/ExpiringCell.vue
create mode 100644 front-end/src/components/AiReports/Manage/__tests__/ExpiringCell.spec.js
create mode 100644 front-end/src/components/AiReports/constants.js
create mode 100644 front-end/src/components/AiReports/useAiReportsGrid.js
create mode 100644 front-end/src/components/Settings/Kiosk/AutomatedReports/__tests__/RecipientsCell.spec.js
create mode 100644 resources/views/emails/reports/ask-jiminny-report-generated.blade.php
create mode 100644 tests/Unit/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJobTest.php
create mode 100644 tests/Unit/Jobs/Crm/SyncHubspotObjectsTest.php
create mode 100644 tests/Unit/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEventTest.php
create mode 100644 tests/Unit/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityServiceTest.php
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20372-ai-reports-promotion-pages) $ git status
On branch JY-20372-ai-reports-promotion-pages
Your branch is up to date with 'origin/JY-20372-ai-reports-promotion-pages'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .env.local
modified: app/Console/Commands/JiminnyDebugCommand.php
modified: app/Http/Controllers/API/ActivityController.php
modified: app/Http/Transformers/UserTransformer.php
modified: app/Jobs/Team/SyncToIntercom.php
modified: app/Repositories/AutomatedReportsRepository.php
modified: app/Services/PlaybackService.php
modified: config/logging.php
modified: tests/Unit/Repositories/AutomatedReportsRepositoryTest.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
.env.nikilocal
.env.other
WEBHOOK_FILTERING_IMPLEMENTATION.md
app/Console/Commands/Crm/Hubspot/SimulateWebhooksCommand.php
app/Console/Commands/Reports/CreateMockAskJiminnyReportResultCommand.php
ids.txt
raw_sql_query.sql
tests/Unit/Policies/CanAccessAiReportsTest.php
no changes added to commit (use "git add" and/or "git commit -a")
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20372-ai-reports-promotion-pages) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5613/5613 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
1) app/Console/Commands/JiminnyDebugCommand.php (braces_position, statement_indentation)
---------- begin diff ----------
--- /home/jiminny/app/Console/Commands/JiminnyDebugCommand.php
+++ /home/jiminny/app/Console/Commands/JiminnyDebugCommand.php
@@ -37,15 +37,14 @@
JobDispatcherInterface $jobDispatcher,
AutomatedReportsService $automatedReportsService,
AutomatedReportsRepository $automatedReportsRepository,
- ): void
- {
-// $user = User::find(143);
-// $count = $automatedReportsRepository->countUserReports($user);
-// $this->info("Count: {$count}");
-// $count = $automatedReportsRepository->countAllUserReports($user);
-// $this->info("All count: {$count}");
-//
-// exit(1);
+ ): void {
+ // $user = User::find(143);
+ // $count = $automatedReportsRepository->countUserReports($user);
+ // $this->info("Count: {$count}");
+ // $count = $automatedReportsRepository->countAllUserReports($user);
+ // $this->info("All count: {$count}");
+ //
+ // exit(1);
$now = Carbon::now()->subDay(1);
$this->info("Now: {$now->toDateTimeString()}");
@@ -52,18 +51,18 @@
$weekStart = Carbon::getWeekStartsAt();
$this->info("Now: {$weekStart}");
-// $from = $now->copy()->previousWeekday()->startOfDay();
-// $to = $now->copy()->previousWeekday()->endOfDay();
+ // $from = $now->copy()->previousWeekday()->startOfDay();
+ // $to = $now->copy()->previousWeekday()->endOfDay();
-// $fromOld = $now->copy()->subWeeks(1)->startOfDay();
-// $toOld = $now->copy()->subDay()->endOfDay();
-// $fromNew = $now->copy()->subWeek()->startOfWeek();
-// $toNew = $now->copy()->subWeek()->endOfWeek();
+ // $fromOld = $now->copy()->subWeeks(1)->startOfDay();
+ // $toOld = $now->copy()->subDay()->endOfDay();
+ // $fromNew = $now->copy()->subWeek()->startOfWeek();
+ // $toNew = $now->copy()->subWeek()->endOfWeek();
-// $fromOld = $now->copy()->subMonths(1)->startOfDay();
-// $toOld = $now->copy()->subDay()->endOfDay();
-// $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
-// $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
+ // $fromOld = $now->copy()->subMonths(1)->startOfDay();
+ // $toOld = $now->copy()->subDay()->endOfDay();
+ // $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
+ // $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
$fromOld = $now->copy()->subMonths(3)->startOfDay();
$toOld = $now->copy()->subDay()->endOfDay();
----------- end diff -----------
Fixed 1 of 5613 files in 66.818 seconds, 67.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5616/5616 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Fixed 0 of 5616 files in 65.183 seconds, 60.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ ;xd
docker exec -it docker_lamp_1 bash -c "mv /usr/local/etc/php/conf.d/xdebug.ini ~/xdebug.ini"
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5616/5616 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Fixed 0 of 5616 files in 40.863 seconds, 60.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (master) $ git pull
remote: Enumerating objects: 53, done.
remote: Counting objects: 100% (53/53), done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 53 (delta 33), reused 49 (delta 30), pack-reused 0 (from 0)
Unpacking objects: 100% (53/53), 46.00 KiB | 523.00 KiB/s, done.
From github.com:jiminny/app
b1d5c77ad1..dfc8da14d2 JY-20372-ai-reports-promotion-pages -> origin/JY-20372-ai-reports-promotion-pages
+ 47037d2c29...5138acf14e secfix/npm-20260423 -> origin/secfix/npm-20260423 (forced update)
Already up to date.
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (master) $ co -b JY-20738-debug-AJ-tracking-UP
Switched to a new branch 'JY-20738-debug-AJ-tracking-UP'
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20738-debug-AJ-tracking-UP) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5621/5621 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Fixed 0 of 5621 files in 22.942 seconds, 60.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at https://docs.docker.com/go/debug-cli/
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20738-debug-AJ-tracking-UP) $
DOCKER
Close Tab
DEV (docker)
Close Tab
APP (-zsh)
Close Tab
screenpipe"
Close Tab
-zsh
Close Tab
-zsh
Close Tab
⌥⌘1
APP (-zsh)...
|
iTerm2
|
APP (-zsh)
|
NULL
|
77277
|
|
Last login: Thu Apr 23 14:01:28 on ttys007
Poetry Last login: Thu Apr 23 14:01:28 on ttys007
Poetry could not find a pyproject.toml file in /Users/lukas/jiminny/app or its parents
Poetry could not find a pyproject.toml file in /Users/lukas/jiminny/app or its parents
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ git status
On branch JY-20157-AJ-report-not-send-notification
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .env.local
modified: app/Console/Commands/JiminnyDebugCommand.php
modified: app/Http/Controllers/API/ActivityController.php
modified: app/Jobs/Team/SyncToIntercom.php
modified: app/Services/PlaybackService.php
modified: config/logging.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
.env.nikilocal
.env.other
WEBHOOK_FILTERING_IMPLEMENTATION.md
app/Console/Commands/Crm/Hubspot/SimulateWebhooksCommand.php
app/Console/Commands/Reports/CreateMockAskJiminnyReportResultCommand.php
ids.txt
raw_sql_query.sql
tests/Unit/Policies/CanAccessAiReportsTest.php
no changes added to commit (use "git add" and/or "git commit -a")
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ git status
On branch JY-20372-ai-reports-promotion-pages
Your branch is up to date with 'origin/JY-20372-ai-reports-promotion-pages'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .env.local
modified: app/Console/Commands/JiminnyDebugCommand.php
modified: app/Http/Controllers/API/ActivityController.php
modified: app/Jobs/Team/SyncToIntercom.php
modified: app/Services/PlaybackService.php
modified: config/logging.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
.env.nikilocal
.env.other
WEBHOOK_FILTERING_IMPLEMENTATION.md
app/Console/Commands/Crm/Hubspot/SimulateWebhooksCommand.php
app/Console/Commands/Reports/CreateMockAskJiminnyReportResultCommand.php
ids.txt
raw_sql_query.sql
tests/Unit/Policies/CanAccessAiReportsTest.php
no changes added to commit (use "git add" and/or "git commit -a")
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20372-ai-reports-promotion-pages) $ git pull
remote: Enumerating objects: 1015, done.
remote: Counting objects: 100% (262/262), done.
remote: Compressing objects: 100% (143/143), done.
remote: Total 1015 (delta 167), reused 129 (delta 119), pack-reused 753 (from 3)
Receiving objects: 100% (1015/1015), 851.14 KiB | 2.09 MiB/s, done.
Resolving deltas: 100% (613/613), completed with 65 local objects.
From github.com:jiminny/app
c3c8d86b22..68bb20c72a JY-20372-ai-reports-promotion-pages -> origin/JY-20372-ai-reports-promotion-pages
3ac71c265a..595c95b7e0 JY-19995-delete-leftover-tracks-command -> origin/JY-19995-delete-leftover-tracks-command
* [new branch] JY-20352-sync-opportunities-without-a-local-owner-user-id-is-null -> origin/JY-20352-sync-opportunities-without-a-local-owner-user-id-is-null
* [new branch] JY-20478-stop-sync-calendar-emails -> origin/JY-20478-stop-sync-calendar-emails
d4d05c775b..b11048beed JY-20541-cleanup-stale-tasks-and-events -> origin/JY-20541-cleanup-stale-tasks-and-events
10d290c778..a250abe939 JY-20663-partner-rockeed -> origin/JY-20663-partner-rockeed
* [new branch] JY-20713-activity-sync-job-restart -> origin/JY-20713-activity-sync-job-restart
242cf1b554..96a22e59f2 JY-9712-change-forever-nudges-to-1-year-expiration -> origin/JY-9712-change-forever-nudges-to-1-year-expiration
* [new branch] fix-close-missing-logger-error -> origin/fix-close-missing-logger-error
0dd5b23990..60fa1787c1 master -> origin/master
f044edca5b..e7e0e50b27 secfix/npm-20260416 -> origin/secfix/npm-20260416
* [new branch] secfix/npm-20260423 -> origin/secfix/npm-20260423
Updating c3c8d86b22..68bb20c72a
Fast-forward
Makefile | 5 +
app/Component/Activity/Services/UpdateActivityService.php | 5 +
app/Component/ActivitySearch/FilterDefinition/ActivityUpdatedDate.php | 7 +-
app/Component/ActivitySearch/Service/ActivitySearch.php | 15 ++
app/Component/AiCallScoring/Services/GenerateAiCallScoringService.php | 6 +
app/Component/AiCallScoring/Services/GetAiCallScoringService.php | 5 +-
app/Component/AiCallScoring/Transformers/AiCallScoringTransformer.php | 2 +-
app/Component/ProphetAi/ProphetClient.php | 5 +
app/Console/Commands/Crm/SyncHubspotObjects.php | 84 +++++++++++
app/Console/Commands/Crm/SyncObjects.php | 82 ++++++-----
app/Console/Commands/Crm/Traits/SyncObjectsCommandTrait.php | 81 +++++++++++
app/Console/Commands/Reports/AutomatedReportsCommand.php | 91 +++++++++++-
app/Console/Commands/Reports/AutomatedReportsSendCommand.php | 40 +++++-
app/Console/Kernel.php | 4 +
app/Contracts/Services/Crm/ImportsBusinessProcessesInterface.php | 15 ++
app/Contracts/Services/Crm/Provider/SalesforceInterface.php | 12 +-
app/Contracts/Services/Crm/ServiceInterface.php | 29 ----
app/Contracts/Services/Crm/SyncCrmMetadataInterface.php | 6 +-
app/Events/AutomatedReports/AutomatedReportGenerated.php | 15 ++
app/Http/Controllers/API/CrmController.php | 19 ++-
app/Http/Controllers/API/UserAutomatedReports/UserAutomatedReportsController.php | 33 ++++-
app/Http/Controllers/Internal/WebhookReceiver/HubspotController.php | 2 +-
app/Http/Controllers/Webhook/Hubspot/EventsController.php | 2 +-
app/Http/Controllers/Webhook/Hubspot/ProcessesWebhooksTrait.php | 64 ++++++---
app/Http/Controllers/Webhook/ReportController.php | 5 +
app/Http/Requests/Settings/AiCallScoring/CreateOrUpdateAiScorecardRequest.php | 2 +-
app/Http/Requests/Settings/AiCallScoring/CreateOrUpdateAiScorecardRuleRequest.php | 2 +-
app/Http/Requests/Settings/AiCallScoring/TestAiCallScoringPromptRequest.php | 2 +-
app/Jobs/Activity/SyncActivity.php | 3 +-
app/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJob.php | 210 ++++++++++++++++++++++++++++
app/Jobs/AutomatedReports/SendReportJob.php | 2 +
app/Jobs/AutomatedReports/SendReportMailJob.php | 6 +-
app/Jobs/Crm/SyncActivity.php | 10 ++
app/Jobs/Crm/SyncHubspotObjects.php | 120 ++++++++++++++++
app/Jobs/Crm/SyncObjects.php | 26 ++--
app/Jobs/Crm/SyncTeamMetadata.php | 14 +-
app/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEvent.php | 82 +++++++++++
app/Listeners/Crm/ResolveOwner.php | 21 +--
app/Mail/Reports/ReportWithAttachment.php | 7 +-
app/Models/Ai/AiScorecardRuleRun.php | 4 +-
app/Models/Ai/AiScorecardRun.php | 4 +-
app/Models/Contracts/UserContract.php | 6 +
app/Providers/EventServiceProvider.php | 4 +
app/Repositories/AutomatedReportsRepository.php | 76 +++++++++-
app/Repositories/Crm/CrmEntityRepository.php | 40 ++++++
app/Services/Crm/BaseService.php | 13 --
app/Services/Crm/Bullhorn/BullhornService.php | 21 ---
app/Services/Crm/Close/Service.php | 38 -----
app/Services/Crm/Copper/Service.php | 37 -----
app/Services/Crm/Dummy/Service.php | 25 ----
app/Services/Crm/Hubspot/Service.php | 37 -----
app/Services/Crm/Hubspot/ServiceTraits/OpportunitySyncTrait.php | 174 +++++++++++++++++------
app/Services/Crm/Hubspot/ServiceTraits/SyncCrmEntitiesTrait.php | 27 ++--
app/Services/Crm/IntegrationApp/Service.php | 2 +
app/Services/Crm/IntegrationApp/ServiceTraits/NotSupportedTrait.php | 12 +-
app/Services/Crm/IntegrationApp/ServiceTraits/SyncCrmMetadataTrait.php | 5 -
app/Services/Crm/Pipedrive/Service.php | 43 +-----
app/Services/Crm/Salesforce/Service.php | 13 +-
app/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityService.php | 143 +++++++++++++++++++
app/Services/Kiosk/AutomatedReports/AutomatedReportsService.php | 222 +++++++++++++++++++++++++----
front-end/package.json | 2 +-
front-end/src/__mocks__/kit/endpoints/team-insights.js | 1 +
front-end/src/components/AiReports/AiReports.vue | 9 +-
front-end/src/components/AiReports/GridCells/ActionsCell.vue | 107 +++++++++++---
front-end/src/components/AiReports/GridCells/NameCell.vue | 13 +-
front-end/src/components/AiReports/GridCells/TypeIndicator.vue | 26 ++--
front-end/src/components/AiReports/Manage/CreateDefinition/CreateDefinitionDrawer.vue | 4 +-
front-end/src/components/AiReports/Manage/ExpiringCell.vue | 86 ++++++++++++
front-end/src/components/AiReports/Manage/ManageAiReports.less | 6 +
front-end/src/components/AiReports/Manage/ManageAiReports.vue | 6 +-
front-end/src/components/AiReports/Manage/__tests__/ExpiringCell.spec.js | 116 +++++++++++++++
front-end/src/components/AiReports/Manage/__tests__/ManageAiReports.spec.js | 32 +++--
front-end/src/components/AiReports/Manage/__tests__/__snapshots__/create-definition-drawer.output.html | 83 ++++++++---
front-end/src/components/AiReports/Manage/__tests__/__snapshots__/edit-definition-drawer.output.html | 83 ++++++++---
front-end/src/components/AiReports/Manage/__tests__/__snapshots__/manage-ai-reports.output.html | 83 ++++++++---
front-end/src/components/AiReports/Manage/gridConfig.js | 12 +-
front-end/src/components/AiReports/__tests__/AiReports.spec.js | 45 +++++-
front-end/src/components/AiReports/__tests__/__mocks__/data.js | 49 +++++++
front-end/src/components/AiReports/__tests__/__mocks__/requestHandlers.js | 3 +
front-end/src/components/AiReports/__tests__/__snapshots__/ai-reports.output.html | 319 +++++++++++++++++++++++++++++++++++++++++-
front-end/src/components/AiReports/constants.js | 1 +
front-end/src/components/AiReports/gridConfig.js | 2 +-
front-end/src/components/AiReports/useAiReportsGrid.js | 27 ++++
front-end/src/components/Settings/Kiosk/AutomatedReports/RecipientsCell.vue | 36 ++++-
front-end/src/components/Settings/Kiosk/AutomatedReports/UsersCell.vue | 9 +-
front-end/src/components/Settings/Kiosk/AutomatedReports/__tests__/RecipientsCell.spec.js | 171 ++++++++++++++++++++++
front-end/src/components/Settings/OrgSettings/AiAutomation/CallScoring/ScorecardRuleForm.vue | 2 +-
front-end/src/components/TeamInsights/CoachingFrameworks/AICallScoring/aiCallScoringOverTime.ts | 18 ++-
front-end/src/components/shared/GridView/useOrder.js | 6 +-
front-end/src/components/shared/GridView/usePaginationList.js | 7 +-
front-end/yarn.lock | 8 +-
resources/views/emails/reports/ask-jiminny-report-generated.blade.php | 25 ++++
routes/api.php | 1 +
tests/Unit/Component/Activity/Services/UpdateActivityServiceTest.php | 62 ++++++++
tests/Unit/Component/AiCallScoring/Services/GenerateAiCallScoringServiceTest.php | 13 +-
tests/Unit/Console/Commands/Reports/AutomatedReportsCommandTest.php | 468 ++++++++++++++++++++++++++++++++++++++++++-------------------
tests/Unit/Http/Controllers/Webhook/Hubspot/ProcessesWebhooksTraitTest.php | 5 +-
tests/Unit/Http/Controllers/Webhook/ReportControllerTest.php | 9 +-
tests/Unit/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJobTest.php | 407 +++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Unit/Jobs/Crm/SyncActivityTest.php | 74 +++++++---
tests/Unit/Jobs/Crm/SyncHubspotObjectsTest.php | 455 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Unit/Jobs/Crm/SyncTeamMetadataTest.php | 8 +-
tests/Unit/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEventTest.php | 199 ++++++++++++++++++++++++++
tests/Unit/Listeners/Crm/ResolveOwnerTest.php | 64 ++++-----
tests/Unit/Repositories/AutomatedReportsRepositoryTest.php | 55 ++++++++
tests/Unit/Services/Crm/Copper/ServiceTest.php | 19 ---
tests/Unit/Services/Crm/Hubspot/ServiceTraits/OpportunitySyncTest.php | 74 ++++++----
tests/Unit/Services/Crm/Hubspot/ServiceTraits/SyncCrmEntitiesTraitTest.php | 8 +-
tests/Unit/Services/Crm/IntegrationApp/ServiceTraits/NotSupportedTraitTest.php | 76 ++--------
tests/Unit/Services/Crm/IntegrationApp/ServiceTraits/SyncCrmMetadataTraitTest.php | 5 -
tests/Unit/Services/Crm/Pipedrive/ServiceTest.php | 11 --
tests/Unit/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityServiceTest.php | 430 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Unit/Services/Kiosk/AutomatedReports/AutomatedReportsServiceTest.php | 521 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
113 files changed, 5468 insertions(+), 980 deletions(-)
create mode 100644 app/Console/Commands/Crm/SyncHubspotObjects.php
create mode 100644 app/Console/Commands/Crm/Traits/SyncObjectsCommandTrait.php
create mode 100644 app/Contracts/Services/Crm/ImportsBusinessProcessesInterface.php
create mode 100644 app/Events/AutomatedReports/AutomatedReportGenerated.php
create mode 100644 app/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJob.php
create mode 100644 app/Jobs/Crm/SyncHubspotObjects.php
create mode 100644 app/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEvent.php
create mode 100644 app/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityService.php
create mode 100644 front-end/src/components/AiReports/Manage/ExpiringCell.vue
create mode 100644 front-end/src/components/AiReports/Manage/__tests__/ExpiringCell.spec.js
create mode 100644 front-end/src/components/AiReports/constants.js
create mode 100644 front-end/src/components/AiReports/useAiReportsGrid.js
create mode 100644 front-end/src/components/Settings/Kiosk/AutomatedReports/__tests__/RecipientsCell.spec.js
create mode 100644 resources/views/emails/reports/ask-jiminny-report-generated.blade.php
create mode 100644 tests/Unit/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJobTest.php
create mode 100644 tests/Unit/Jobs/Crm/SyncHubspotObjectsTest.php
create mode 100644 tests/Unit/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEventTest.php
create mode 100644 tests/Unit/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityServiceTest.php
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20372-ai-reports-promotion-pages) $ git status
On branch JY-20372-ai-reports-promotion-pages
Your branch is up to date with 'origin/JY-20372-ai-reports-promotion-pages'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .env.local
modified: app/Console/Commands/JiminnyDebugCommand.php
modified: app/Http/Controllers/API/ActivityController.php
modified: app/Http/Transformers/UserTransformer.php
modified: app/Jobs/Team/SyncToIntercom.php
modified: app/Repositories/AutomatedReportsRepository.php
modified: app/Services/PlaybackService.php
modified: config/logging.php
modified: tests/Unit/Repositories/AutomatedReportsRepositoryTest.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
.env.nikilocal
.env.other
WEBHOOK_FILTERING_IMPLEMENTATION.md
app/Console/Commands/Crm/Hubspot/SimulateWebhooksCommand.php
app/Console/Commands/Reports/CreateMockAskJiminnyReportResultCommand.php
ids.txt
raw_sql_query.sql
tests/Unit/Policies/CanAccessAiReportsTest.php
no changes added to commit (use "git add" and/or "git commit -a")
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20372-ai-reports-promotion-pages) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5613/5613 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
1) app/Console/Commands/JiminnyDebugCommand.php (braces_position, statement_indentation)
---------- begin diff ----------
--- /home/jiminny/app/Console/Commands/JiminnyDebugCommand.php
+++ /home/jiminny/app/Console/Commands/JiminnyDebugCommand.php
@@ -37,15 +37,14 @@
JobDispatcherInterface $jobDispatcher,
AutomatedReportsService $automatedReportsService,
AutomatedReportsRepository $automatedReportsRepository,
- ): void
- {
-// $user = User::find(143);
-// $count = $automatedReportsRepository->countUserReports($user);
-// $this->info("Count: {$count}");
-// $count = $automatedReportsRepository->countAllUserReports($user);
-// $this->info("All count: {$count}");
-//
-// exit(1);
+ ): void {
+ // $user = User::find(143);
+ // $count = $automatedReportsRepository->countUserReports($user);
+ // $this->info("Count: {$count}");
+ // $count = $automatedReportsRepository->countAllUserReports($user);
+ // $this->info("All count: {$count}");
+ //
+ // exit(1);
$now = Carbon::now()->subDay(1);
$this->info("Now: {$now->toDateTimeString()}");
@@ -52,18 +51,18 @@
$weekStart = Carbon::getWeekStartsAt();
$this->info("Now: {$weekStart}");
-// $from = $now->copy()->previousWeekday()->startOfDay();
-// $to = $now->copy()->previousWeekday()->endOfDay();
+ // $from = $now->copy()->previousWeekday()->startOfDay();
+ // $to = $now->copy()->previousWeekday()->endOfDay();
-// $fromOld = $now->copy()->subWeeks(1)->startOfDay();
-// $toOld = $now->copy()->subDay()->endOfDay();
-// $fromNew = $now->copy()->subWeek()->startOfWeek();
-// $toNew = $now->copy()->subWeek()->endOfWeek();
+ // $fromOld = $now->copy()->subWeeks(1)->startOfDay();
+ // $toOld = $now->copy()->subDay()->endOfDay();
+ // $fromNew = $now->copy()->subWeek()->startOfWeek();
+ // $toNew = $now->copy()->subWeek()->endOfWeek();
-// $fromOld = $now->copy()->subMonths(1)->startOfDay();
-// $toOld = $now->copy()->subDay()->endOfDay();
-// $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
-// $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
+ // $fromOld = $now->copy()->subMonths(1)->startOfDay();
+ // $toOld = $now->copy()->subDay()->endOfDay();
+ // $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
+ // $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
$fromOld = $now->copy()->subMonths(3)->startOfDay();
$toOld = $now->copy()->subDay()->endOfDay();
----------- end diff -----------
Fixed 1 of 5613 files in 66.818 seconds, 67.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5616/5616 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Fixed 0 of 5616 files in 65.183 seconds, 60.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ ;xd
docker exec -it docker_lamp_1 bash -c "mv /usr/local/etc/php/conf.d/xdebug.ini ~/xdebug.ini"
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5616/5616 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Fixed 0 of 5616 files in 40.863 seconds, 60.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (master) $ git pull
remote: Enumerating objects: 53, done.
remote: Counting objects: 100% (53/53), done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 53 (delta 33), reused 49 (delta 30), pack-reused 0 (from 0)
Unpacking objects: 100% (53/53), 46.00 KiB | 523.00 KiB/s, done.
From github.com:jiminny/app
b1d5c77ad1..dfc8da14d2 JY-20372-ai-reports-promotion-pages -> origin/JY-20372-ai-reports-promotion-pages
+ 47037d2c29...5138acf14e secfix/npm-20260423 -> origin/secfix/npm-20260423 (forced update)
Already up to date.
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (master) $ co -b JY-20738-debug-AJ-tracking-UP
Switched to a new branch 'JY-20738-debug-AJ-tracking-UP'
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20738-debug-AJ-tracking-UP) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5621/5621 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Fixed 0 of 5621 files in 22.942 seconds, 60.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at https://docs.docker.com/go/debug-cli/
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20738-debug-AJ-tracking-UP) $
DOCKER
Close Tab
DEV (docker)
Close Tab
APP (-zsh)
Close Tab
screenpipe"
Close Tab
-zsh
Close Tab
-zsh
Close Tab
⌥⌘1
APP (-zsh)...
|
iTerm2
|
APP (-zsh)
|
NULL
|
77278
|
|
Firefox• 0FileEditViewHistory→BookmarksProfilesToo Firefox• 0FileEditViewHistory→BookmarksProfilesToolsWindowHelpmeet.google.com/agt-teir-cwt?authuser=lukas.kovalik%40jiminny.com•Daily - Platform - now100% K78 • Fri 24 Apr 9:46:13|=Pop out this videoNikolay NikolovStefka StoyanovaGalya DimitrovaLukas Kovalik9:46 AM | Daily - Platform• 0:27...
|
PhpStorm
|
faVsco.js – JiminnyDebugCommand.php
|
NULL
|
77279
|
|
DMSActivityMorerireroxToolsHelpcalMistorbookmarksJ DMSActivityMorerireroxToolsHelpcalMistorbookmarksJiminny …..vXStarredi• jiminny-x-integrati..8 platform-inner-teamE) Channels# ai-chapter# ai-team# alerts# backend# c-learning-peoplei confusion-clinic# curiosity_labadeal-insichts-dev# engineering# frontend# general# infra-changes# jiminny-bg8 people-with-copilo...8 people-with-zoom-# platform-team# platform-tickets# product_launches# random# releases# sofia-office# support# thank-yous# the Deople of iimi...ProtllesWindow& platform-inner-...& 10MessagesChannel OverviewMoreYesterdayjinnylaop Aor 22nd Added by GitHubNikolay Ivanov 3:24 PMнякой нещо да е настроивал по githubactions. Почна да прави къмити вместо менбез да съм му разрешевал?https:/github.com/lminnv/app/pull/1200//changes/a68f42f210859f838a4fdced451f750627besoioИли нещо аз не разбирам?0AA0e 20 replies Last reply 18...Nikolay Yankov 3:50PMreplied to a uhread: някои нешо ла е насто..лол. ами предлагам маи ла му заораним лапускам към всички ла вилятNikolav Yankov 9.38 AMЩе се забавя за дейлито. Започнете без Мен.Aneliva Angelova 9:43 AMIДобро утро, няма да успея да вляза влейлито. Пествам ньлжовете.Message & platform-inner-team+ Aa I..•) New TabAl reports promotion pages by nik• JY-9712 | Nuges to expire after on8 Jiminnyu Userpilot Logged-activityJY-20157 add not enough activ XPipelines - jiminny/app+ New Tab©github.com/jimjiminny / app 8<> Code87 Pull requests 31( Agents |© Actions•• Wiki © Security and quality 32 ~ Insights 3 Settings@ On April 24 we'll start using GitHub Copilot interaction data for Al model training unless you opt out. Review this update and manage your preferences in your GitHub account settings.JY-20157 add not enough activities notification #12011 •$1 Open LakyLak wants to merge 2 commits into master from JY-20157-AJ-report-not-send-notification@) Conversation o• Commits 2|- Checks 21E Files changed 13A © All commits +Q Filter files...apo/Console/Commands/Reports/AutomatedReportsCommand.ohp@ -61,21 +61,29 @ public function handle(): intv = Console/Commands/Renorts|Snow = Carbon: : now();E AutomatedReportsCommand...v Jobs/AutomatedReportsE RequestGenerateAskJiminnyR...SendReportNotGeneratedMail...v @ Listeners/AutomatedReports/U….E TrackAutomatedReportGener...v # Mail/ReportsS1sMondav = Snow->1SMonday)S1sr1rstDayUtMonth = Snow->day === 1;ScurrentMonth = Snow->month.// Check if the current month is a quarterly month (January, April, July, October)$isQuarterlyMonth = in_array($currentMonth, [1, 4, 7, 10], true);$this->logger->info(self::LOG_PREFIX . ' Checking conditions', [+ ReportNotGenerated.ohp |"1SMonday' => S1SMonday,~ E Services/Kiosk/AutomatedRepo…..AskJiminnyReportActivityServ…'isFirstDay0fMonth' => SisFirstDay0fMonth,'currentMonth' => ScurrentMonth.E AutomatedReportsService.php'isQuarterlyMonth' => SisQuarterlyMonth,~E resources/views/emails/reportsreport-not-generated.blade.php/I Process dailv revortsl• F tests/UnitSthis->processReports(AutomatedReportsService::FREQUENCYDAILY):~ Jobs/AutomatedReportsE ReguestGenerateAsk JiminnvR....v = listeners/AutomatedRenorts/U.₴ TrackAutomatedReportGener..v E Services/Kiosk/AutomatedRepo…..E AskJiminnyReportActivityServ....AutomatedReportsServiceActi…./ Process weekly renorts on Mondavcif (SisMondav) {64 +67 +74 +86 +@40@ Daily - Platform - nowQ Type to search100% C4 8• Fri 24 Apr 9:46:13• Checks pending Code • (Preview) -+384 -52 9000C 0 I 13 viewedSubmit review+10 -2 mane [ Viewed0 ...Snow = Carhon:.nowdSisMondav = Snow->1SMonday)"Sisweekend = $now->isWeekend():SisFirstDay0fMonth = Snow->day === 1;ScurrentMonth = Snow->month.SisManualTrigger = $this->option('report-id') !== null;// Check if the current month is a quarterly month (January, April, July, October)$isQuarterlyMonth = in_array($currentMonth, [1, 4, 7, 10], true);Sthis->loager->info(self::L0G PREFIX . ' Checkina conditions'. [I"isMonday' => SisMonday,'isweekend' => $isWeekend,'isFirstDay0fMonth' => $isFirstDay0fMonth,'currentMonth' => ScurrentMonth.l'isQuarterlyMonth' => SisQuarterlyMonth,/ Process dailv renorts on weekdavs onlv (skio Saturdav/Sundav)...// Manual triggers via --report-id bypass the weekend skip.if (I Sisweekend || SisManualTriager) {Sthis->processReports(AutomatedReportsService::FREQUENCY_DAILY):} else {ISthis->logger->info(self::L0G PREFIX . ' Skipping daily reports on weekend'):/ Process weekly renorts on Mondavslif (SisMonday) {...
|
PhpStorm
|
faVsco.js – JiminnyDebugCommand.php
|
NULL
|
77280
|
|
Firefox• 0FileEditViewHistory→BookmarksProfilesToo Firefox• 0FileEditViewHistory→BookmarksProfilesToolsWindowHelpmeet.google.com/agt-teir-cwt?authuser=lukas.kovalik%40jiminny.com•Daily - Platform - now100% K78 • Fri 24 Apr 9:46:13|=Pop out this videoNikolay NikolovStefka StoyanovaGalya DimitrovaLukas Kovalik9:46 AM | Daily - Platform• 0:27...
|
PhpStorm
|
faVsco.js – JiminnyDebugCommand.php
|
NULL
|
77281
|
|
Last login: Thu Apr 23 14:01:28 on ttys007
Poetry Last login: Thu Apr 23 14:01:28 on ttys007
Poetry could not find a pyproject.toml file in /Users/lukas/jiminny/app or its parents
Poetry could not find a pyproject.toml file in /Users/lukas/jiminny/app or its parents
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ git status
On branch JY-20157-AJ-report-not-send-notification
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .env.local
modified: app/Console/Commands/JiminnyDebugCommand.php
modified: app/Http/Controllers/API/ActivityController.php
modified: app/Jobs/Team/SyncToIntercom.php
modified: app/Services/PlaybackService.php
modified: config/logging.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
.env.nikilocal
.env.other
WEBHOOK_FILTERING_IMPLEMENTATION.md
app/Console/Commands/Crm/Hubspot/SimulateWebhooksCommand.php
app/Console/Commands/Reports/CreateMockAskJiminnyReportResultCommand.php
ids.txt
raw_sql_query.sql
tests/Unit/Policies/CanAccessAiReportsTest.php
no changes added to commit (use "git add" and/or "git commit -a")
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ git status
On branch JY-20372-ai-reports-promotion-pages
Your branch is up to date with 'origin/JY-20372-ai-reports-promotion-pages'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .env.local
modified: app/Console/Commands/JiminnyDebugCommand.php
modified: app/Http/Controllers/API/ActivityController.php
modified: app/Jobs/Team/SyncToIntercom.php
modified: app/Services/PlaybackService.php
modified: config/logging.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
.env.nikilocal
.env.other
WEBHOOK_FILTERING_IMPLEMENTATION.md
app/Console/Commands/Crm/Hubspot/SimulateWebhooksCommand.php
app/Console/Commands/Reports/CreateMockAskJiminnyReportResultCommand.php
ids.txt
raw_sql_query.sql
tests/Unit/Policies/CanAccessAiReportsTest.php
no changes added to commit (use "git add" and/or "git commit -a")
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20372-ai-reports-promotion-pages) $ git pull
remote: Enumerating objects: 1015, done.
remote: Counting objects: 100% (262/262), done.
remote: Compressing objects: 100% (143/143), done.
remote: Total 1015 (delta 167), reused 129 (delta 119), pack-reused 753 (from 3)
Receiving objects: 100% (1015/1015), 851.14 KiB | 2.09 MiB/s, done.
Resolving deltas: 100% (613/613), completed with 65 local objects.
From github.com:jiminny/app
c3c8d86b22..68bb20c72a JY-20372-ai-reports-promotion-pages -> origin/JY-20372-ai-reports-promotion-pages
3ac71c265a..595c95b7e0 JY-19995-delete-leftover-tracks-command -> origin/JY-19995-delete-leftover-tracks-command
* [new branch] JY-20352-sync-opportunities-without-a-local-owner-user-id-is-null -> origin/JY-20352-sync-opportunities-without-a-local-owner-user-id-is-null
* [new branch] JY-20478-stop-sync-calendar-emails -> origin/JY-20478-stop-sync-calendar-emails
d4d05c775b..b11048beed JY-20541-cleanup-stale-tasks-and-events -> origin/JY-20541-cleanup-stale-tasks-and-events
10d290c778..a250abe939 JY-20663-partner-rockeed -> origin/JY-20663-partner-rockeed
* [new branch] JY-20713-activity-sync-job-restart -> origin/JY-20713-activity-sync-job-restart
242cf1b554..96a22e59f2 JY-9712-change-forever-nudges-to-1-year-expiration -> origin/JY-9712-change-forever-nudges-to-1-year-expiration
* [new branch] fix-close-missing-logger-error -> origin/fix-close-missing-logger-error
0dd5b23990..60fa1787c1 master -> origin/master
f044edca5b..e7e0e50b27 secfix/npm-20260416 -> origin/secfix/npm-20260416
* [new branch] secfix/npm-20260423 -> origin/secfix/npm-20260423
Updating c3c8d86b22..68bb20c72a
Fast-forward
Makefile | 5 +
app/Component/Activity/Services/UpdateActivityService.php | 5 +
app/Component/ActivitySearch/FilterDefinition/ActivityUpdatedDate.php | 7 +-
app/Component/ActivitySearch/Service/ActivitySearch.php | 15 ++
app/Component/AiCallScoring/Services/GenerateAiCallScoringService.php | 6 +
app/Component/AiCallScoring/Services/GetAiCallScoringService.php | 5 +-
app/Component/AiCallScoring/Transformers/AiCallScoringTransformer.php | 2 +-
app/Component/ProphetAi/ProphetClient.php | 5 +
app/Console/Commands/Crm/SyncHubspotObjects.php | 84 +++++++++++
app/Console/Commands/Crm/SyncObjects.php | 82 ++++++-----
app/Console/Commands/Crm/Traits/SyncObjectsCommandTrait.php | 81 +++++++++++
app/Console/Commands/Reports/AutomatedReportsCommand.php | 91 +++++++++++-
app/Console/Commands/Reports/AutomatedReportsSendCommand.php | 40 +++++-
app/Console/Kernel.php | 4 +
app/Contracts/Services/Crm/ImportsBusinessProcessesInterface.php | 15 ++
app/Contracts/Services/Crm/Provider/SalesforceInterface.php | 12 +-
app/Contracts/Services/Crm/ServiceInterface.php | 29 ----
app/Contracts/Services/Crm/SyncCrmMetadataInterface.php | 6 +-
app/Events/AutomatedReports/AutomatedReportGenerated.php | 15 ++
app/Http/Controllers/API/CrmController.php | 19 ++-
app/Http/Controllers/API/UserAutomatedReports/UserAutomatedReportsController.php | 33 ++++-
app/Http/Controllers/Internal/WebhookReceiver/HubspotController.php | 2 +-
app/Http/Controllers/Webhook/Hubspot/EventsController.php | 2 +-
app/Http/Controllers/Webhook/Hubspot/ProcessesWebhooksTrait.php | 64 ++++++---
app/Http/Controllers/Webhook/ReportController.php | 5 +
app/Http/Requests/Settings/AiCallScoring/CreateOrUpdateAiScorecardRequest.php | 2 +-
app/Http/Requests/Settings/AiCallScoring/CreateOrUpdateAiScorecardRuleRequest.php | 2 +-
app/Http/Requests/Settings/AiCallScoring/TestAiCallScoringPromptRequest.php | 2 +-
app/Jobs/Activity/SyncActivity.php | 3 +-
app/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJob.php | 210 ++++++++++++++++++++++++++++
app/Jobs/AutomatedReports/SendReportJob.php | 2 +
app/Jobs/AutomatedReports/SendReportMailJob.php | 6 +-
app/Jobs/Crm/SyncActivity.php | 10 ++
app/Jobs/Crm/SyncHubspotObjects.php | 120 ++++++++++++++++
app/Jobs/Crm/SyncObjects.php | 26 ++--
app/Jobs/Crm/SyncTeamMetadata.php | 14 +-
app/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEvent.php | 82 +++++++++++
app/Listeners/Crm/ResolveOwner.php | 21 +--
app/Mail/Reports/ReportWithAttachment.php | 7 +-
app/Models/Ai/AiScorecardRuleRun.php | 4 +-
app/Models/Ai/AiScorecardRun.php | 4 +-
app/Models/Contracts/UserContract.php | 6 +
app/Providers/EventServiceProvider.php | 4 +
app/Repositories/AutomatedReportsRepository.php | 76 +++++++++-
app/Repositories/Crm/CrmEntityRepository.php | 40 ++++++
app/Services/Crm/BaseService.php | 13 --
app/Services/Crm/Bullhorn/BullhornService.php | 21 ---
app/Services/Crm/Close/Service.php | 38 -----
app/Services/Crm/Copper/Service.php | 37 -----
app/Services/Crm/Dummy/Service.php | 25 ----
app/Services/Crm/Hubspot/Service.php | 37 -----
app/Services/Crm/Hubspot/ServiceTraits/OpportunitySyncTrait.php | 174 +++++++++++++++++------
app/Services/Crm/Hubspot/ServiceTraits/SyncCrmEntitiesTrait.php | 27 ++--
app/Services/Crm/IntegrationApp/Service.php | 2 +
app/Services/Crm/IntegrationApp/ServiceTraits/NotSupportedTrait.php | 12 +-
app/Services/Crm/IntegrationApp/ServiceTraits/SyncCrmMetadataTrait.php | 5 -
app/Services/Crm/Pipedrive/Service.php | 43 +-----
app/Services/Crm/Salesforce/Service.php | 13 +-
app/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityService.php | 143 +++++++++++++++++++
app/Services/Kiosk/AutomatedReports/AutomatedReportsService.php | 222 +++++++++++++++++++++++++----
front-end/package.json | 2 +-
front-end/src/__mocks__/kit/endpoints/team-insights.js | 1 +
front-end/src/components/AiReports/AiReports.vue | 9 +-
front-end/src/components/AiReports/GridCells/ActionsCell.vue | 107 +++++++++++---
front-end/src/components/AiReports/GridCells/NameCell.vue | 13 +-
front-end/src/components/AiReports/GridCells/TypeIndicator.vue | 26 ++--
front-end/src/components/AiReports/Manage/CreateDefinition/CreateDefinitionDrawer.vue | 4 +-
front-end/src/components/AiReports/Manage/ExpiringCell.vue | 86 ++++++++++++
front-end/src/components/AiReports/Manage/ManageAiReports.less | 6 +
front-end/src/components/AiReports/Manage/ManageAiReports.vue | 6 +-
front-end/src/components/AiReports/Manage/__tests__/ExpiringCell.spec.js | 116 +++++++++++++++
front-end/src/components/AiReports/Manage/__tests__/ManageAiReports.spec.js | 32 +++--
front-end/src/components/AiReports/Manage/__tests__/__snapshots__/create-definition-drawer.output.html | 83 ++++++++---
front-end/src/components/AiReports/Manage/__tests__/__snapshots__/edit-definition-drawer.output.html | 83 ++++++++---
front-end/src/components/AiReports/Manage/__tests__/__snapshots__/manage-ai-reports.output.html | 83 ++++++++---
front-end/src/components/AiReports/Manage/gridConfig.js | 12 +-
front-end/src/components/AiReports/__tests__/AiReports.spec.js | 45 +++++-
front-end/src/components/AiReports/__tests__/__mocks__/data.js | 49 +++++++
front-end/src/components/AiReports/__tests__/__mocks__/requestHandlers.js | 3 +
front-end/src/components/AiReports/__tests__/__snapshots__/ai-reports.output.html | 319 +++++++++++++++++++++++++++++++++++++++++-
front-end/src/components/AiReports/constants.js | 1 +
front-end/src/components/AiReports/gridConfig.js | 2 +-
front-end/src/components/AiReports/useAiReportsGrid.js | 27 ++++
front-end/src/components/Settings/Kiosk/AutomatedReports/RecipientsCell.vue | 36 ++++-
front-end/src/components/Settings/Kiosk/AutomatedReports/UsersCell.vue | 9 +-
front-end/src/components/Settings/Kiosk/AutomatedReports/__tests__/RecipientsCell.spec.js | 171 ++++++++++++++++++++++
front-end/src/components/Settings/OrgSettings/AiAutomation/CallScoring/ScorecardRuleForm.vue | 2 +-
front-end/src/components/TeamInsights/CoachingFrameworks/AICallScoring/aiCallScoringOverTime.ts | 18 ++-
front-end/src/components/shared/GridView/useOrder.js | 6 +-
front-end/src/components/shared/GridView/usePaginationList.js | 7 +-
front-end/yarn.lock | 8 +-
resources/views/emails/reports/ask-jiminny-report-generated.blade.php | 25 ++++
routes/api.php | 1 +
tests/Unit/Component/Activity/Services/UpdateActivityServiceTest.php | 62 ++++++++
tests/Unit/Component/AiCallScoring/Services/GenerateAiCallScoringServiceTest.php | 13 +-
tests/Unit/Console/Commands/Reports/AutomatedReportsCommandTest.php | 468 ++++++++++++++++++++++++++++++++++++++++++-------------------
tests/Unit/Http/Controllers/Webhook/Hubspot/ProcessesWebhooksTraitTest.php | 5 +-
tests/Unit/Http/Controllers/Webhook/ReportControllerTest.php | 9 +-
tests/Unit/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJobTest.php | 407 +++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Unit/Jobs/Crm/SyncActivityTest.php | 74 +++++++---
tests/Unit/Jobs/Crm/SyncHubspotObjectsTest.php | 455 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Unit/Jobs/Crm/SyncTeamMetadataTest.php | 8 +-
tests/Unit/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEventTest.php | 199 ++++++++++++++++++++++++++
tests/Unit/Listeners/Crm/ResolveOwnerTest.php | 64 ++++-----
tests/Unit/Repositories/AutomatedReportsRepositoryTest.php | 55 ++++++++
tests/Unit/Services/Crm/Copper/ServiceTest.php | 19 ---
tests/Unit/Services/Crm/Hubspot/ServiceTraits/OpportunitySyncTest.php | 74 ++++++----
tests/Unit/Services/Crm/Hubspot/ServiceTraits/SyncCrmEntitiesTraitTest.php | 8 +-
tests/Unit/Services/Crm/IntegrationApp/ServiceTraits/NotSupportedTraitTest.php | 76 ++--------
tests/Unit/Services/Crm/IntegrationApp/ServiceTraits/SyncCrmMetadataTraitTest.php | 5 -
tests/Unit/Services/Crm/Pipedrive/ServiceTest.php | 11 --
tests/Unit/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityServiceTest.php | 430 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Unit/Services/Kiosk/AutomatedReports/AutomatedReportsServiceTest.php | 521 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
113 files changed, 5468 insertions(+), 980 deletions(-)
create mode 100644 app/Console/Commands/Crm/SyncHubspotObjects.php
create mode 100644 app/Console/Commands/Crm/Traits/SyncObjectsCommandTrait.php
create mode 100644 app/Contracts/Services/Crm/ImportsBusinessProcessesInterface.php
create mode 100644 app/Events/AutomatedReports/AutomatedReportGenerated.php
create mode 100644 app/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJob.php
create mode 100644 app/Jobs/Crm/SyncHubspotObjects.php
create mode 100644 app/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEvent.php
create mode 100644 app/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityService.php
create mode 100644 front-end/src/components/AiReports/Manage/ExpiringCell.vue
create mode 100644 front-end/src/components/AiReports/Manage/__tests__/ExpiringCell.spec.js
create mode 100644 front-end/src/components/AiReports/constants.js
create mode 100644 front-end/src/components/AiReports/useAiReportsGrid.js
create mode 100644 front-end/src/components/Settings/Kiosk/AutomatedReports/__tests__/RecipientsCell.spec.js
create mode 100644 resources/views/emails/reports/ask-jiminny-report-generated.blade.php
create mode 100644 tests/Unit/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJobTest.php
create mode 100644 tests/Unit/Jobs/Crm/SyncHubspotObjectsTest.php
create mode 100644 tests/Unit/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEventTest.php
create mode 100644 tests/Unit/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityServiceTest.php
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20372-ai-reports-promotion-pages) $ git status
On branch JY-20372-ai-reports-promotion-pages
Your branch is up to date with 'origin/JY-20372-ai-reports-promotion-pages'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .env.local
modified: app/Console/Commands/JiminnyDebugCommand.php
modified: app/Http/Controllers/API/ActivityController.php
modified: app/Http/Transformers/UserTransformer.php
modified: app/Jobs/Team/SyncToIntercom.php
modified: app/Repositories/AutomatedReportsRepository.php
modified: app/Services/PlaybackService.php
modified: config/logging.php
modified: tests/Unit/Repositories/AutomatedReportsRepositoryTest.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
.env.nikilocal
.env.other
WEBHOOK_FILTERING_IMPLEMENTATION.md
app/Console/Commands/Crm/Hubspot/SimulateWebhooksCommand.php
app/Console/Commands/Reports/CreateMockAskJiminnyReportResultCommand.php
ids.txt
raw_sql_query.sql
tests/Unit/Policies/CanAccessAiReportsTest.php
no changes added to commit (use "git add" and/or "git commit -a")
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20372-ai-reports-promotion-pages) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5613/5613 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
1) app/Console/Commands/JiminnyDebugCommand.php (braces_position, statement_indentation)
---------- begin diff ----------
--- /home/jiminny/app/Console/Commands/JiminnyDebugCommand.php
+++ /home/jiminny/app/Console/Commands/JiminnyDebugCommand.php
@@ -37,15 +37,14 @@
JobDispatcherInterface $jobDispatcher,
AutomatedReportsService $automatedReportsService,
AutomatedReportsRepository $automatedReportsRepository,
- ): void
- {
-// $user = User::find(143);
-// $count = $automatedReportsRepository->countUserReports($user);
-// $this->info("Count: {$count}");
-// $count = $automatedReportsRepository->countAllUserReports($user);
-// $this->info("All count: {$count}");
-//
-// exit(1);
+ ): void {
+ // $user = User::find(143);
+ // $count = $automatedReportsRepository->countUserReports($user);
+ // $this->info("Count: {$count}");
+ // $count = $automatedReportsRepository->countAllUserReports($user);
+ // $this->info("All count: {$count}");
+ //
+ // exit(1);
$now = Carbon::now()->subDay(1);
$this->info("Now: {$now->toDateTimeString()}");
@@ -52,18 +51,18 @@
$weekStart = Carbon::getWeekStartsAt();
$this->info("Now: {$weekStart}");
-// $from = $now->copy()->previousWeekday()->startOfDay();
-// $to = $now->copy()->previousWeekday()->endOfDay();
+ // $from = $now->copy()->previousWeekday()->startOfDay();
+ // $to = $now->copy()->previousWeekday()->endOfDay();
-// $fromOld = $now->copy()->subWeeks(1)->startOfDay();
-// $toOld = $now->copy()->subDay()->endOfDay();
-// $fromNew = $now->copy()->subWeek()->startOfWeek();
-// $toNew = $now->copy()->subWeek()->endOfWeek();
+ // $fromOld = $now->copy()->subWeeks(1)->startOfDay();
+ // $toOld = $now->copy()->subDay()->endOfDay();
+ // $fromNew = $now->copy()->subWeek()->startOfWeek();
+ // $toNew = $now->copy()->subWeek()->endOfWeek();
-// $fromOld = $now->copy()->subMonths(1)->startOfDay();
-// $toOld = $now->copy()->subDay()->endOfDay();
-// $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
-// $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
+ // $fromOld = $now->copy()->subMonths(1)->startOfDay();
+ // $toOld = $now->copy()->subDay()->endOfDay();
+ // $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
+ // $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
$fromOld = $now->copy()->subMonths(3)->startOfDay();
$toOld = $now->copy()->subDay()->endOfDay();
----------- end diff -----------
Fixed 1 of 5613 files in 66.818 seconds, 67.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5616/5616 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Fixed 0 of 5616 files in 65.183 seconds, 60.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ ;xd
docker exec -it docker_lamp_1 bash -c "mv /usr/local/etc/php/conf.d/xdebug.ini ~/xdebug.ini"
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5616/5616 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Fixed 0 of 5616 files in 40.863 seconds, 60.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (master) $ git pull
remote: Enumerating objects: 53, done.
remote: Counting objects: 100% (53/53), done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 53 (delta 33), reused 49 (delta 30), pack-reused 0 (from 0)
Unpacking objects: 100% (53/53), 46.00 KiB | 523.00 KiB/s, done.
From github.com:jiminny/app
b1d5c77ad1..dfc8da14d2 JY-20372-ai-reports-promotion-pages -> origin/JY-20372-ai-reports-promotion-pages
+ 47037d2c29...5138acf14e secfix/npm-20260423 -> origin/secfix/npm-20260423 (forced update)
Already up to date.
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (master) $ co -b JY-20738-debug-AJ-tracking-UP
Switched to a new branch 'JY-20738-debug-AJ-tracking-UP'
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20738-debug-AJ-tracking-UP) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5621/5621 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Fixed 0 of 5621 files in 22.942 seconds, 60.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at https://docs.docker.com/go/debug-cli/
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20738-debug-AJ-tracking-UP) $
DOCKER
Close Tab
DEV (docker)
Close Tab
APP (-zsh)
Close Tab
screenpipe"
Close Tab
-zsh
Close Tab
-zsh
Close Tab
⌥⌘1
APP (-zsh)...
|
iTerm2
|
APP (-zsh)
|
NULL
|
77282
|
|
Last login: Thu Apr 23 14:01:28 on ttys007
Poetry Last login: Thu Apr 23 14:01:28 on ttys007
Poetry could not find a pyproject.toml file in /Users/lukas/jiminny/app or its parents
Poetry could not find a pyproject.toml file in /Users/lukas/jiminny/app or its parents
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ git status
On branch JY-20157-AJ-report-not-send-notification
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .env.local
modified: app/Console/Commands/JiminnyDebugCommand.php
modified: app/Http/Controllers/API/ActivityController.php
modified: app/Jobs/Team/SyncToIntercom.php
modified: app/Services/PlaybackService.php
modified: config/logging.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
.env.nikilocal
.env.other
WEBHOOK_FILTERING_IMPLEMENTATION.md
app/Console/Commands/Crm/Hubspot/SimulateWebhooksCommand.php
app/Console/Commands/Reports/CreateMockAskJiminnyReportResultCommand.php
ids.txt
raw_sql_query.sql
tests/Unit/Policies/CanAccessAiReportsTest.php
no changes added to commit (use "git add" and/or "git commit -a")
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ git status
On branch JY-20372-ai-reports-promotion-pages
Your branch is up to date with 'origin/JY-20372-ai-reports-promotion-pages'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .env.local
modified: app/Console/Commands/JiminnyDebugCommand.php
modified: app/Http/Controllers/API/ActivityController.php
modified: app/Jobs/Team/SyncToIntercom.php
modified: app/Services/PlaybackService.php
modified: config/logging.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
.env.nikilocal
.env.other
WEBHOOK_FILTERING_IMPLEMENTATION.md
app/Console/Commands/Crm/Hubspot/SimulateWebhooksCommand.php
app/Console/Commands/Reports/CreateMockAskJiminnyReportResultCommand.php
ids.txt
raw_sql_query.sql
tests/Unit/Policies/CanAccessAiReportsTest.php
no changes added to commit (use "git add" and/or "git commit -a")
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20372-ai-reports-promotion-pages) $ git pull
remote: Enumerating objects: 1015, done.
remote: Counting objects: 100% (262/262), done.
remote: Compressing objects: 100% (143/143), done.
remote: Total 1015 (delta 167), reused 129 (delta 119), pack-reused 753 (from 3)
Receiving objects: 100% (1015/1015), 851.14 KiB | 2.09 MiB/s, done.
Resolving deltas: 100% (613/613), completed with 65 local objects.
From github.com:jiminny/app
c3c8d86b22..68bb20c72a JY-20372-ai-reports-promotion-pages -> origin/JY-20372-ai-reports-promotion-pages
3ac71c265a..595c95b7e0 JY-19995-delete-leftover-tracks-command -> origin/JY-19995-delete-leftover-tracks-command
* [new branch] JY-20352-sync-opportunities-without-a-local-owner-user-id-is-null -> origin/JY-20352-sync-opportunities-without-a-local-owner-user-id-is-null
* [new branch] JY-20478-stop-sync-calendar-emails -> origin/JY-20478-stop-sync-calendar-emails
d4d05c775b..b11048beed JY-20541-cleanup-stale-tasks-and-events -> origin/JY-20541-cleanup-stale-tasks-and-events
10d290c778..a250abe939 JY-20663-partner-rockeed -> origin/JY-20663-partner-rockeed
* [new branch] JY-20713-activity-sync-job-restart -> origin/JY-20713-activity-sync-job-restart
242cf1b554..96a22e59f2 JY-9712-change-forever-nudges-to-1-year-expiration -> origin/JY-9712-change-forever-nudges-to-1-year-expiration
* [new branch] fix-close-missing-logger-error -> origin/fix-close-missing-logger-error
0dd5b23990..60fa1787c1 master -> origin/master
f044edca5b..e7e0e50b27 secfix/npm-20260416 -> origin/secfix/npm-20260416
* [new branch] secfix/npm-20260423 -> origin/secfix/npm-20260423
Updating c3c8d86b22..68bb20c72a
Fast-forward
Makefile | 5 +
app/Component/Activity/Services/UpdateActivityService.php | 5 +
app/Component/ActivitySearch/FilterDefinition/ActivityUpdatedDate.php | 7 +-
app/Component/ActivitySearch/Service/ActivitySearch.php | 15 ++
app/Component/AiCallScoring/Services/GenerateAiCallScoringService.php | 6 +
app/Component/AiCallScoring/Services/GetAiCallScoringService.php | 5 +-
app/Component/AiCallScoring/Transformers/AiCallScoringTransformer.php | 2 +-
app/Component/ProphetAi/ProphetClient.php | 5 +
app/Console/Commands/Crm/SyncHubspotObjects.php | 84 +++++++++++
app/Console/Commands/Crm/SyncObjects.php | 82 ++++++-----
app/Console/Commands/Crm/Traits/SyncObjectsCommandTrait.php | 81 +++++++++++
app/Console/Commands/Reports/AutomatedReportsCommand.php | 91 +++++++++++-
app/Console/Commands/Reports/AutomatedReportsSendCommand.php | 40 +++++-
app/Console/Kernel.php | 4 +
app/Contracts/Services/Crm/ImportsBusinessProcessesInterface.php | 15 ++
app/Contracts/Services/Crm/Provider/SalesforceInterface.php | 12 +-
app/Contracts/Services/Crm/ServiceInterface.php | 29 ----
app/Contracts/Services/Crm/SyncCrmMetadataInterface.php | 6 +-
app/Events/AutomatedReports/AutomatedReportGenerated.php | 15 ++
app/Http/Controllers/API/CrmController.php | 19 ++-
app/Http/Controllers/API/UserAutomatedReports/UserAutomatedReportsController.php | 33 ++++-
app/Http/Controllers/Internal/WebhookReceiver/HubspotController.php | 2 +-
app/Http/Controllers/Webhook/Hubspot/EventsController.php | 2 +-
app/Http/Controllers/Webhook/Hubspot/ProcessesWebhooksTrait.php | 64 ++++++---
app/Http/Controllers/Webhook/ReportController.php | 5 +
app/Http/Requests/Settings/AiCallScoring/CreateOrUpdateAiScorecardRequest.php | 2 +-
app/Http/Requests/Settings/AiCallScoring/CreateOrUpdateAiScorecardRuleRequest.php | 2 +-
app/Http/Requests/Settings/AiCallScoring/TestAiCallScoringPromptRequest.php | 2 +-
app/Jobs/Activity/SyncActivity.php | 3 +-
app/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJob.php | 210 ++++++++++++++++++++++++++++
app/Jobs/AutomatedReports/SendReportJob.php | 2 +
app/Jobs/AutomatedReports/SendReportMailJob.php | 6 +-
app/Jobs/Crm/SyncActivity.php | 10 ++
app/Jobs/Crm/SyncHubspotObjects.php | 120 ++++++++++++++++
app/Jobs/Crm/SyncObjects.php | 26 ++--
app/Jobs/Crm/SyncTeamMetadata.php | 14 +-
app/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEvent.php | 82 +++++++++++
app/Listeners/Crm/ResolveOwner.php | 21 +--
app/Mail/Reports/ReportWithAttachment.php | 7 +-
app/Models/Ai/AiScorecardRuleRun.php | 4 +-
app/Models/Ai/AiScorecardRun.php | 4 +-
app/Models/Contracts/UserContract.php | 6 +
app/Providers/EventServiceProvider.php | 4 +
app/Repositories/AutomatedReportsRepository.php | 76 +++++++++-
app/Repositories/Crm/CrmEntityRepository.php | 40 ++++++
app/Services/Crm/BaseService.php | 13 --
app/Services/Crm/Bullhorn/BullhornService.php | 21 ---
app/Services/Crm/Close/Service.php | 38 -----
app/Services/Crm/Copper/Service.php | 37 -----
app/Services/Crm/Dummy/Service.php | 25 ----
app/Services/Crm/Hubspot/Service.php | 37 -----
app/Services/Crm/Hubspot/ServiceTraits/OpportunitySyncTrait.php | 174 +++++++++++++++++------
app/Services/Crm/Hubspot/ServiceTraits/SyncCrmEntitiesTrait.php | 27 ++--
app/Services/Crm/IntegrationApp/Service.php | 2 +
app/Services/Crm/IntegrationApp/ServiceTraits/NotSupportedTrait.php | 12 +-
app/Services/Crm/IntegrationApp/ServiceTraits/SyncCrmMetadataTrait.php | 5 -
app/Services/Crm/Pipedrive/Service.php | 43 +-----
app/Services/Crm/Salesforce/Service.php | 13 +-
app/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityService.php | 143 +++++++++++++++++++
app/Services/Kiosk/AutomatedReports/AutomatedReportsService.php | 222 +++++++++++++++++++++++++----
front-end/package.json | 2 +-
front-end/src/__mocks__/kit/endpoints/team-insights.js | 1 +
front-end/src/components/AiReports/AiReports.vue | 9 +-
front-end/src/components/AiReports/GridCells/ActionsCell.vue | 107 +++++++++++---
front-end/src/components/AiReports/GridCells/NameCell.vue | 13 +-
front-end/src/components/AiReports/GridCells/TypeIndicator.vue | 26 ++--
front-end/src/components/AiReports/Manage/CreateDefinition/CreateDefinitionDrawer.vue | 4 +-
front-end/src/components/AiReports/Manage/ExpiringCell.vue | 86 ++++++++++++
front-end/src/components/AiReports/Manage/ManageAiReports.less | 6 +
front-end/src/components/AiReports/Manage/ManageAiReports.vue | 6 +-
front-end/src/components/AiReports/Manage/__tests__/ExpiringCell.spec.js | 116 +++++++++++++++
front-end/src/components/AiReports/Manage/__tests__/ManageAiReports.spec.js | 32 +++--
front-end/src/components/AiReports/Manage/__tests__/__snapshots__/create-definition-drawer.output.html | 83 ++++++++---
front-end/src/components/AiReports/Manage/__tests__/__snapshots__/edit-definition-drawer.output.html | 83 ++++++++---
front-end/src/components/AiReports/Manage/__tests__/__snapshots__/manage-ai-reports.output.html | 83 ++++++++---
front-end/src/components/AiReports/Manage/gridConfig.js | 12 +-
front-end/src/components/AiReports/__tests__/AiReports.spec.js | 45 +++++-
front-end/src/components/AiReports/__tests__/__mocks__/data.js | 49 +++++++
front-end/src/components/AiReports/__tests__/__mocks__/requestHandlers.js | 3 +
front-end/src/components/AiReports/__tests__/__snapshots__/ai-reports.output.html | 319 +++++++++++++++++++++++++++++++++++++++++-
front-end/src/components/AiReports/constants.js | 1 +
front-end/src/components/AiReports/gridConfig.js | 2 +-
front-end/src/components/AiReports/useAiReportsGrid.js | 27 ++++
front-end/src/components/Settings/Kiosk/AutomatedReports/RecipientsCell.vue | 36 ++++-
front-end/src/components/Settings/Kiosk/AutomatedReports/UsersCell.vue | 9 +-
front-end/src/components/Settings/Kiosk/AutomatedReports/__tests__/RecipientsCell.spec.js | 171 ++++++++++++++++++++++
front-end/src/components/Settings/OrgSettings/AiAutomation/CallScoring/ScorecardRuleForm.vue | 2 +-
front-end/src/components/TeamInsights/CoachingFrameworks/AICallScoring/aiCallScoringOverTime.ts | 18 ++-
front-end/src/components/shared/GridView/useOrder.js | 6 +-
front-end/src/components/shared/GridView/usePaginationList.js | 7 +-
front-end/yarn.lock | 8 +-
resources/views/emails/reports/ask-jiminny-report-generated.blade.php | 25 ++++
routes/api.php | 1 +
tests/Unit/Component/Activity/Services/UpdateActivityServiceTest.php | 62 ++++++++
tests/Unit/Component/AiCallScoring/Services/GenerateAiCallScoringServiceTest.php | 13 +-
tests/Unit/Console/Commands/Reports/AutomatedReportsCommandTest.php | 468 ++++++++++++++++++++++++++++++++++++++++++-------------------
tests/Unit/Http/Controllers/Webhook/Hubspot/ProcessesWebhooksTraitTest.php | 5 +-
tests/Unit/Http/Controllers/Webhook/ReportControllerTest.php | 9 +-
tests/Unit/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJobTest.php | 407 +++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Unit/Jobs/Crm/SyncActivityTest.php | 74 +++++++---
tests/Unit/Jobs/Crm/SyncHubspotObjectsTest.php | 455 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Unit/Jobs/Crm/SyncTeamMetadataTest.php | 8 +-
tests/Unit/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEventTest.php | 199 ++++++++++++++++++++++++++
tests/Unit/Listeners/Crm/ResolveOwnerTest.php | 64 ++++-----
tests/Unit/Repositories/AutomatedReportsRepositoryTest.php | 55 ++++++++
tests/Unit/Services/Crm/Copper/ServiceTest.php | 19 ---
tests/Unit/Services/Crm/Hubspot/ServiceTraits/OpportunitySyncTest.php | 74 ++++++----
tests/Unit/Services/Crm/Hubspot/ServiceTraits/SyncCrmEntitiesTraitTest.php | 8 +-
tests/Unit/Services/Crm/IntegrationApp/ServiceTraits/NotSupportedTraitTest.php | 76 ++--------
tests/Unit/Services/Crm/IntegrationApp/ServiceTraits/SyncCrmMetadataTraitTest.php | 5 -
tests/Unit/Services/Crm/Pipedrive/ServiceTest.php | 11 --
tests/Unit/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityServiceTest.php | 430 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Unit/Services/Kiosk/AutomatedReports/AutomatedReportsServiceTest.php | 521 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
113 files changed, 5468 insertions(+), 980 deletions(-)
create mode 100644 app/Console/Commands/Crm/SyncHubspotObjects.php
create mode 100644 app/Console/Commands/Crm/Traits/SyncObjectsCommandTrait.php
create mode 100644 app/Contracts/Services/Crm/ImportsBusinessProcessesInterface.php
create mode 100644 app/Events/AutomatedReports/AutomatedReportGenerated.php
create mode 100644 app/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJob.php
create mode 100644 app/Jobs/Crm/SyncHubspotObjects.php
create mode 100644 app/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEvent.php
create mode 100644 app/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityService.php
create mode 100644 front-end/src/components/AiReports/Manage/ExpiringCell.vue
create mode 100644 front-end/src/components/AiReports/Manage/__tests__/ExpiringCell.spec.js
create mode 100644 front-end/src/components/AiReports/constants.js
create mode 100644 front-end/src/components/AiReports/useAiReportsGrid.js
create mode 100644 front-end/src/components/Settings/Kiosk/AutomatedReports/__tests__/RecipientsCell.spec.js
create mode 100644 resources/views/emails/reports/ask-jiminny-report-generated.blade.php
create mode 100644 tests/Unit/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJobTest.php
create mode 100644 tests/Unit/Jobs/Crm/SyncHubspotObjectsTest.php
create mode 100644 tests/Unit/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEventTest.php
create mode 100644 tests/Unit/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityServiceTest.php
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20372-ai-reports-promotion-pages) $ git status
On branch JY-20372-ai-reports-promotion-pages
Your branch is up to date with 'origin/JY-20372-ai-reports-promotion-pages'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .env.local
modified: app/Console/Commands/JiminnyDebugCommand.php
modified: app/Http/Controllers/API/ActivityController.php
modified: app/Http/Transformers/UserTransformer.php
modified: app/Jobs/Team/SyncToIntercom.php
modified: app/Repositories/AutomatedReportsRepository.php
modified: app/Services/PlaybackService.php
modified: config/logging.php
modified: tests/Unit/Repositories/AutomatedReportsRepositoryTest.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
.env.nikilocal
.env.other
WEBHOOK_FILTERING_IMPLEMENTATION.md
app/Console/Commands/Crm/Hubspot/SimulateWebhooksCommand.php
app/Console/Commands/Reports/CreateMockAskJiminnyReportResultCommand.php
ids.txt
raw_sql_query.sql
tests/Unit/Policies/CanAccessAiReportsTest.php
no changes added to commit (use "git add" and/or "git commit -a")
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20372-ai-reports-promotion-pages) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5613/5613 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
1) app/Console/Commands/JiminnyDebugCommand.php (braces_position, statement_indentation)
---------- begin diff ----------
--- /home/jiminny/app/Console/Commands/JiminnyDebugCommand.php
+++ /home/jiminny/app/Console/Commands/JiminnyDebugCommand.php
@@ -37,15 +37,14 @@
JobDispatcherInterface $jobDispatcher,
AutomatedReportsService $automatedReportsService,
AutomatedReportsRepository $automatedReportsRepository,
- ): void
- {
-// $user = User::find(143);
-// $count = $automatedReportsRepository->countUserReports($user);
-// $this->info("Count: {$count}");
-// $count = $automatedReportsRepository->countAllUserReports($user);
-// $this->info("All count: {$count}");
-//
-// exit(1);
+ ): void {
+ // $user = User::find(143);
+ // $count = $automatedReportsRepository->countUserReports($user);
+ // $this->info("Count: {$count}");
+ // $count = $automatedReportsRepository->countAllUserReports($user);
+ // $this->info("All count: {$count}");
+ //
+ // exit(1);
$now = Carbon::now()->subDay(1);
$this->info("Now: {$now->toDateTimeString()}");
@@ -52,18 +51,18 @@
$weekStart = Carbon::getWeekStartsAt();
$this->info("Now: {$weekStart}");
-// $from = $now->copy()->previousWeekday()->startOfDay();
-// $to = $now->copy()->previousWeekday()->endOfDay();
+ // $from = $now->copy()->previousWeekday()->startOfDay();
+ // $to = $now->copy()->previousWeekday()->endOfDay();
-// $fromOld = $now->copy()->subWeeks(1)->startOfDay();
-// $toOld = $now->copy()->subDay()->endOfDay();
-// $fromNew = $now->copy()->subWeek()->startOfWeek();
-// $toNew = $now->copy()->subWeek()->endOfWeek();
+ // $fromOld = $now->copy()->subWeeks(1)->startOfDay();
+ // $toOld = $now->copy()->subDay()->endOfDay();
+ // $fromNew = $now->copy()->subWeek()->startOfWeek();
+ // $toNew = $now->copy()->subWeek()->endOfWeek();
-// $fromOld = $now->copy()->subMonths(1)->startOfDay();
-// $toOld = $now->copy()->subDay()->endOfDay();
-// $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
-// $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
+ // $fromOld = $now->copy()->subMonths(1)->startOfDay();
+ // $toOld = $now->copy()->subDay()->endOfDay();
+ // $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
+ // $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
$fromOld = $now->copy()->subMonths(3)->startOfDay();
$toOld = $now->copy()->subDay()->endOfDay();
----------- end diff -----------
Fixed 1 of 5613 files in 66.818 seconds, 67.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5616/5616 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Fixed 0 of 5616 files in 65.183 seconds, 60.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ ;xd
docker exec -it docker_lamp_1 bash -c "mv /usr/local/etc/php/conf.d/xdebug.ini ~/xdebug.ini"
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5616/5616 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Fixed 0 of 5616 files in 40.863 seconds, 60.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (master) $ git pull
remote: Enumerating objects: 53, done.
remote: Counting objects: 100% (53/53), done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 53 (delta 33), reused 49 (delta 30), pack-reused 0 (from 0)
Unpacking objects: 100% (53/53), 46.00 KiB | 523.00 KiB/s, done.
From github.com:jiminny/app
b1d5c77ad1..dfc8da14d2 JY-20372-ai-reports-promotion-pages -> origin/JY-20372-ai-reports-promotion-pages
+ 47037d2c29...5138acf14e secfix/npm-20260423 -> origin/secfix/npm-20260423 (forced update)
Already up to date.
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (master) $ co -b JY-20738-debug-AJ-tracking-UP
Switched to a new branch 'JY-20738-debug-AJ-tracking-UP'
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20738-debug-AJ-tracking-UP) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5621/5621 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Fixed 0 of 5621 files in 22.942 seconds, 60.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at https://docs.docker.com/go/debug-cli/
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20738-debug-AJ-tracking-UP) $
DOCKER
Close Tab
DEV (docker)
Close Tab
APP (-zsh)
Close Tab
screenpipe"
Close Tab
-zsh
Close Tab
-zsh
Close Tab
⌥⌘1
APP (-zsh)...
|
iTerm2
|
APP (-zsh)
|
NULL
|
77283
|
|
Project: faVsco.js, menu
JY-20738-debug-AJ-trackin Project: faVsco.js, menu
JY-20738-debug-AJ-tracking-UP, menu
Start Listening for PHP Debug Connections
ReportControllerTest
Run 'ReportControllerTest'
Debug 'ReportControllerTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
3
115
4
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use InvalidArgumentException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateAskJiminnyReportJob;
use Jiminny\Jobs\AutomatedReports\SendReportMailJob;
use Jiminny\Jobs\JobDispatcherInterface;
use Jiminny\Models\Activity;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Services\Activity\CrmOwnerResolver;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\UserPilot\UserPilotClient;
/**
* Class JiminnyDebugCommand
*
* @package Jiminny\Console\Commands
*/
class JiminnyDebugCommand extends Command
{
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';
protected $signature = 'jiminny:debug';
public function handle(
JobDispatcherInterface $jobDispatcher,
AutomatedReportsService $automatedReportsService,
AutomatedReportsRepository $automatedReportsRepository,
UserPilotClient $userPilotClient
): void {
$user = User::find(143);
// $count = $automatedReportsRepository->countUserReports($user);
// $this->info("Count: {$count}");
// $count = $automatedReportsRepository->countAllUserReports($user);
// $this->info("All count: {$count}");
$payload = [
'report_type' => 'ask_jiminny',
'frequency' => 'weekly',
];
$userPilotClient->track($user, 'ask-jiminny-report-generated', $payload);
exit(1);
$now = Carbon::now()->subDay(1);
$this->info("Now: {$now->toDateTimeString()}");
$weekStart = Carbon::getWeekStartsAt();
$this->info("Now: {$weekStart}");
// $from = $now->copy()->previousWeekday()->startOfDay();
// $to = $now->copy()->previousWeekday()->endOfDay();
// $fromOld = $now->copy()->subWeeks(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subWeek()->startOfWeek();
// $toNew = $now->copy()->subWeek()->endOfWeek();
// $fromOld = $now->copy()->subMonths(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
// $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
$fromOld = $now->copy()->subMonths(3)->startOfDay();
$toOld = $now->copy()->subDay()->endOfDay();
$fromNew = $now->copy()->subQuarterNoOverflow()->startOfQuarter();
$toNew = $now->copy()->subQuarterNoOverflow()->endOfQuarter();
$this->info("From old: {$fromOld->toDateTimeString()}");
$this->info("To old: {$toOld->toDateTimeString()}");
$this->info("From new: {$fromNew->toDateTimeString()}");
$this->info("To new: {$toNew->toDateTimeString()}");
exit(1);
$report = AutomatedReport::find(71);
$job = new RequestGenerateAskJiminnyReportJob($report->getUuid());
$jobDispatcher->dispatch($job);
exit(1);
// $this->formatDate($jobDispatcher);
// $this->sendMail($jobDispatcher, $automatedReportsService);
// $this->crmService();
$this->getPayload($automatedReportsService);
exit(1);
}
private function crmService()
{
$activity = Activity::find(418141);
$team = Team::find(19);
$config = $team->getCrmConfiguration();
$crmResolver = app(CrmOwnerResolver::class, [
'team' => $team,
'integrationAdmin' => $team->getOwner(),
'providerSlug' => $config->getProviderName(),
]);
$crmService = $crmResolver->prepareCrmService();
$crmService->createTranscriptNotes($activity);
}
private function sendMail(JobDispatcherInterface $jobDispatcher, AutomatedReportsService $automatedReportsService)
{
$reportUuid = '';
// $report = $automatedReportsService->getReportResult($reportUuid);
$report = AutomatedReportResult::find(275);
$validRecipients = $automatedReportsService->getValidRecipientUsers(
$report->getReport(),
includeJiminny: true,
);
$recipient = $validRecipients[0];
$fileName = $automatedReportsService->getReportFileName($report);
$typeName = $report->getReport()->getCustomName()
?? $automatedReportsService->getReportTypeName($report);
$teamsName = $automatedReportsService->getReportTeamsName($report);
$periodName = $automatedReportsService->getReportPeriodName($report);
$s3Path = $automatedReportsService->getMediaPath($report);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$fileName ' . PHP_EOL . print_r($fileName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$typeName ' . PHP_EOL . print_r($typeName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$teamsName ' . PHP_EOL . print_r($teamsName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$periodName ' . PHP_EOL . print_r($periodName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$s3Path ' . PHP_EOL . print_r($s3Path, true));
$jobDispatcher->dispatch(
new SendReportMailJob(
reportUuid: $report->getUuid(),
s3Path: $s3Path,
recipientEmail: $recipient['email'],
recipientName: $recipient['name'] ?? null,
fileName: $fileName,
typeName: $typeName,
teamsName: $teamsName,
periodName: $periodName,
isAskJiminny: true,
)
);
exit(1);
}
private function formatDate(JobDispatcherInterface $jobDispatcher): void
{
$customName = 'Custom report name';
// $frequency = self::FREQUENCY_DAILY;
// $frequency = self::FREQUENCY_WEEKLY;
$frequency = self::FREQUENCY_MONTHLY;
// $frequency = self::FREQUENCY_QUARTERLY;
// $frequency = self::FREQUENCY_ONE_OFF;
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
$periodName = $this->formatReportPeriodName($frequency, $from, $to);
$filenameSuffix = null;
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
$result = $this->sanitizeFileName("{$customName} - {$periodName}");
}
$this->info($result);
}
public function calculateFromAndToDatePeriod(
string $frequency,
?Carbon $fromDate = null,
?Carbon $toDate = null
): array {
if ($frequency === self::FREQUENCY_ONE_OFF) {
return [
'fromDate' => $fromDate,
'toDate' => $toDate,
];
}
$now = Carbon::now();
return match ($frequency) {
self::FREQUENCY_DAILY => [
'fromDate' => $now->copy()->subDay()->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_WEEKLY => [
'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_MONTHLY => [
'fromDate' => $now->copy()->subMonths(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_QUARTERLY => [
'fromDate' => $now->copy()->subMonths(3)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
default => throw new InvalidArgumentException("Unsupported frequency: {$frequency}"),
};
}
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 sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
private function getPayload(AutomatedReportsService $automatedReportsService)
{
$reportResult = AutomatedReportResult::find(269);
$automatedReport = $reportResult->getReport();
$activityIds = [1,2,3];
$payload = $automatedReportsService->getAskJiminnyGenerateReportPayload(
automatedReport: $automatedReport,
reportResult: $reportResult,
activityIds: $activityIds,
);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$payload ' . PHP_EOL . print_r($payload, true));
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
7
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Services\UserPilot;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Support\Facades\Http;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Partner;
use Jiminny\Models\Team;
use Jiminny\Models\User;
class UserPilotClient
{
private const API_ENDPOINT = 'https://api.userpilot.io/v1/';
private const ANALYTICS_ENDPOINT = 'https://analytex.userpilot.io/v1/';
private function createRequest(): PendingRequest
{
return Http::withHeaders([
'X-API-Version' => '2020-09-22',
'Authorization' => 'Token ' . config('services.userpilot.key'),
]);
}
public function track(User $user, string $event, array $payload = []): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'track', [
'event_name' => $event,
'user_id' => $user->getUuid(),
'metadata' => $payload,
]);
}
public function upsertUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$companyMetadata = $this->getCompanyMetadata($user->getTeam());
$companyMetadata['id'] = $user->getTeam()->getUuid();
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'identify', [
'user_id' => $user->getUuid(),
'metadata' => [
'name' => $user->name,
'first_name' => $user->getFirstName(),
'position' => $user->job ? $user->job->name : null,
'email' => $user->getEmailAddress(),
'created_at' => $user->getCreatedAt()->unix(),
'is_admin' => $user->hasRole(User::ROLE_ADMIN),
'is_manager' => $user->hasRole(User::ROLE_MANAGER),
'is_owner' => $user->isTeamOwner(),
'is_insights' => $user->hasRole(User::ROLE_ANALYST),
'is_recorder' => $user->hasRole(User::ROLE_RECORDER),
'is_jiminny_voice' => $user->hasRole(User::ROLE_RECORDER_AND_VOICE),
'is_listener' => $user->hasRole(User::ROLE_LISTENER),
'license' => null,
'team' => $user->group ? $user->group->name : null,
'language' => $user->getLanguage(),
'email_sync' => $user->isSyncEmailEnabled(),
],
'company' => $companyMetadata,
]);
}
public function upsertCompany(Team $team): void
{
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'companies/identify', [
'company_id' => $team->getUuid(),
'metadata' => $this->getCompanyMetadata($team),
]);
}
private function getCompanyMetadata(Team $team): array
{
return [
'created_at' => $team->getCreatedAt()->unix(),
'name' => $team->getName(),
'region' => config('jiminny.deploy_region'),
'crm' => $team->getCrmConfiguration()->getProviderName(),
'crm_installed_app_version' => $team->getCrmConfiguration()->getInstalledAppVersion(),
'calendar' => $team->getCalendarProvider(),
'notification_provider' => $team->getNotificationProvider(),
'has_jiminny_voice' => $team->hasFeature(FeatureEnum::DIALER),
'tier' => $team->getTier()?->getTitle(),
];
}
public function deleteUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'users', [
'users' => [$user->getUuid()],
]);
}
public function deleteCompany(Team $team): void
{
if ($this->shouldRequest($team) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'companies', [
'companies' => [$team->getUuid()],
]);
}
public function shouldRequest(Team $team): bool
{
return config('services.userpilot.key') !== null && $team->getPartnerId() === Partner::PARTNER_DEFAULT;
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
PhpStorm
|
faVsco.js – JiminnyDebugCommand.php
|
NULL
|
77284
|
|
Project: faVsco.js, menu
JY-20738-debug-AJ-trackin Project: faVsco.js, menu
JY-20738-debug-AJ-tracking-UP, menu
Start Listening for PHP Debug Connections
ReportControllerTest
Run 'ReportControllerTest'
Debug 'ReportControllerTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
3
115
4
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use InvalidArgumentException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateAskJiminnyReportJob;
use Jiminny\Jobs\AutomatedReports\SendReportMailJob;
use Jiminny\Jobs\JobDispatcherInterface;
use Jiminny\Models\Activity;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Services\Activity\CrmOwnerResolver;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\UserPilot\UserPilotClient;
/**
* Class JiminnyDebugCommand
*
* @package Jiminny\Console\Commands
*/
class JiminnyDebugCommand extends Command
{
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';
protected $signature = 'jiminny:debug';
public function handle(
JobDispatcherInterface $jobDispatcher,
AutomatedReportsService $automatedReportsService,
AutomatedReportsRepository $automatedReportsRepository,
UserPilotClient $userPilotClient
): void {
$user = User::find(143);
// $count = $automatedReportsRepository->countUserReports($user);
// $this->info("Count: {$count}");
// $count = $automatedReportsRepository->countAllUserReports($user);
// $this->info("All count: {$count}");
$payload = [
'report_type' => 'ask_jiminny',
'frequency' => 'weekly',
];
$userPilotClient->track($user, 'ask-jiminny-report-generated', $payload);
exit(1);
$now = Carbon::now()->subDay(1);
$this->info("Now: {$now->toDateTimeString()}");
$weekStart = Carbon::getWeekStartsAt();
$this->info("Now: {$weekStart}");
// $from = $now->copy()->previousWeekday()->startOfDay();
// $to = $now->copy()->previousWeekday()->endOfDay();
// $fromOld = $now->copy()->subWeeks(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subWeek()->startOfWeek();
// $toNew = $now->copy()->subWeek()->endOfWeek();
// $fromOld = $now->copy()->subMonths(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
// $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
$fromOld = $now->copy()->subMonths(3)->startOfDay();
$toOld = $now->copy()->subDay()->endOfDay();
$fromNew = $now->copy()->subQuarterNoOverflow()->startOfQuarter();
$toNew = $now->copy()->subQuarterNoOverflow()->endOfQuarter();
$this->info("From old: {$fromOld->toDateTimeString()}");
$this->info("To old: {$toOld->toDateTimeString()}");
$this->info("From new: {$fromNew->toDateTimeString()}");
$this->info("To new: {$toNew->toDateTimeString()}");
exit(1);
$report = AutomatedReport::find(71);
$job = new RequestGenerateAskJiminnyReportJob($report->getUuid());
$jobDispatcher->dispatch($job);
exit(1);
// $this->formatDate($jobDispatcher);
// $this->sendMail($jobDispatcher, $automatedReportsService);
// $this->crmService();
$this->getPayload($automatedReportsService);
exit(1);
}
private function crmService()
{
$activity = Activity::find(418141);
$team = Team::find(19);
$config = $team->getCrmConfiguration();
$crmResolver = app(CrmOwnerResolver::class, [
'team' => $team,
'integrationAdmin' => $team->getOwner(),
'providerSlug' => $config->getProviderName(),
]);
$crmService = $crmResolver->prepareCrmService();
$crmService->createTranscriptNotes($activity);
}
private function sendMail(JobDispatcherInterface $jobDispatcher, AutomatedReportsService $automatedReportsService)
{
$reportUuid = '';
// $report = $automatedReportsService->getReportResult($reportUuid);
$report = AutomatedReportResult::find(275);
$validRecipients = $automatedReportsService->getValidRecipientUsers(
$report->getReport(),
includeJiminny: true,
);
$recipient = $validRecipients[0];
$fileName = $automatedReportsService->getReportFileName($report);
$typeName = $report->getReport()->getCustomName()
?? $automatedReportsService->getReportTypeName($report);
$teamsName = $automatedReportsService->getReportTeamsName($report);
$periodName = $automatedReportsService->getReportPeriodName($report);
$s3Path = $automatedReportsService->getMediaPath($report);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$fileName ' . PHP_EOL . print_r($fileName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$typeName ' . PHP_EOL . print_r($typeName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$teamsName ' . PHP_EOL . print_r($teamsName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$periodName ' . PHP_EOL . print_r($periodName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$s3Path ' . PHP_EOL . print_r($s3Path, true));
$jobDispatcher->dispatch(
new SendReportMailJob(
reportUuid: $report->getUuid(),
s3Path: $s3Path,
recipientEmail: $recipient['email'],
recipientName: $recipient['name'] ?? null,
fileName: $fileName,
typeName: $typeName,
teamsName: $teamsName,
periodName: $periodName,
isAskJiminny: true,
)
);
exit(1);
}
private function formatDate(JobDispatcherInterface $jobDispatcher): void
{
$customName = 'Custom report name';
// $frequency = self::FREQUENCY_DAILY;
// $frequency = self::FREQUENCY_WEEKLY;
$frequency = self::FREQUENCY_MONTHLY;
// $frequency = self::FREQUENCY_QUARTERLY;
// $frequency = self::FREQUENCY_ONE_OFF;
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
$periodName = $this->formatReportPeriodName($frequency, $from, $to);
$filenameSuffix = null;
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
$result = $this->sanitizeFileName("{$customName} - {$periodName}");
}
$this->info($result);
}
public function calculateFromAndToDatePeriod(
string $frequency,
?Carbon $fromDate = null,
?Carbon $toDate = null
): array {
if ($frequency === self::FREQUENCY_ONE_OFF) {
return [
'fromDate' => $fromDate,
'toDate' => $toDate,
];
}
$now = Carbon::now();
return match ($frequency) {
self::FREQUENCY_DAILY => [
'fromDate' => $now->copy()->subDay()->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_WEEKLY => [
'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_MONTHLY => [
'fromDate' => $now->copy()->subMonths(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_QUARTERLY => [
'fromDate' => $now->copy()->subMonths(3)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
default => throw new InvalidArgumentException("Unsupported frequency: {$frequency}"),
};
}
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 sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
private function getPayload(AutomatedReportsService $automatedReportsService)
{
$reportResult = AutomatedReportResult::find(269);
$automatedReport = $reportResult->getReport();
$activityIds = [1,2,3];
$payload = $automatedReportsService->getAskJiminnyGenerateReportPayload(
automatedReport: $automatedReport,
reportResult: $reportResult,
activityIds: $activityIds,
);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$payload ' . PHP_EOL . print_r($payload, true));
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
7
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Services\UserPilot;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Support\Facades\Http;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Partner;
use Jiminny\Models\Team;
use Jiminny\Models\User;
class UserPilotClient
{
private const API_ENDPOINT = 'https://api.userpilot.io/v1/';
private const ANALYTICS_ENDPOINT = 'https://analytex.userpilot.io/v1/';
private function createRequest(): PendingRequest
{
return Http::withHeaders([
'X-API-Version' => '2020-09-22',
'Authorization' => 'Token ' . config('services.userpilot.key'),
]);
}
public function track(User $user, string $event, array $payload = []): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'track', [
'event_name' => $event,
'user_id' => $user->getUuid(),
'metadata' => $payload,
]);
}
public function upsertUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$companyMetadata = $this->getCompanyMetadata($user->getTeam());
$companyMetadata['id'] = $user->getTeam()->getUuid();
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'identify', [
'user_id' => $user->getUuid(),
'metadata' => [
'name' => $user->name,
'first_name' => $user->getFirstName(),
'position' => $user->job ? $user->job->name : null,
'email' => $user->getEmailAddress(),
'created_at' => $user->getCreatedAt()->unix(),
'is_admin' => $user->hasRole(User::ROLE_ADMIN),
'is_manager' => $user->hasRole(User::ROLE_MANAGER),
'is_owner' => $user->isTeamOwner(),
'is_insights' => $user->hasRole(User::ROLE_ANALYST),
'is_recorder' => $user->hasRole(User::ROLE_RECORDER),
'is_jiminny_voice' => $user->hasRole(User::ROLE_RECORDER_AND_VOICE),
'is_listener' => $user->hasRole(User::ROLE_LISTENER),
'license' => null,
'team' => $user->group ? $user->group->name : null,
'language' => $user->getLanguage(),
'email_sync' => $user->isSyncEmailEnabled(),
],
'company' => $companyMetadata,
]);
}
public function upsertCompany(Team $team): void
{
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'companies/identify', [
'company_id' => $team->getUuid(),
'metadata' => $this->getCompanyMetadata($team),
]);
}
private function getCompanyMetadata(Team $team): array
{
return [
'created_at' => $team->getCreatedAt()->unix(),
'name' => $team->getName(),
'region' => config('jiminny.deploy_region'),
'crm' => $team->getCrmConfiguration()->getProviderName(),
'crm_installed_app_version' => $team->getCrmConfiguration()->getInstalledAppVersion(),
'calendar' => $team->getCalendarProvider(),
'notification_provider' => $team->getNotificationProvider(),
'has_jiminny_voice' => $team->hasFeature(FeatureEnum::DIALER),
'tier' => $team->getTier()?->getTitle(),
];
}
public function deleteUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'users', [
'users' => [$user->getUuid()],
]);
}
public function deleteCompany(Team $team): void
{
if ($this->shouldRequest($team) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'companies', [
'companies' => [$team->getUuid()],
]);
}
public function shouldRequest(Team $team): bool
{
return config('services.userpilot.key') !== null && $team->getPartnerId() === Partner::PARTNER_DEFAULT;
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
PhpStorm
|
faVsco.js – JiminnyDebugCommand.php
|
NULL
|
77285
|
|
Firefox• 0FileEditViewHistory→BookmarksProfilesToo Firefox• 0FileEditViewHistory→BookmarksProfilesToolsWindowHelpmeet.google.com/agt-teir-cwt?authuser=lukas.kovalik%40jiminny.com•Daily - Platform - now100% K78 • Fri 24 Apr 9:46:13|=Pop out this videoNikolay NikolovStefka StoyanovaGalya DimitrovaLukas Kovalik9:46 AM | Daily - Platform• 0:27...
|
PhpStorm
|
Commit Changes
|
NULL
|
77286
|
|
DMSActivityMorerireroxToolsHelpcalMistorbookmarksJ DMSActivityMorerireroxToolsHelpcalMistorbookmarksJiminny …..vXStarredi• jiminny-x-integrati..8 platform-inner-teamE) Channels# ai-chapter# ai-team# alerts# backend# c-learning-peoplei confusion-clinic# curiosity_labadeal-insichts-dev# engineering# frontend# general# infra-changes# jiminny-bg8 people-with-copilo...8 people-with-zoom-# platform-team# platform-tickets# product_launches# random# releases# sofia-office# support# thank-yous# the Deople of iimi...ProtllesWindow& platform-inner-...& 10MessagesChannel OverviewMoreYesterdayjinnylaop Aor 22nd Added by GitHubNikolay Ivanov 3:24 PMнякой нещо да е настроивал по githubactions. Почна да прави къмити вместо менбез да съм му разрешевал?https:/github.com/lminnv/app/pull/1200//changes/a68f42f210859f838a4fdced451f750627besoioИли нещо аз не разбирам?0AA0e 20 replies Last reply 18...Nikolay Yankov 3:50PMreplied to a uhread: някои нешо ла е насто..лол. ами предлагам маи ла му заораним лапускам към всички ла вилятNikolav Yankov 9.38 AMЩе се забавя за дейлито. Започнете без Мен.Aneliva Angelova 9:43 AMIДобро утро, няма да успея да вляза влейлито. Пествам ньлжовете.Message & platform-inner-team+ Aa I..•) New TabAl reports promotion pages by nik• JY-9712 | Nuges to expire after on8 Jiminnyu Userpilot Logged-activityJY-20157 add not enough activ XPipelines - jiminny/app+ New Tab©github.com/jimjiminny / app 8<> Code87 Pull requests 31( Agents |© Actions•• Wiki © Security and quality 32 ~ Insights 3 Settings@ On April 24 we'll start using GitHub Copilot interaction data for Al model training unless you opt out. Review this update and manage your preferences in your GitHub account settings.JY-20157 add not enough activities notification #12011 •$1 Open LakyLak wants to merge 2 commits into master from JY-20157-AJ-report-not-send-notification@) Conversation o• Commits 2|- Checks 21E Files changed 13A © All commits +Q Filter files...apo/Console/Commands/Reports/AutomatedReportsCommand.ohp@ -61,21 +61,29 @ public function handle(): intv = Console/Commands/Renorts|Snow = Carbon: : now();E AutomatedReportsCommand...v Jobs/AutomatedReportsE RequestGenerateAskJiminnyR...SendReportNotGeneratedMail...v @ Listeners/AutomatedReports/U….E TrackAutomatedReportGener...v # Mail/ReportsS1sMondav = Snow->1SMonday)S1sr1rstDayUtMonth = Snow->day === 1;ScurrentMonth = Snow->month.// Check if the current month is a quarterly month (January, April, July, October)$isQuarterlyMonth = in_array($currentMonth, [1, 4, 7, 10], true);$this->logger->info(self::LOG_PREFIX . ' Checking conditions', [+ ReportNotGenerated.ohp |"1SMonday' => S1SMonday,~ E Services/Kiosk/AutomatedRepo…..AskJiminnyReportActivityServ…'isFirstDay0fMonth' => SisFirstDay0fMonth,'currentMonth' => ScurrentMonth.E AutomatedReportsService.php'isQuarterlyMonth' => SisQuarterlyMonth,~E resources/views/emails/reportsreport-not-generated.blade.php/I Process dailv revortsl• F tests/UnitSthis->processReports(AutomatedReportsService::FREQUENCYDAILY):~ Jobs/AutomatedReportsE ReguestGenerateAsk JiminnvR....v = listeners/AutomatedRenorts/U.₴ TrackAutomatedReportGener..v E Services/Kiosk/AutomatedRepo…..E AskJiminnyReportActivityServ....AutomatedReportsServiceActi…./ Process weekly renorts on Mondavcif (SisMondav) {64 +67 +74 +86 +@40@ Daily - Platform - nowQ Type to search100% C4 8• Fri 24 Apr 9:46:13• Checks pending Code • (Preview) -+384 -52 9000C 0 I 13 viewedSubmit review+10 -2 mane [ Viewed0 ...Snow = Carhon:.nowdSisMondav = Snow->1SMonday)"Sisweekend = $now->isWeekend():SisFirstDay0fMonth = Snow->day === 1;ScurrentMonth = Snow->month.SisManualTrigger = $this->option('report-id') !== null;// Check if the current month is a quarterly month (January, April, July, October)$isQuarterlyMonth = in_array($currentMonth, [1, 4, 7, 10], true);Sthis->loager->info(self::L0G PREFIX . ' Checkina conditions'. [I"isMonday' => SisMonday,'isweekend' => $isWeekend,'isFirstDay0fMonth' => $isFirstDay0fMonth,'currentMonth' => ScurrentMonth.l'isQuarterlyMonth' => SisQuarterlyMonth,/ Process dailv renorts on weekdavs onlv (skio Saturdav/Sundav)...// Manual triggers via --report-id bypass the weekend skip.if (I Sisweekend || SisManualTriager) {Sthis->processReports(AutomatedReportsService::FREQUENCY_DAILY):} else {ISthis->logger->info(self::L0G PREFIX . ' Skipping daily reports on weekend'):/ Process weekly renorts on Mondavslif (SisMonday) {...
|
PhpStorm
|
Commit Changes
|
NULL
|
77287
|
|
Diff
Changelist:
Changelist:
Changes
Show Diff
Fir Diff
Changelist:
Changelist:
Changes
Show Diff
Firefox• 0FileEditViewHistory→BookmarksProfilesToolsWindowHelpmeet.google.com/agt-teir-cwt?authuser=lukas.kovalik%40jiminny.com•Daily - Platform - now100% K78 • Fri 24 Apr 9:46:13|=Pop out this videoNikolay NikolovStefka StoyanovaGalya DimitrovaLukas Kovalik9:46 AM | Daily - Platform• 0:27...
|
PhpStorm
|
Commit Changes
|
NULL
|
77288
|
|
Commit and Push…
⌥⌘K
Firefox• 0FileEditViewHistory Commit and Push…
⌥⌘K
Firefox• 0FileEditViewHistory→BookmarksProfilesToolsWindowHelpmeet.google.com/agt-teir-cwt?authuser=lukas.kovalik%40jiminny.com•Daily - Platform - now100% K78 • Fri 24 Apr 9:46:13|=Pop out this videoNikolay NikolovStefka StoyanovaGalya DimitrovaLukas Kovalik9:46 AM | Daily - Platform• 0:27...
|
PhpStorm
|
|
NULL
|
77289
|
|
Commit and Push…
⌥⌘K
DMSActivityMorerireroxToolsHe Commit and Push…
⌥⌘K
DMSActivityMorerireroxToolsHelpcalMistorbookmarksJiminny …..vXStarredi• jiminny-x-integrati..8 platform-inner-teamE) Channels# ai-chapter# ai-team# alerts# backend# c-learning-peoplei confusion-clinic# curiosity_labadeal-insichts-dev# engineering# frontend# general# infra-changes# jiminny-bg8 people-with-copilo...8 people-with-zoom-# platform-team# platform-tickets# product_launches# random# releases# sofia-office# support# thank-yous# the Deople of iimi...ProtllesWindow& platform-inner-...& 10MessagesChannel OverviewMoreYesterdayjinnylaop Aor 22nd Added by GitHubNikolay Ivanov 3:24 PMнякой нещо да е настроивал по githubactions. Почна да прави къмити вместо менбез да съм му разрешевал?https:/github.com/lminnv/app/pull/1200//changes/a68f42f210859f838a4fdced451f750627besoioИли нещо аз не разбирам?0AA0e 20 replies Last reply 18...Nikolay Yankov 3:50PMreplied to a uhread: някои нешо ла е насто..лол. ами предлагам маи ла му заораним лапускам към всички ла вилятNikolav Yankov 9.38 AMЩе се забавя за дейлито. Започнете без Мен.Aneliva Angelova 9:43 AMIДобро утро, няма да успея да вляза влейлито. Пествам ньлжовете.Message & platform-inner-team+ Aa I..•) New TabAl reports promotion pages by nik• JY-9712 | Nuges to expire after on8 Jiminnyu Userpilot Logged-activityJY-20157 add not enough activ XPipelines - jiminny/app+ New Tab©github.com/jimjiminny / app 8<> Code87 Pull requests 31( Agents |© Actions•• Wiki © Security and quality 32 ~ Insights 3 Settings@ On April 24 we'll start using GitHub Copilot interaction data for Al model training unless you opt out. Review this update and manage your preferences in your GitHub account settings.JY-20157 add not enough activities notification #12011 •$1 Open LakyLak wants to merge 2 commits into master from JY-20157-AJ-report-not-send-notification@) Conversation o• Commits 2|- Checks 21E Files changed 13A © All commits +Q Filter files...apo/Console/Commands/Reports/AutomatedReportsCommand.ohp@ -61,21 +61,29 @ public function handle(): intv = Console/Commands/Renorts|Snow = Carbon: : now();E AutomatedReportsCommand...v Jobs/AutomatedReportsE RequestGenerateAskJiminnyR...SendReportNotGeneratedMail...v @ Listeners/AutomatedReports/U….E TrackAutomatedReportGener...v # Mail/ReportsS1sMondav = Snow->1SMonday)S1sr1rstDayUtMonth = Snow->day === 1;ScurrentMonth = Snow->month.// Check if the current month is a quarterly month (January, April, July, October)$isQuarterlyMonth = in_array($currentMonth, [1, 4, 7, 10], true);$this->logger->info(self::LOG_PREFIX . ' Checking conditions', [+ ReportNotGenerated.ohp |"1SMonday' => S1SMonday,~ E Services/Kiosk/AutomatedRepo…..AskJiminnyReportActivityServ…'isFirstDay0fMonth' => SisFirstDay0fMonth,'currentMonth' => ScurrentMonth.E AutomatedReportsService.php'isQuarterlyMonth' => SisQuarterlyMonth,~E resources/views/emails/reportsreport-not-generated.blade.php/I Process dailv revortsl• F tests/UnitSthis->processReports(AutomatedReportsService::FREQUENCYDAILY):~ Jobs/AutomatedReportsE ReguestGenerateAsk JiminnvR....v = listeners/AutomatedRenorts/U.₴ TrackAutomatedReportGener..v E Services/Kiosk/AutomatedRepo…..E AskJiminnyReportActivityServ....AutomatedReportsServiceActi…./ Process weekly renorts on Mondavcif (SisMondav) {64 +67 +74 +86 +@40@ Daily - Platform - nowQ Type to search100% C4 8• Fri 24 Apr 9:46:13• Checks pending Code • (Preview) -+384 -52 9000C 0 I 13 viewedSubmit review+10 -2 mane [ Viewed0 ...Snow = Carhon:.nowdSisMondav = Snow->1SMonday)"Sisweekend = $now->isWeekend():SisFirstDay0fMonth = Snow->day === 1;ScurrentMonth = Snow->month.SisManualTrigger = $this->option('report-id') !== null;// Check if the current month is a quarterly month (January, April, July, October)$isQuarterlyMonth = in_array($currentMonth, [1, 4, 7, 10], true);Sthis->loager->info(self::L0G PREFIX . ' Checkina conditions'. [I"isMonday' => SisMonday,'isweekend' => $isWeekend,'isFirstDay0fMonth' => $isFirstDay0fMonth,'currentMonth' => ScurrentMonth.l'isQuarterlyMonth' => SisQuarterlyMonth,/ Process dailv renorts on weekdavs onlv (skio Saturdav/Sundav)...// Manual triggers via --report-id bypass the weekend skip.if (I Sisweekend || SisManualTriager) {Sthis->processReports(AutomatedReportsService::FREQUENCY_DAILY):} else {ISthis->logger->info(self::L0G PREFIX . ' Skipping daily reports on weekend'):/ Process weekly renorts on Mondavslif (SisMonday) {...
|
PhpStorm
|
|
NULL
|
77290
|
|
Diff
Changelist:
Changelist:
Changes
Show Diff
Rol Diff
Changelist:
Changelist:
Changes
Show Diff
Rollback...
Refresh
Group By
Expand All
Collapse All
10 files, folder partially checked
app 6 files, folder partially checked
Console/Commands 1 file, folder not checked
Http/Controllers 2 files, folder partially checked
API 1 file, folder not checked
Webhook 1 file, folder checked
ReportController.php, class checked
Jobs/Team 1 file, folder not checked
Listeners/AutomatedReports/UserPilot 1 file, folder checked
TrackAutomatedReportGeneratedEvent.php, class checked
Services 1 file, folder not checked
config 1 file, folder not checked
tests/Unit 2 files, folder checked
Http/Controllers/Webhook 1 file, folder checked
ReportControllerTest.php, class checked
Listeners/AutomatedReports/UserPilot 1 file, folder checked
TrackAutomatedReportGeneratedEventTest.php, class checked
.env.local not checked
app 6 files, folder partially checked
Console/Commands 1 file, folder not checked
Http/Controllers 2 files, folder partially checked
API 1 file, folder not checked
Webhook 1 file, folder checked
ReportController.php, class checked
Jobs/Team 1 file, folder not checked
Listeners/AutomatedReports/UserPilot 1 file, folder checked
TrackAutomatedReportGeneratedEvent.php, class checked
Services 1 file, folder not checked
Console/Commands 1 file, folder not checked
Http/Controllers 2 files, folder partially checked
API 1 file, folder not checked
Webhook 1 file, folder checked
ReportController.php, class checked
API 1 file, folder not checked
Webhook 1 file, folder checked
ReportController.php, class checked
ReportController.php, class checked
Jobs/Team 1 file, folder not checked
Listeners/AutomatedReports/UserPilot 1 file, folder checked
TrackAutomatedReportGeneratedEvent.php, class checked
TrackAutomatedReportGeneratedEvent.php, class checked
Services 1 file, folder not checked
config 1 file, folder not checked
tests/Unit 2 files, folder checked
Http/Controllers/Webhook 1 file, folder checked
ReportControllerTest.php, class checked
Listeners/AutomatedReports/UserPilot 1 file, folder checked
TrackAutomatedReportGeneratedEventTest.php, class checked
Http/Controllers/Webhook 1 file, folder checked
ReportControllerTest.php, class checked
ReportControllerTest.php, class checked
Listeners/AutomatedReports/UserPilot 1 file, folder checked
TrackAutomatedReportGeneratedEventTest.php, class checked
TrackAutomatedReportGeneratedEventTest.php, class checked
.env.local not checked
Unversioned Files 9 files not checked
4 modified
JY-20738 add debug logs on AJ report UP tracking
Commit Message
Commit Message History
Git...
|
PhpStorm
|
Commit Changes
|
NULL
|
77291
|
|
Diff
Changelist:
Changelist:
Changes
Show Diff
Rol Diff
Changelist:
Changelist:
Changes
Show Diff
Rollback...
Refresh
Group By
Expand All
Collapse All
10 files, folder partially checked
app 6 files, folder partially checked
Console/Commands 1 file, folder not checked
Http/Controllers 2 files, folder partially checked
API 1 file, folder not checked
Webhook 1 file, folder checked
ReportController.php, class checked
Jobs/Team 1 file, folder not checked
Listeners/AutomatedReports/UserPilot 1 file, folder checked
TrackAutomatedReportGeneratedEvent.php, class checked
Services 1 file, folder not checked
config 1 file, folder not checked
tests/Unit 2 files, folder checked
Http/Controllers/Webhook 1 file, folder checked
ReportControllerTest.php, class checked
Listeners/AutomatedReports/UserPilot 1 file, folder checked
TrackAutomatedReportGeneratedEventTest.php, class checked
.env.local not checked
app 6 files, folder partially checked
Console/Commands 1 file, folder not checked
Http/Controllers 2 files, folder partially checked
API 1 file, folder not checked
Webhook 1 file, folder checked
ReportController.php, class checked
Jobs/Team 1 file, folder not checked
Listeners/AutomatedReports/UserPilot 1 file, folder checked
TrackAutomatedReportGeneratedEvent.php, class checked
Services 1 file, folder not checked
Console/Commands 1 file, folder not checked
Http/Controllers 2 files, folder partially checked
API 1 file, folder not checked
Webhook 1 file, folder checked
ReportController.php, class checked
API 1 file, folder not checked
Webhook 1 file, folder checked
ReportController.php, class checked
ReportController.php, class checked
Jobs/Team 1 file, folder not checked
Listeners/AutomatedReports/UserPilot 1 file, folder checked
TrackAutomatedReportGeneratedEvent.php, class checked
TrackAutomatedReportGeneratedEvent.php, class checked
Services 1 file, folder not checked
config 1 file, folder not checked
tests/Unit 2 files, folder checked
Http/Controllers/Webhook 1 file, folder checked
ReportControllerTest.php, class checked
Listeners/AutomatedReports/UserPilot 1 file, folder checked
TrackAutomatedReportGeneratedEventTest.php, class checked...
|
PhpStorm
|
Commit Changes
|
NULL
|
77292
|
|
Code Analysis
text/html
text/html
text/html
File ~ Code Analysis
text/html
text/html
text/html
File ~/jiminny/app/app/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEvent.php contains problems.<br/>No errors and one warning found.<br/>Would you like to review them?
Cancel
Commit and Push
Review Code Analysis...
|
PhpStorm
|
Code Analysis
|
NULL
|
77293
|
|
Project: faVsco.js, menu
JY-20738-debug-AJ-trackin Project: faVsco.js, menu
JY-20738-debug-AJ-tracking-UP, menu
Start Listening for PHP Debug Connections
ReportControllerTest
Run 'ReportControllerTest'
Debug 'ReportControllerTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
DMSActivityMorerireroxToolsHelpcalMistorbookmarksJiminny …..vXStarredi• jiminny-x-integrati..8 platform-inner-teamE) Channels# ai-chapter# ai-team# alerts# backend# c-learning-peoplei confusion-clinic# curiosity_labadeal-insichts-dev# engineering# frontend# general# infra-changes# jiminny-bg8 people-with-copilo...8 people-with-zoom-# platform-team# platform-tickets# product_launches# random# releases# sofia-office# support# thank-yous# the Deople of iimi...ProtllesWindow& platform-inner-...& 10MessagesChannel OverviewMoreYesterdayjinnylaop Aor 22nd Added by GitHubNikolay Ivanov 3:24 PMнякой нещо да е настроивал по githubactions. Почна да прави къмити вместо менбез да съм му разрешевал?https:/github.com/lminnv/app/pull/1200//changes/a68f42f210859f838a4fdced451f750627besoioИли нещо аз не разбирам?0AA0e 20 replies Last reply 18...Nikolay Yankov 3:50PMreplied to a uhread: някои нешо ла е насто..лол. ами предлагам маи ла му заораним лапускам към всички ла вилятNikolav Yankov 9.38 AMЩе се забавя за дейлито. Започнете без Мен.Aneliva Angelova 9:43 AMIДобро утро, няма да успея да вляза влейлито. Пествам ньлжовете.Message & platform-inner-team+ Aa I..•) New TabAl reports promotion pages by nik• JY-9712 | Nuges to expire after on8 Jiminnyu Userpilot Logged-activityJY-20157 add not enough activ XPipelines - jiminny/app+ New Tab©github.com/jimjiminny / app 8<> Code87 Pull requests 31( Agents |© Actions•• Wiki © Security and quality 32 ~ Insights 3 Settings@ On April 24 we'll start using GitHub Copilot interaction data for Al model training unless you opt out. Review this update and manage your preferences in your GitHub account settings.JY-20157 add not enough activities notification #12011 •$1 Open LakyLak wants to merge 2 commits into master from JY-20157-AJ-report-not-send-notification@) Conversation o• Commits 2|- Checks 21E Files changed 13A © All commits +Q Filter files...apo/Console/Commands/Reports/AutomatedReportsCommand.ohp@ -61,21 +61,29 @ public function handle(): intv = Console/Commands/Renorts|Snow = Carbon: : now();E AutomatedReportsCommand...v Jobs/AutomatedReportsE RequestGenerateAskJiminnyR...SendReportNotGeneratedMail...v @ Listeners/AutomatedReports/U….E TrackAutomatedReportGener...v # Mail/ReportsS1sMondav = Snow->1SMonday)S1sr1rstDayUtMonth = Snow->day === 1;ScurrentMonth = Snow->month.// Check if the current month is a quarterly month (January, April, July, October)$isQuarterlyMonth = in_array($currentMonth, [1, 4, 7, 10], true);$this->logger->info(self::LOG_PREFIX . ' Checking conditions', [+ ReportNotGenerated.ohp |"1SMonday' => S1SMonday,~ E Services/Kiosk/AutomatedRepo…..AskJiminnyReportActivityServ…'isFirstDay0fMonth' => SisFirstDay0fMonth,'currentMonth' => ScurrentMonth.E AutomatedReportsService.php'isQuarterlyMonth' => SisQuarterlyMonth,~E resources/views/emails/reportsreport-not-generated.blade.php/I Process dailv revortsl• F tests/UnitSthis->processReports(AutomatedReportsService::FREQUENCYDAILY):~ Jobs/AutomatedReportsE ReguestGenerateAsk JiminnvR....v = listeners/AutomatedRenorts/U.₴ TrackAutomatedReportGener..v E Services/Kiosk/AutomatedRepo…..E AskJiminnyReportActivityServ....AutomatedReportsServiceActi…./ Process weekly renorts on Mondavcif (SisMondav) {64 +67 +74 +86 +@40@ Daily - Platform - nowQ Type to search100% C4 8• Fri 24 Apr 9:46:13• Checks pending Code • (Preview) -+384 -52 9000C 0 I 13 viewedSubmit review+10 -2 mane [ Viewed0 ...Snow = Carhon:.nowdSisMondav = Snow->1SMonday)"Sisweekend = $now->isWeekend():SisFirstDay0fMonth = Snow->day === 1;ScurrentMonth = Snow->month.SisManualTrigger = $this->option('report-id') !== null;// Check if the current month is a quarterly month (January, April, July, October)$isQuarterlyMonth = in_array($currentMonth, [1, 4, 7, 10], true);Sthis->loager->info(self::L0G PREFIX . ' Checkina conditions'. [I"isMonday' => SisMonday,'isweekend' => $isWeekend,'isFirstDay0fMonth' => $isFirstDay0fMonth,'currentMonth' => ScurrentMonth.l'isQuarterlyMonth' => SisQuarterlyMonth,/ Process dailv renorts on weekdavs onlv (skio Saturdav/Sundav)...// Manual triggers via --report-id bypass the weekend skip.if (I Sisweekend || SisManualTriager) {Sthis->processReports(AutomatedReportsService::FREQUENCY_DAILY):} else {ISthis->logger->info(self::L0G PREFIX . ' Skipping daily reports on weekend'):/ Process weekly renorts on Mondavslif (SisMonday) {...
|
PhpStorm
|
faVsco.js – JiminnyDebugCommand.php
|
NULL
|
77294
|
|
JY-20738-debug-AJ-tracking-UP → origin : JY-20738- JY-20738-debug-AJ-tracking-UP → origin : JY-20738-debug-AJ-tracking-UP
JY-20738 add debug logs on AJ report UP tracking
Show Diff
Group By
Jump to Source
Show Details
Expand All
Collapse All
4 files, folder
app 2 files, folder
Http/Controllers/Webhook 1 file, folder
ReportController.php, class
Listeners/AutomatedReports/UserPilot 1 file, folder
TrackAutomatedReportGeneratedEvent.php, class
tests/Unit 2 files, folder
Http/Controllers/Webhook 1 file, folder
ReportControllerTest.php, class
Listeners/AutomatedReports/UserPilot 1 file, folder
TrackAutomatedReportGeneratedEventTest.php, class
app 2 files, folder
Http/Controllers/Webhook 1 file, folder
ReportController.php, class
Listeners/AutomatedReports/UserPilot 1 file, folder
TrackAutomatedReportGeneratedEvent.php, class
Http/Controllers/Webhook 1 file, folder
ReportController.php, class
ReportController.php, class
Listeners/AutomatedReports/UserPilot 1 file, folder
TrackAutomatedReportGeneratedEvent.php, class
TrackAutomatedReportGeneratedEvent.php, class
tests/Unit 2 files, folder
Http/Controllers/Webhook 1 file, folder
ReportControllerTest.php, class
Listeners/AutomatedReports/UserPilot 1 file, folder
TrackAutomatedReportGeneratedEventTest.php, class
Http/Controllers/Webhook 1 file, folder
ReportControllerTest.php, class
ReportControllerTest.php, class
Listeners/AutomatedReports/UserPilot 1 file, folder
TrackAutomatedReportGeneratedEventTest.php, class
TrackAutomatedReportGeneratedEventTest.php, class
For Commit and Push to non-protected branches, preview commits before push
Help
Push tags:
All
Current Branch
Cancel
Push
Push
Push Commits to app...
|
PhpStorm
|
Push Commits to app
|
NULL
|
77295
|
|
JY-20738-debug-AJ-tracking-UP → origin : JY-20738- JY-20738-debug-AJ-tracking-UP → origin : JY-20738-debug-AJ-tracking-UP
JY-20738 add debug logs on AJ report UP tracking
Show Diff
Group By
Jump to Source
Show Details
Expand All
Collapse All
4 files, folder
app 2 files, folder
Http/Controllers/Webhook 1 file, folder
ReportController.php, class
Listeners/AutomatedReports/UserPilot 1 file, folder
TrackAutomatedReportGeneratedEvent.php, class
tests/Unit 2 files, folder
Http/Controllers/Webhook 1 file, folder
ReportControllerTest.php, class
Listeners/AutomatedReports/UserPilot 1 file, folder
TrackAutomatedReportGeneratedEventTest.php, class
app 2 files, folder
Http/Controllers/Webhook 1 file, folder
ReportController.php, class
Listeners/AutomatedReports/UserPilot 1 file, folder
TrackAutomatedReportGeneratedEvent.php, class
Http/Controllers/Webhook 1 file, folder
ReportController.php, class
ReportController.php, class
Listeners/AutomatedReports/UserPilot 1 file, folder
TrackAutomatedReportGeneratedEvent.php, class
TrackAutomatedReportGeneratedEvent.php, class
tests/Unit 2 files, folder
Http/Controllers/Webhook 1 file, folder
ReportControllerTest.php, class
Listeners/AutomatedReports/UserPilot 1 file, folder
TrackAutomatedReportGeneratedEventTest.php, class
Http/Controllers/Webhook 1 file, folder
ReportControllerTest.php, class
ReportControllerTest.php, class
Listeners/AutomatedReports/UserPilot 1 file, folder
TrackAutomatedReportGeneratedEventTest.php, class
TrackAutomatedReportGeneratedEventTest.php, class
For Commit and Push to non-protected branches, preview commits before push
Help
Push tags:
All
Current Branch
Cancel
Push
Push
Push Commits to app...
|
PhpStorm
|
Push Commits to app
|
NULL
|
77296
|
|
Last login: Thu Apr 23 14:01:28 on ttys007
Poetry Last login: Thu Apr 23 14:01:28 on ttys007
Poetry could not find a pyproject.toml file in /Users/lukas/jiminny/app or its parents
Poetry could not find a pyproject.toml file in /Users/lukas/jiminny/app or its parents
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ git status
On branch JY-20157-AJ-report-not-send-notification
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .env.local
modified: app/Console/Commands/JiminnyDebugCommand.php
modified: app/Http/Controllers/API/ActivityController.php
modified: app/Jobs/Team/SyncToIntercom.php
modified: app/Services/PlaybackService.php
modified: config/logging.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
.env.nikilocal
.env.other
WEBHOOK_FILTERING_IMPLEMENTATION.md
app/Console/Commands/Crm/Hubspot/SimulateWebhooksCommand.php
app/Console/Commands/Reports/CreateMockAskJiminnyReportResultCommand.php
ids.txt
raw_sql_query.sql
tests/Unit/Policies/CanAccessAiReportsTest.php
no changes added to commit (use "git add" and/or "git commit -a")
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ git status
On branch JY-20372-ai-reports-promotion-pages
Your branch is up to date with 'origin/JY-20372-ai-reports-promotion-pages'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .env.local
modified: app/Console/Commands/JiminnyDebugCommand.php
modified: app/Http/Controllers/API/ActivityController.php
modified: app/Jobs/Team/SyncToIntercom.php
modified: app/Services/PlaybackService.php
modified: config/logging.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
.env.nikilocal
.env.other
WEBHOOK_FILTERING_IMPLEMENTATION.md
app/Console/Commands/Crm/Hubspot/SimulateWebhooksCommand.php
app/Console/Commands/Reports/CreateMockAskJiminnyReportResultCommand.php
ids.txt
raw_sql_query.sql
tests/Unit/Policies/CanAccessAiReportsTest.php
no changes added to commit (use "git add" and/or "git commit -a")
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20372-ai-reports-promotion-pages) $ git pull
remote: Enumerating objects: 1015, done.
remote: Counting objects: 100% (262/262), done.
remote: Compressing objects: 100% (143/143), done.
remote: Total 1015 (delta 167), reused 129 (delta 119), pack-reused 753 (from 3)
Receiving objects: 100% (1015/1015), 851.14 KiB | 2.09 MiB/s, done.
Resolving deltas: 100% (613/613), completed with 65 local objects.
From github.com:jiminny/app
c3c8d86b22..68bb20c72a JY-20372-ai-reports-promotion-pages -> origin/JY-20372-ai-reports-promotion-pages
3ac71c265a..595c95b7e0 JY-19995-delete-leftover-tracks-command -> origin/JY-19995-delete-leftover-tracks-command
* [new branch] JY-20352-sync-opportunities-without-a-local-owner-user-id-is-null -> origin/JY-20352-sync-opportunities-without-a-local-owner-user-id-is-null
* [new branch] JY-20478-stop-sync-calendar-emails -> origin/JY-20478-stop-sync-calendar-emails
d4d05c775b..b11048beed JY-20541-cleanup-stale-tasks-and-events -> origin/JY-20541-cleanup-stale-tasks-and-events
10d290c778..a250abe939 JY-20663-partner-rockeed -> origin/JY-20663-partner-rockeed
* [new branch] JY-20713-activity-sync-job-restart -> origin/JY-20713-activity-sync-job-restart
242cf1b554..96a22e59f2 JY-9712-change-forever-nudges-to-1-year-expiration -> origin/JY-9712-change-forever-nudges-to-1-year-expiration
* [new branch] fix-close-missing-logger-error -> origin/fix-close-missing-logger-error
0dd5b23990..60fa1787c1 master -> origin/master
f044edca5b..e7e0e50b27 secfix/npm-20260416 -> origin/secfix/npm-20260416
* [new branch] secfix/npm-20260423 -> origin/secfix/npm-20260423
Updating c3c8d86b22..68bb20c72a
Fast-forward
Makefile | 5 +
app/Component/Activity/Services/UpdateActivityService.php | 5 +
app/Component/ActivitySearch/FilterDefinition/ActivityUpdatedDate.php | 7 +-
app/Component/ActivitySearch/Service/ActivitySearch.php | 15 ++
app/Component/AiCallScoring/Services/GenerateAiCallScoringService.php | 6 +
app/Component/AiCallScoring/Services/GetAiCallScoringService.php | 5 +-
app/Component/AiCallScoring/Transformers/AiCallScoringTransformer.php | 2 +-
app/Component/ProphetAi/ProphetClient.php | 5 +
app/Console/Commands/Crm/SyncHubspotObjects.php | 84 +++++++++++
app/Console/Commands/Crm/SyncObjects.php | 82 ++++++-----
app/Console/Commands/Crm/Traits/SyncObjectsCommandTrait.php | 81 +++++++++++
app/Console/Commands/Reports/AutomatedReportsCommand.php | 91 +++++++++++-
app/Console/Commands/Reports/AutomatedReportsSendCommand.php | 40 +++++-
app/Console/Kernel.php | 4 +
app/Contracts/Services/Crm/ImportsBusinessProcessesInterface.php | 15 ++
app/Contracts/Services/Crm/Provider/SalesforceInterface.php | 12 +-
app/Contracts/Services/Crm/ServiceInterface.php | 29 ----
app/Contracts/Services/Crm/SyncCrmMetadataInterface.php | 6 +-
app/Events/AutomatedReports/AutomatedReportGenerated.php | 15 ++
app/Http/Controllers/API/CrmController.php | 19 ++-
app/Http/Controllers/API/UserAutomatedReports/UserAutomatedReportsController.php | 33 ++++-
app/Http/Controllers/Internal/WebhookReceiver/HubspotController.php | 2 +-
app/Http/Controllers/Webhook/Hubspot/EventsController.php | 2 +-
app/Http/Controllers/Webhook/Hubspot/ProcessesWebhooksTrait.php | 64 ++++++---
app/Http/Controllers/Webhook/ReportController.php | 5 +
app/Http/Requests/Settings/AiCallScoring/CreateOrUpdateAiScorecardRequest.php | 2 +-
app/Http/Requests/Settings/AiCallScoring/CreateOrUpdateAiScorecardRuleRequest.php | 2 +-
app/Http/Requests/Settings/AiCallScoring/TestAiCallScoringPromptRequest.php | 2 +-
app/Jobs/Activity/SyncActivity.php | 3 +-
app/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJob.php | 210 ++++++++++++++++++++++++++++
app/Jobs/AutomatedReports/SendReportJob.php | 2 +
app/Jobs/AutomatedReports/SendReportMailJob.php | 6 +-
app/Jobs/Crm/SyncActivity.php | 10 ++
app/Jobs/Crm/SyncHubspotObjects.php | 120 ++++++++++++++++
app/Jobs/Crm/SyncObjects.php | 26 ++--
app/Jobs/Crm/SyncTeamMetadata.php | 14 +-
app/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEvent.php | 82 +++++++++++
app/Listeners/Crm/ResolveOwner.php | 21 +--
app/Mail/Reports/ReportWithAttachment.php | 7 +-
app/Models/Ai/AiScorecardRuleRun.php | 4 +-
app/Models/Ai/AiScorecardRun.php | 4 +-
app/Models/Contracts/UserContract.php | 6 +
app/Providers/EventServiceProvider.php | 4 +
app/Repositories/AutomatedReportsRepository.php | 76 +++++++++-
app/Repositories/Crm/CrmEntityRepository.php | 40 ++++++
app/Services/Crm/BaseService.php | 13 --
app/Services/Crm/Bullhorn/BullhornService.php | 21 ---
app/Services/Crm/Close/Service.php | 38 -----
app/Services/Crm/Copper/Service.php | 37 -----
app/Services/Crm/Dummy/Service.php | 25 ----
app/Services/Crm/Hubspot/Service.php | 37 -----
app/Services/Crm/Hubspot/ServiceTraits/OpportunitySyncTrait.php | 174 +++++++++++++++++------
app/Services/Crm/Hubspot/ServiceTraits/SyncCrmEntitiesTrait.php | 27 ++--
app/Services/Crm/IntegrationApp/Service.php | 2 +
app/Services/Crm/IntegrationApp/ServiceTraits/NotSupportedTrait.php | 12 +-
app/Services/Crm/IntegrationApp/ServiceTraits/SyncCrmMetadataTrait.php | 5 -
app/Services/Crm/Pipedrive/Service.php | 43 +-----
app/Services/Crm/Salesforce/Service.php | 13 +-
app/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityService.php | 143 +++++++++++++++++++
app/Services/Kiosk/AutomatedReports/AutomatedReportsService.php | 222 +++++++++++++++++++++++++----
front-end/package.json | 2 +-
front-end/src/__mocks__/kit/endpoints/team-insights.js | 1 +
front-end/src/components/AiReports/AiReports.vue | 9 +-
front-end/src/components/AiReports/GridCells/ActionsCell.vue | 107 +++++++++++---
front-end/src/components/AiReports/GridCells/NameCell.vue | 13 +-
front-end/src/components/AiReports/GridCells/TypeIndicator.vue | 26 ++--
front-end/src/components/AiReports/Manage/CreateDefinition/CreateDefinitionDrawer.vue | 4 +-
front-end/src/components/AiReports/Manage/ExpiringCell.vue | 86 ++++++++++++
front-end/src/components/AiReports/Manage/ManageAiReports.less | 6 +
front-end/src/components/AiReports/Manage/ManageAiReports.vue | 6 +-
front-end/src/components/AiReports/Manage/__tests__/ExpiringCell.spec.js | 116 +++++++++++++++
front-end/src/components/AiReports/Manage/__tests__/ManageAiReports.spec.js | 32 +++--
front-end/src/components/AiReports/Manage/__tests__/__snapshots__/create-definition-drawer.output.html | 83 ++++++++---
front-end/src/components/AiReports/Manage/__tests__/__snapshots__/edit-definition-drawer.output.html | 83 ++++++++---
front-end/src/components/AiReports/Manage/__tests__/__snapshots__/manage-ai-reports.output.html | 83 ++++++++---
front-end/src/components/AiReports/Manage/gridConfig.js | 12 +-
front-end/src/components/AiReports/__tests__/AiReports.spec.js | 45 +++++-
front-end/src/components/AiReports/__tests__/__mocks__/data.js | 49 +++++++
front-end/src/components/AiReports/__tests__/__mocks__/requestHandlers.js | 3 +
front-end/src/components/AiReports/__tests__/__snapshots__/ai-reports.output.html | 319 +++++++++++++++++++++++++++++++++++++++++-
front-end/src/components/AiReports/constants.js | 1 +
front-end/src/components/AiReports/gridConfig.js | 2 +-
front-end/src/components/AiReports/useAiReportsGrid.js | 27 ++++
front-end/src/components/Settings/Kiosk/AutomatedReports/RecipientsCell.vue | 36 ++++-
front-end/src/components/Settings/Kiosk/AutomatedReports/UsersCell.vue | 9 +-
front-end/src/components/Settings/Kiosk/AutomatedReports/__tests__/RecipientsCell.spec.js | 171 ++++++++++++++++++++++
front-end/src/components/Settings/OrgSettings/AiAutomation/CallScoring/ScorecardRuleForm.vue | 2 +-
front-end/src/components/TeamInsights/CoachingFrameworks/AICallScoring/aiCallScoringOverTime.ts | 18 ++-
front-end/src/components/shared/GridView/useOrder.js | 6 +-
front-end/src/components/shared/GridView/usePaginationList.js | 7 +-
front-end/yarn.lock | 8 +-
resources/views/emails/reports/ask-jiminny-report-generated.blade.php | 25 ++++
routes/api.php | 1 +
tests/Unit/Component/Activity/Services/UpdateActivityServiceTest.php | 62 ++++++++
tests/Unit/Component/AiCallScoring/Services/GenerateAiCallScoringServiceTest.php | 13 +-
tests/Unit/Console/Commands/Reports/AutomatedReportsCommandTest.php | 468 ++++++++++++++++++++++++++++++++++++++++++-------------------
tests/Unit/Http/Controllers/Webhook/Hubspot/ProcessesWebhooksTraitTest.php | 5 +-
tests/Unit/Http/Controllers/Webhook/ReportControllerTest.php | 9 +-
tests/Unit/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJobTest.php | 407 +++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Unit/Jobs/Crm/SyncActivityTest.php | 74 +++++++---
tests/Unit/Jobs/Crm/SyncHubspotObjectsTest.php | 455 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Unit/Jobs/Crm/SyncTeamMetadataTest.php | 8 +-
tests/Unit/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEventTest.php | 199 ++++++++++++++++++++++++++
tests/Unit/Listeners/Crm/ResolveOwnerTest.php | 64 ++++-----
tests/Unit/Repositories/AutomatedReportsRepositoryTest.php | 55 ++++++++
tests/Unit/Services/Crm/Copper/ServiceTest.php | 19 ---
tests/Unit/Services/Crm/Hubspot/ServiceTraits/OpportunitySyncTest.php | 74 ++++++----
tests/Unit/Services/Crm/Hubspot/ServiceTraits/SyncCrmEntitiesTraitTest.php | 8 +-
tests/Unit/Services/Crm/IntegrationApp/ServiceTraits/NotSupportedTraitTest.php | 76 ++--------
tests/Unit/Services/Crm/IntegrationApp/ServiceTraits/SyncCrmMetadataTraitTest.php | 5 -
tests/Unit/Services/Crm/Pipedrive/ServiceTest.php | 11 --
tests/Unit/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityServiceTest.php | 430 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Unit/Services/Kiosk/AutomatedReports/AutomatedReportsServiceTest.php | 521 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
113 files changed, 5468 insertions(+), 980 deletions(-)
create mode 100644 app/Console/Commands/Crm/SyncHubspotObjects.php
create mode 100644 app/Console/Commands/Crm/Traits/SyncObjectsCommandTrait.php
create mode 100644 app/Contracts/Services/Crm/ImportsBusinessProcessesInterface.php
create mode 100644 app/Events/AutomatedReports/AutomatedReportGenerated.php
create mode 100644 app/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJob.php
create mode 100644 app/Jobs/Crm/SyncHubspotObjects.php
create mode 100644 app/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEvent.php
create mode 100644 app/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityService.php
create mode 100644 front-end/src/components/AiReports/Manage/ExpiringCell.vue
create mode 100644 front-end/src/components/AiReports/Manage/__tests__/ExpiringCell.spec.js
create mode 100644 front-end/src/components/AiReports/constants.js
create mode 100644 front-end/src/components/AiReports/useAiReportsGrid.js
create mode 100644 front-end/src/components/Settings/Kiosk/AutomatedReports/__tests__/RecipientsCell.spec.js
create mode 100644 resources/views/emails/reports/ask-jiminny-report-generated.blade.php
create mode 100644 tests/Unit/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJobTest.php
create mode 100644 tests/Unit/Jobs/Crm/SyncHubspotObjectsTest.php
create mode 100644 tests/Unit/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEventTest.php
create mode 100644 tests/Unit/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityServiceTest.php
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20372-ai-reports-promotion-pages) $ git status
On branch JY-20372-ai-reports-promotion-pages
Your branch is up to date with 'origin/JY-20372-ai-reports-promotion-pages'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .env.local
modified: app/Console/Commands/JiminnyDebugCommand.php
modified: app/Http/Controllers/API/ActivityController.php
modified: app/Http/Transformers/UserTransformer.php
modified: app/Jobs/Team/SyncToIntercom.php
modified: app/Repositories/AutomatedReportsRepository.php
modified: app/Services/PlaybackService.php
modified: config/logging.php
modified: tests/Unit/Repositories/AutomatedReportsRepositoryTest.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
.env.nikilocal
.env.other
WEBHOOK_FILTERING_IMPLEMENTATION.md
app/Console/Commands/Crm/Hubspot/SimulateWebhooksCommand.php
app/Console/Commands/Reports/CreateMockAskJiminnyReportResultCommand.php
ids.txt
raw_sql_query.sql
tests/Unit/Policies/CanAccessAiReportsTest.php
no changes added to commit (use "git add" and/or "git commit -a")
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20372-ai-reports-promotion-pages) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5613/5613 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
1) app/Console/Commands/JiminnyDebugCommand.php (braces_position, statement_indentation)
---------- begin diff ----------
--- /home/jiminny/app/Console/Commands/JiminnyDebugCommand.php
+++ /home/jiminny/app/Console/Commands/JiminnyDebugCommand.php
@@ -37,15 +37,14 @@
JobDispatcherInterface $jobDispatcher,
AutomatedReportsService $automatedReportsService,
AutomatedReportsRepository $automatedReportsRepository,
- ): void
- {
-// $user = User::find(143);
-// $count = $automatedReportsRepository->countUserReports($user);
-// $this->info("Count: {$count}");
-// $count = $automatedReportsRepository->countAllUserReports($user);
-// $this->info("All count: {$count}");
-//
-// exit(1);
+ ): void {
+ // $user = User::find(143);
+ // $count = $automatedReportsRepository->countUserReports($user);
+ // $this->info("Count: {$count}");
+ // $count = $automatedReportsRepository->countAllUserReports($user);
+ // $this->info("All count: {$count}");
+ //
+ // exit(1);
$now = Carbon::now()->subDay(1);
$this->info("Now: {$now->toDateTimeString()}");
@@ -52,18 +51,18 @@
$weekStart = Carbon::getWeekStartsAt();
$this->info("Now: {$weekStart}");
-// $from = $now->copy()->previousWeekday()->startOfDay();
-// $to = $now->copy()->previousWeekday()->endOfDay();
+ // $from = $now->copy()->previousWeekday()->startOfDay();
+ // $to = $now->copy()->previousWeekday()->endOfDay();
-// $fromOld = $now->copy()->subWeeks(1)->startOfDay();
-// $toOld = $now->copy()->subDay()->endOfDay();
-// $fromNew = $now->copy()->subWeek()->startOfWeek();
-// $toNew = $now->copy()->subWeek()->endOfWeek();
+ // $fromOld = $now->copy()->subWeeks(1)->startOfDay();
+ // $toOld = $now->copy()->subDay()->endOfDay();
+ // $fromNew = $now->copy()->subWeek()->startOfWeek();
+ // $toNew = $now->copy()->subWeek()->endOfWeek();
-// $fromOld = $now->copy()->subMonths(1)->startOfDay();
-// $toOld = $now->copy()->subDay()->endOfDay();
-// $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
-// $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
+ // $fromOld = $now->copy()->subMonths(1)->startOfDay();
+ // $toOld = $now->copy()->subDay()->endOfDay();
+ // $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
+ // $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
$fromOld = $now->copy()->subMonths(3)->startOfDay();
$toOld = $now->copy()->subDay()->endOfDay();
----------- end diff -----------
Fixed 1 of 5613 files in 66.818 seconds, 67.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5616/5616 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Fixed 0 of 5616 files in 65.183 seconds, 60.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ ;xd
docker exec -it docker_lamp_1 bash -c "mv /usr/local/etc/php/conf.d/xdebug.ini ~/xdebug.ini"
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5616/5616 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Fixed 0 of 5616 files in 40.863 seconds, 60.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (master) $ git pull
remote: Enumerating objects: 53, done.
remote: Counting objects: 100% (53/53), done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 53 (delta 33), reused 49 (delta 30), pack-reused 0 (from 0)
Unpacking objects: 100% (53/53), 46.00 KiB | 523.00 KiB/s, done.
From github.com:jiminny/app
b1d5c77ad1..dfc8da14d2 JY-20372-ai-reports-promotion-pages -> origin/JY-20372-ai-reports-promotion-pages
+ 47037d2c29...5138acf14e secfix/npm-20260423 -> origin/secfix/npm-20260423 (forced update)
Already up to date.
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (master) $ co -b JY-20738-debug-AJ-tracking-UP
Switched to a new branch 'JY-20738-debug-AJ-tracking-UP'
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20738-debug-AJ-tracking-UP) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5621/5621 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Fixed 0 of 5621 files in 22.942 seconds, 60.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at https://docs.docker.com/go/debug-cli/
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20738-debug-AJ-tracking-UP) $
DOCKER
Close Tab
DEV (docker)
Close Tab
APP (-zsh)
Close Tab
screenpipe"
Close Tab
-zsh
Close Tab
-zsh
Close Tab
⌥⌘1
APP (-zsh)...
|
iTerm2
|
APP (-zsh)
|
NULL
|
77299
|
|
Last login: Thu Apr 23 14:01:28 on ttys007
Poetry Last login: Thu Apr 23 14:01:28 on ttys007
Poetry could not find a pyproject.toml file in /Users/lukas/jiminny/app or its parents
Poetry could not find a pyproject.toml file in /Users/lukas/jiminny/app or its parents
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ git status
On branch JY-20157-AJ-report-not-send-notification
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .env.local
modified: app/Console/Commands/JiminnyDebugCommand.php
modified: app/Http/Controllers/API/ActivityController.php
modified: app/Jobs/Team/SyncToIntercom.php
modified: app/Services/PlaybackService.php
modified: config/logging.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
.env.nikilocal
.env.other
WEBHOOK_FILTERING_IMPLEMENTATION.md
app/Console/Commands/Crm/Hubspot/SimulateWebhooksCommand.php
app/Console/Commands/Reports/CreateMockAskJiminnyReportResultCommand.php
ids.txt
raw_sql_query.sql
tests/Unit/Policies/CanAccessAiReportsTest.php
no changes added to commit (use "git add" and/or "git commit -a")
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ git status
On branch JY-20372-ai-reports-promotion-pages
Your branch is up to date with 'origin/JY-20372-ai-reports-promotion-pages'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .env.local
modified: app/Console/Commands/JiminnyDebugCommand.php
modified: app/Http/Controllers/API/ActivityController.php
modified: app/Jobs/Team/SyncToIntercom.php
modified: app/Services/PlaybackService.php
modified: config/logging.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
.env.nikilocal
.env.other
WEBHOOK_FILTERING_IMPLEMENTATION.md
app/Console/Commands/Crm/Hubspot/SimulateWebhooksCommand.php
app/Console/Commands/Reports/CreateMockAskJiminnyReportResultCommand.php
ids.txt
raw_sql_query.sql
tests/Unit/Policies/CanAccessAiReportsTest.php
no changes added to commit (use "git add" and/or "git commit -a")
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20372-ai-reports-promotion-pages) $ git pull
remote: Enumerating objects: 1015, done.
remote: Counting objects: 100% (262/262), done.
remote: Compressing objects: 100% (143/143), done.
remote: Total 1015 (delta 167), reused 129 (delta 119), pack-reused 753 (from 3)
Receiving objects: 100% (1015/1015), 851.14 KiB | 2.09 MiB/s, done.
Resolving deltas: 100% (613/613), completed with 65 local objects.
From github.com:jiminny/app
c3c8d86b22..68bb20c72a JY-20372-ai-reports-promotion-pages -> origin/JY-20372-ai-reports-promotion-pages
3ac71c265a..595c95b7e0 JY-19995-delete-leftover-tracks-command -> origin/JY-19995-delete-leftover-tracks-command
* [new branch] JY-20352-sync-opportunities-without-a-local-owner-user-id-is-null -> origin/JY-20352-sync-opportunities-without-a-local-owner-user-id-is-null
* [new branch] JY-20478-stop-sync-calendar-emails -> origin/JY-20478-stop-sync-calendar-emails
d4d05c775b..b11048beed JY-20541-cleanup-stale-tasks-and-events -> origin/JY-20541-cleanup-stale-tasks-and-events
10d290c778..a250abe939 JY-20663-partner-rockeed -> origin/JY-20663-partner-rockeed
* [new branch] JY-20713-activity-sync-job-restart -> origin/JY-20713-activity-sync-job-restart
242cf1b554..96a22e59f2 JY-9712-change-forever-nudges-to-1-year-expiration -> origin/JY-9712-change-forever-nudges-to-1-year-expiration
* [new branch] fix-close-missing-logger-error -> origin/fix-close-missing-logger-error
0dd5b23990..60fa1787c1 master -> origin/master
f044edca5b..e7e0e50b27 secfix/npm-20260416 -> origin/secfix/npm-20260416
* [new branch] secfix/npm-20260423 -> origin/secfix/npm-20260423
Updating c3c8d86b22..68bb20c72a
Fast-forward
Makefile | 5 +
app/Component/Activity/Services/UpdateActivityService.php | 5 +
app/Component/ActivitySearch/FilterDefinition/ActivityUpdatedDate.php | 7 +-
app/Component/ActivitySearch/Service/ActivitySearch.php | 15 ++
app/Component/AiCallScoring/Services/GenerateAiCallScoringService.php | 6 +
app/Component/AiCallScoring/Services/GetAiCallScoringService.php | 5 +-
app/Component/AiCallScoring/Transformers/AiCallScoringTransformer.php | 2 +-
app/Component/ProphetAi/ProphetClient.php | 5 +
app/Console/Commands/Crm/SyncHubspotObjects.php | 84 +++++++++++
app/Console/Commands/Crm/SyncObjects.php | 82 ++++++-----
app/Console/Commands/Crm/Traits/SyncObjectsCommandTrait.php | 81 +++++++++++
app/Console/Commands/Reports/AutomatedReportsCommand.php | 91 +++++++++++-
app/Console/Commands/Reports/AutomatedReportsSendCommand.php | 40 +++++-
app/Console/Kernel.php | 4 +
app/Contracts/Services/Crm/ImportsBusinessProcessesInterface.php | 15 ++
app/Contracts/Services/Crm/Provider/SalesforceInterface.php | 12 +-
app/Contracts/Services/Crm/ServiceInterface.php | 29 ----
app/Contracts/Services/Crm/SyncCrmMetadataInterface.php | 6 +-
app/Events/AutomatedReports/AutomatedReportGenerated.php | 15 ++
app/Http/Controllers/API/CrmController.php | 19 ++-
app/Http/Controllers/API/UserAutomatedReports/UserAutomatedReportsController.php | 33 ++++-
app/Http/Controllers/Internal/WebhookReceiver/HubspotController.php | 2 +-
app/Http/Controllers/Webhook/Hubspot/EventsController.php | 2 +-
app/Http/Controllers/Webhook/Hubspot/ProcessesWebhooksTrait.php | 64 ++++++---
app/Http/Controllers/Webhook/ReportController.php | 5 +
app/Http/Requests/Settings/AiCallScoring/CreateOrUpdateAiScorecardRequest.php | 2 +-
app/Http/Requests/Settings/AiCallScoring/CreateOrUpdateAiScorecardRuleRequest.php | 2 +-
app/Http/Requests/Settings/AiCallScoring/TestAiCallScoringPromptRequest.php | 2 +-
app/Jobs/Activity/SyncActivity.php | 3 +-
app/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJob.php | 210 ++++++++++++++++++++++++++++
app/Jobs/AutomatedReports/SendReportJob.php | 2 +
app/Jobs/AutomatedReports/SendReportMailJob.php | 6 +-
app/Jobs/Crm/SyncActivity.php | 10 ++
app/Jobs/Crm/SyncHubspotObjects.php | 120 ++++++++++++++++
app/Jobs/Crm/SyncObjects.php | 26 ++--
app/Jobs/Crm/SyncTeamMetadata.php | 14 +-
app/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEvent.php | 82 +++++++++++
app/Listeners/Crm/ResolveOwner.php | 21 +--
app/Mail/Reports/ReportWithAttachment.php | 7 +-
app/Models/Ai/AiScorecardRuleRun.php | 4 +-
app/Models/Ai/AiScorecardRun.php | 4 +-
app/Models/Contracts/UserContract.php | 6 +
app/Providers/EventServiceProvider.php | 4 +
app/Repositories/AutomatedReportsRepository.php | 76 +++++++++-
app/Repositories/Crm/CrmEntityRepository.php | 40 ++++++
app/Services/Crm/BaseService.php | 13 --
app/Services/Crm/Bullhorn/BullhornService.php | 21 ---
app/Services/Crm/Close/Service.php | 38 -----
app/Services/Crm/Copper/Service.php | 37 -----
app/Services/Crm/Dummy/Service.php | 25 ----
app/Services/Crm/Hubspot/Service.php | 37 -----
app/Services/Crm/Hubspot/ServiceTraits/OpportunitySyncTrait.php | 174 +++++++++++++++++------
app/Services/Crm/Hubspot/ServiceTraits/SyncCrmEntitiesTrait.php | 27 ++--
app/Services/Crm/IntegrationApp/Service.php | 2 +
app/Services/Crm/IntegrationApp/ServiceTraits/NotSupportedTrait.php | 12 +-
app/Services/Crm/IntegrationApp/ServiceTraits/SyncCrmMetadataTrait.php | 5 -
app/Services/Crm/Pipedrive/Service.php | 43 +-----
app/Services/Crm/Salesforce/Service.php | 13 +-
app/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityService.php | 143 +++++++++++++++++++
app/Services/Kiosk/AutomatedReports/AutomatedReportsService.php | 222 +++++++++++++++++++++++++----
front-end/package.json | 2 +-
front-end/src/__mocks__/kit/endpoints/team-insights.js | 1 +
front-end/src/components/AiReports/AiReports.vue | 9 +-
front-end/src/components/AiReports/GridCells/ActionsCell.vue | 107 +++++++++++---
front-end/src/components/AiReports/GridCells/NameCell.vue | 13 +-
front-end/src/components/AiReports/GridCells/TypeIndicator.vue | 26 ++--
front-end/src/components/AiReports/Manage/CreateDefinition/CreateDefinitionDrawer.vue | 4 +-
front-end/src/components/AiReports/Manage/ExpiringCell.vue | 86 ++++++++++++
front-end/src/components/AiReports/Manage/ManageAiReports.less | 6 +
front-end/src/components/AiReports/Manage/ManageAiReports.vue | 6 +-
front-end/src/components/AiReports/Manage/__tests__/ExpiringCell.spec.js | 116 +++++++++++++++
front-end/src/components/AiReports/Manage/__tests__/ManageAiReports.spec.js | 32 +++--
front-end/src/components/AiReports/Manage/__tests__/__snapshots__/create-definition-drawer.output.html | 83 ++++++++---
front-end/src/components/AiReports/Manage/__tests__/__snapshots__/edit-definition-drawer.output.html | 83 ++++++++---
front-end/src/components/AiReports/Manage/__tests__/__snapshots__/manage-ai-reports.output.html | 83 ++++++++---
front-end/src/components/AiReports/Manage/gridConfig.js | 12 +-
front-end/src/components/AiReports/__tests__/AiReports.spec.js | 45 +++++-
front-end/src/components/AiReports/__tests__/__mocks__/data.js | 49 +++++++
front-end/src/components/AiReports/__tests__/__mocks__/requestHandlers.js | 3 +
front-end/src/components/AiReports/__tests__/__snapshots__/ai-reports.output.html | 319 +++++++++++++++++++++++++++++++++++++++++-
front-end/src/components/AiReports/constants.js | 1 +
front-end/src/components/AiReports/gridConfig.js | 2 +-
front-end/src/components/AiReports/useAiReportsGrid.js | 27 ++++
front-end/src/components/Settings/Kiosk/AutomatedReports/RecipientsCell.vue | 36 ++++-
front-end/src/components/Settings/Kiosk/AutomatedReports/UsersCell.vue | 9 +-
front-end/src/components/Settings/Kiosk/AutomatedReports/__tests__/RecipientsCell.spec.js | 171 ++++++++++++++++++++++
front-end/src/components/Settings/OrgSettings/AiAutomation/CallScoring/ScorecardRuleForm.vue | 2 +-
front-end/src/components/TeamInsights/CoachingFrameworks/AICallScoring/aiCallScoringOverTime.ts | 18 ++-
front-end/src/components/shared/GridView/useOrder.js | 6 +-
front-end/src/components/shared/GridView/usePaginationList.js | 7 +-
front-end/yarn.lock | 8 +-
resources/views/emails/reports/ask-jiminny-report-generated.blade.php | 25 ++++
routes/api.php | 1 +
tests/Unit/Component/Activity/Services/UpdateActivityServiceTest.php | 62 ++++++++
tests/Unit/Component/AiCallScoring/Services/GenerateAiCallScoringServiceTest.php | 13 +-
tests/Unit/Console/Commands/Reports/AutomatedReportsCommandTest.php | 468 ++++++++++++++++++++++++++++++++++++++++++-------------------
tests/Unit/Http/Controllers/Webhook/Hubspot/ProcessesWebhooksTraitTest.php | 5 +-
tests/Unit/Http/Controllers/Webhook/ReportControllerTest.php | 9 +-
tests/Unit/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJobTest.php | 407 +++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Unit/Jobs/Crm/SyncActivityTest.php | 74 +++++++---
tests/Unit/Jobs/Crm/SyncHubspotObjectsTest.php | 455 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Unit/Jobs/Crm/SyncTeamMetadataTest.php | 8 +-
tests/Unit/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEventTest.php | 199 ++++++++++++++++++++++++++
tests/Unit/Listeners/Crm/ResolveOwnerTest.php | 64 ++++-----
tests/Unit/Repositories/AutomatedReportsRepositoryTest.php | 55 ++++++++
tests/Unit/Services/Crm/Copper/ServiceTest.php | 19 ---
tests/Unit/Services/Crm/Hubspot/ServiceTraits/OpportunitySyncTest.php | 74 ++++++----
tests/Unit/Services/Crm/Hubspot/ServiceTraits/SyncCrmEntitiesTraitTest.php | 8 +-
tests/Unit/Services/Crm/IntegrationApp/ServiceTraits/NotSupportedTraitTest.php | 76 ++--------
tests/Unit/Services/Crm/IntegrationApp/ServiceTraits/SyncCrmMetadataTraitTest.php | 5 -
tests/Unit/Services/Crm/Pipedrive/ServiceTest.php | 11 --
tests/Unit/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityServiceTest.php | 430 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Unit/Services/Kiosk/AutomatedReports/AutomatedReportsServiceTest.php | 521 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
113 files changed, 5468 insertions(+), 980 deletions(-)
create mode 100644 app/Console/Commands/Crm/SyncHubspotObjects.php
create mode 100644 app/Console/Commands/Crm/Traits/SyncObjectsCommandTrait.php
create mode 100644 app/Contracts/Services/Crm/ImportsBusinessProcessesInterface.php
create mode 100644 app/Events/AutomatedReports/AutomatedReportGenerated.php
create mode 100644 app/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJob.php
create mode 100644 app/Jobs/Crm/SyncHubspotObjects.php
create mode 100644 app/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEvent.php
create mode 100644 app/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityService.php
create mode 100644 front-end/src/components/AiReports/Manage/ExpiringCell.vue
create mode 100644 front-end/src/components/AiReports/Manage/__tests__/ExpiringCell.spec.js
create mode 100644 front-end/src/components/AiReports/constants.js
create mode 100644 front-end/src/components/AiReports/useAiReportsGrid.js
create mode 100644 front-end/src/components/Settings/Kiosk/AutomatedReports/__tests__/RecipientsCell.spec.js
create mode 100644 resources/views/emails/reports/ask-jiminny-report-generated.blade.php
create mode 100644 tests/Unit/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJobTest.php
create mode 100644 tests/Unit/Jobs/Crm/SyncHubspotObjectsTest.php
create mode 100644 tests/Unit/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEventTest.php
create mode 100644 tests/Unit/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityServiceTest.php
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20372-ai-reports-promotion-pages) $ git status
On branch JY-20372-ai-reports-promotion-pages
Your branch is up to date with 'origin/JY-20372-ai-reports-promotion-pages'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .env.local
modified: app/Console/Commands/JiminnyDebugCommand.php
modified: app/Http/Controllers/API/ActivityController.php
modified: app/Http/Transformers/UserTransformer.php
modified: app/Jobs/Team/SyncToIntercom.php
modified: app/Repositories/AutomatedReportsRepository.php
modified: app/Services/PlaybackService.php
modified: config/logging.php
modified: tests/Unit/Repositories/AutomatedReportsRepositoryTest.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
.env.nikilocal
.env.other
WEBHOOK_FILTERING_IMPLEMENTATION.md
app/Console/Commands/Crm/Hubspot/SimulateWebhooksCommand.php
app/Console/Commands/Reports/CreateMockAskJiminnyReportResultCommand.php
ids.txt
raw_sql_query.sql
tests/Unit/Policies/CanAccessAiReportsTest.php
no changes added to commit (use "git add" and/or "git commit -a")
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20372-ai-reports-promotion-pages) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5613/5613 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
1) app/Console/Commands/JiminnyDebugCommand.php (braces_position, statement_indentation)
---------- begin diff ----------
--- /home/jiminny/app/Console/Commands/JiminnyDebugCommand.php
+++ /home/jiminny/app/Console/Commands/JiminnyDebugCommand.php
@@ -37,15 +37,14 @@
JobDispatcherInterface $jobDispatcher,
AutomatedReportsService $automatedReportsService,
AutomatedReportsRepository $automatedReportsRepository,
- ): void
- {
-// $user = User::find(143);
-// $count = $automatedReportsRepository->countUserReports($user);
-// $this->info("Count: {$count}");
-// $count = $automatedReportsRepository->countAllUserReports($user);
-// $this->info("All count: {$count}");
-//
-// exit(1);
+ ): void {
+ // $user = User::find(143);
+ // $count = $automatedReportsRepository->countUserReports($user);
+ // $this->info("Count: {$count}");
+ // $count = $automatedReportsRepository->countAllUserReports($user);
+ // $this->info("All count: {$count}");
+ //
+ // exit(1);
$now = Carbon::now()->subDay(1);
$this->info("Now: {$now->toDateTimeString()}");
@@ -52,18 +51,18 @@
$weekStart = Carbon::getWeekStartsAt();
$this->info("Now: {$weekStart}");
-// $from = $now->copy()->previousWeekday()->startOfDay();
-// $to = $now->copy()->previousWeekday()->endOfDay();
+ // $from = $now->copy()->previousWeekday()->startOfDay();
+ // $to = $now->copy()->previousWeekday()->endOfDay();
-// $fromOld = $now->copy()->subWeeks(1)->startOfDay();
-// $toOld = $now->copy()->subDay()->endOfDay();
-// $fromNew = $now->copy()->subWeek()->startOfWeek();
-// $toNew = $now->copy()->subWeek()->endOfWeek();
+ // $fromOld = $now->copy()->subWeeks(1)->startOfDay();
+ // $toOld = $now->copy()->subDay()->endOfDay();
+ // $fromNew = $now->copy()->subWeek()->startOfWeek();
+ // $toNew = $now->copy()->subWeek()->endOfWeek();
-// $fromOld = $now->copy()->subMonths(1)->startOfDay();
-// $toOld = $now->copy()->subDay()->endOfDay();
-// $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
-// $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
+ // $fromOld = $now->copy()->subMonths(1)->startOfDay();
+ // $toOld = $now->copy()->subDay()->endOfDay();
+ // $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
+ // $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
$fromOld = $now->copy()->subMonths(3)->startOfDay();
$toOld = $now->copy()->subDay()->endOfDay();
----------- end diff -----------
Fixed 1 of 5613 files in 66.818 seconds, 67.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5616/5616 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Fixed 0 of 5616 files in 65.183 seconds, 60.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ ;xd
docker exec -it docker_lamp_1 bash -c "mv /usr/local/etc/php/conf.d/xdebug.ini ~/xdebug.ini"
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5616/5616 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Fixed 0 of 5616 files in 40.863 seconds, 60.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (master) $ git pull
remote: Enumerating objects: 53, done.
remote: Counting objects: 100% (53/53), done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 53 (delta 33), reused 49 (delta 30), pack-reused 0 (from 0)
Unpacking objects: 100% (53/53), 46.00 KiB | 523.00 KiB/s, done.
From github.com:jiminny/app
b1d5c77ad1..dfc8da14d2 JY-20372-ai-reports-promotion-pages -> origin/JY-20372-ai-reports-promotion-pages
+ 47037d2c29...5138acf14e secfix/npm-20260423 -> origin/secfix/npm-20260423 (forced update)
Already up to date.
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (master) $ co -b JY-20738-debug-AJ-tracking-UP
Switched to a new branch 'JY-20738-debug-AJ-tracking-UP'
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20738-debug-AJ-tracking-UP) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5621/5621 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Fixed 0 of 5621 files in 22.942 seconds, 60.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at https://docs.docker.com/go/debug-cli/
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20738-debug-AJ-tracking-UP) $
DOCKER
Close Tab
DEV (docker)
Close Tab
APP (-zsh)
Close Tab
screenpipe"
Close Tab
-zsh
Close Tab
-zsh
Close Tab
⌥⌘1
APP (-zsh)...
|
iTerm2
|
APP (-zsh)
|
NULL
|
77302
|
|
Last login: Thu Apr 23 14:01:28 on ttys007
Poetry Last login: Thu Apr 23 14:01:28 on ttys007
Poetry could not find a pyproject.toml file in /Users/lukas/jiminny/app or its parents
Poetry could not find a pyproject.toml file in /Users/lukas/jiminny/app or its parents
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ git status
On branch JY-20157-AJ-report-not-send-notification
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .env.local
modified: app/Console/Commands/JiminnyDebugCommand.php
modified: app/Http/Controllers/API/ActivityController.php
modified: app/Jobs/Team/SyncToIntercom.php
modified: app/Services/PlaybackService.php
modified: config/logging.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
.env.nikilocal
.env.other
WEBHOOK_FILTERING_IMPLEMENTATION.md
app/Console/Commands/Crm/Hubspot/SimulateWebhooksCommand.php
app/Console/Commands/Reports/CreateMockAskJiminnyReportResultCommand.php
ids.txt
raw_sql_query.sql
tests/Unit/Policies/CanAccessAiReportsTest.php
no changes added to commit (use "git add" and/or "git commit -a")
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ git status
On branch JY-20372-ai-reports-promotion-pages
Your branch is up to date with 'origin/JY-20372-ai-reports-promotion-pages'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .env.local
modified: app/Console/Commands/JiminnyDebugCommand.php
modified: app/Http/Controllers/API/ActivityController.php
modified: app/Jobs/Team/SyncToIntercom.php
modified: app/Services/PlaybackService.php
modified: config/logging.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
.env.nikilocal
.env.other
WEBHOOK_FILTERING_IMPLEMENTATION.md
app/Console/Commands/Crm/Hubspot/SimulateWebhooksCommand.php
app/Console/Commands/Reports/CreateMockAskJiminnyReportResultCommand.php
ids.txt
raw_sql_query.sql
tests/Unit/Policies/CanAccessAiReportsTest.php
no changes added to commit (use "git add" and/or "git commit -a")
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20372-ai-reports-promotion-pages) $ git pull
remote: Enumerating objects: 1015, done.
remote: Counting objects: 100% (262/262), done.
remote: Compressing objects: 100% (143/143), done.
remote: Total 1015 (delta 167), reused 129 (delta 119), pack-reused 753 (from 3)
Receiving objects: 100% (1015/1015), 851.14 KiB | 2.09 MiB/s, done.
Resolving deltas: 100% (613/613), completed with 65 local objects.
From github.com:jiminny/app
c3c8d86b22..68bb20c72a JY-20372-ai-reports-promotion-pages -> origin/JY-20372-ai-reports-promotion-pages
3ac71c265a..595c95b7e0 JY-19995-delete-leftover-tracks-command -> origin/JY-19995-delete-leftover-tracks-command
* [new branch] JY-20352-sync-opportunities-without-a-local-owner-user-id-is-null -> origin/JY-20352-sync-opportunities-without-a-local-owner-user-id-is-null
* [new branch] JY-20478-stop-sync-calendar-emails -> origin/JY-20478-stop-sync-calendar-emails
d4d05c775b..b11048beed JY-20541-cleanup-stale-tasks-and-events -> origin/JY-20541-cleanup-stale-tasks-and-events
10d290c778..a250abe939 JY-20663-partner-rockeed -> origin/JY-20663-partner-rockeed
* [new branch] JY-20713-activity-sync-job-restart -> origin/JY-20713-activity-sync-job-restart
242cf1b554..96a22e59f2 JY-9712-change-forever-nudges-to-1-year-expiration -> origin/JY-9712-change-forever-nudges-to-1-year-expiration
* [new branch] fix-close-missing-logger-error -> origin/fix-close-missing-logger-error
0dd5b23990..60fa1787c1 master -> origin/master
f044edca5b..e7e0e50b27 secfix/npm-20260416 -> origin/secfix/npm-20260416
* [new branch] secfix/npm-20260423 -> origin/secfix/npm-20260423
Updating c3c8d86b22..68bb20c72a
Fast-forward
Makefile | 5 +
app/Component/Activity/Services/UpdateActivityService.php | 5 +
app/Component/ActivitySearch/FilterDefinition/ActivityUpdatedDate.php | 7 +-
app/Component/ActivitySearch/Service/ActivitySearch.php | 15 ++
app/Component/AiCallScoring/Services/GenerateAiCallScoringService.php | 6 +
app/Component/AiCallScoring/Services/GetAiCallScoringService.php | 5 +-
app/Component/AiCallScoring/Transformers/AiCallScoringTransformer.php | 2 +-
app/Component/ProphetAi/ProphetClient.php | 5 +
app/Console/Commands/Crm/SyncHubspotObjects.php | 84 +++++++++++
app/Console/Commands/Crm/SyncObjects.php | 82 ++++++-----
app/Console/Commands/Crm/Traits/SyncObjectsCommandTrait.php | 81 +++++++++++
app/Console/Commands/Reports/AutomatedReportsCommand.php | 91 +++++++++++-
app/Console/Commands/Reports/AutomatedReportsSendCommand.php | 40 +++++-
app/Console/Kernel.php | 4 +
app/Contracts/Services/Crm/ImportsBusinessProcessesInterface.php | 15 ++
app/Contracts/Services/Crm/Provider/SalesforceInterface.php | 12 +-
app/Contracts/Services/Crm/ServiceInterface.php | 29 ----
app/Contracts/Services/Crm/SyncCrmMetadataInterface.php | 6 +-
app/Events/AutomatedReports/AutomatedReportGenerated.php | 15 ++
app/Http/Controllers/API/CrmController.php | 19 ++-
app/Http/Controllers/API/UserAutomatedReports/UserAutomatedReportsController.php | 33 ++++-
app/Http/Controllers/Internal/WebhookReceiver/HubspotController.php | 2 +-
app/Http/Controllers/Webhook/Hubspot/EventsController.php | 2 +-
app/Http/Controllers/Webhook/Hubspot/ProcessesWebhooksTrait.php | 64 ++++++---
app/Http/Controllers/Webhook/ReportController.php | 5 +
app/Http/Requests/Settings/AiCallScoring/CreateOrUpdateAiScorecardRequest.php | 2 +-
app/Http/Requests/Settings/AiCallScoring/CreateOrUpdateAiScorecardRuleRequest.php | 2 +-
app/Http/Requests/Settings/AiCallScoring/TestAiCallScoringPromptRequest.php | 2 +-
app/Jobs/Activity/SyncActivity.php | 3 +-
app/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJob.php | 210 ++++++++++++++++++++++++++++
app/Jobs/AutomatedReports/SendReportJob.php | 2 +
app/Jobs/AutomatedReports/SendReportMailJob.php | 6 +-
app/Jobs/Crm/SyncActivity.php | 10 ++
app/Jobs/Crm/SyncHubspotObjects.php | 120 ++++++++++++++++
app/Jobs/Crm/SyncObjects.php | 26 ++--
app/Jobs/Crm/SyncTeamMetadata.php | 14 +-
app/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEvent.php | 82 +++++++++++
app/Listeners/Crm/ResolveOwner.php | 21 +--
app/Mail/Reports/ReportWithAttachment.php | 7 +-
app/Models/Ai/AiScorecardRuleRun.php | 4 +-
app/Models/Ai/AiScorecardRun.php | 4 +-
app/Models/Contracts/UserContract.php | 6 +
app/Providers/EventServiceProvider.php | 4 +
app/Repositories/AutomatedReportsRepository.php | 76 +++++++++-
app/Repositories/Crm/CrmEntityRepository.php | 40 ++++++
app/Services/Crm/BaseService.php | 13 --
app/Services/Crm/Bullhorn/BullhornService.php | 21 ---
app/Services/Crm/Close/Service.php | 38 -----
app/Services/Crm/Copper/Service.php | 37 -----
app/Services/Crm/Dummy/Service.php | 25 ----
app/Services/Crm/Hubspot/Service.php | 37 -----
app/Services/Crm/Hubspot/ServiceTraits/OpportunitySyncTrait.php | 174 +++++++++++++++++------
app/Services/Crm/Hubspot/ServiceTraits/SyncCrmEntitiesTrait.php | 27 ++--
app/Services/Crm/IntegrationApp/Service.php | 2 +
app/Services/Crm/IntegrationApp/ServiceTraits/NotSupportedTrait.php | 12 +-
app/Services/Crm/IntegrationApp/ServiceTraits/SyncCrmMetadataTrait.php | 5 -
app/Services/Crm/Pipedrive/Service.php | 43 +-----
app/Services/Crm/Salesforce/Service.php | 13 +-
app/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityService.php | 143 +++++++++++++++++++
app/Services/Kiosk/AutomatedReports/AutomatedReportsService.php | 222 +++++++++++++++++++++++++----
front-end/package.json | 2 +-
front-end/src/__mocks__/kit/endpoints/team-insights.js | 1 +
front-end/src/components/AiReports/AiReports.vue | 9 +-
front-end/src/components/AiReports/GridCells/ActionsCell.vue | 107 +++++++++++---
front-end/src/components/AiReports/GridCells/NameCell.vue | 13 +-
front-end/src/components/AiReports/GridCells/TypeIndicator.vue | 26 ++--
front-end/src/components/AiReports/Manage/CreateDefinition/CreateDefinitionDrawer.vue | 4 +-
front-end/src/components/AiReports/Manage/ExpiringCell.vue | 86 ++++++++++++
front-end/src/components/AiReports/Manage/ManageAiReports.less | 6 +
front-end/src/components/AiReports/Manage/ManageAiReports.vue | 6 +-
front-end/src/components/AiReports/Manage/__tests__/ExpiringCell.spec.js | 116 +++++++++++++++
front-end/src/components/AiReports/Manage/__tests__/ManageAiReports.spec.js | 32 +++--
front-end/src/components/AiReports/Manage/__tests__/__snapshots__/create-definition-drawer.output.html | 83 ++++++++---
front-end/src/components/AiReports/Manage/__tests__/__snapshots__/edit-definition-drawer.output.html | 83 ++++++++---
front-end/src/components/AiReports/Manage/__tests__/__snapshots__/manage-ai-reports.output.html | 83 ++++++++---
front-end/src/components/AiReports/Manage/gridConfig.js | 12 +-
front-end/src/components/AiReports/__tests__/AiReports.spec.js | 45 +++++-
front-end/src/components/AiReports/__tests__/__mocks__/data.js | 49 +++++++
front-end/src/components/AiReports/__tests__/__mocks__/requestHandlers.js | 3 +
front-end/src/components/AiReports/__tests__/__snapshots__/ai-reports.output.html | 319 +++++++++++++++++++++++++++++++++++++++++-
front-end/src/components/AiReports/constants.js | 1 +
front-end/src/components/AiReports/gridConfig.js | 2 +-
front-end/src/components/AiReports/useAiReportsGrid.js | 27 ++++
front-end/src/components/Settings/Kiosk/AutomatedReports/RecipientsCell.vue | 36 ++++-
front-end/src/components/Settings/Kiosk/AutomatedReports/UsersCell.vue | 9 +-
front-end/src/components/Settings/Kiosk/AutomatedReports/__tests__/RecipientsCell.spec.js | 171 ++++++++++++++++++++++
front-end/src/components/Settings/OrgSettings/AiAutomation/CallScoring/ScorecardRuleForm.vue | 2 +-
front-end/src/components/TeamInsights/CoachingFrameworks/AICallScoring/aiCallScoringOverTime.ts | 18 ++-
front-end/src/components/shared/GridView/useOrder.js | 6 +-
front-end/src/components/shared/GridView/usePaginationList.js | 7 +-
front-end/yarn.lock | 8 +-
resources/views/emails/reports/ask-jiminny-report-generated.blade.php | 25 ++++
routes/api.php | 1 +
tests/Unit/Component/Activity/Services/UpdateActivityServiceTest.php | 62 ++++++++
tests/Unit/Component/AiCallScoring/Services/GenerateAiCallScoringServiceTest.php | 13 +-
tests/Unit/Console/Commands/Reports/AutomatedReportsCommandTest.php | 468 ++++++++++++++++++++++++++++++++++++++++++-------------------
tests/Unit/Http/Controllers/Webhook/Hubspot/ProcessesWebhooksTraitTest.php | 5 +-
tests/Unit/Http/Controllers/Webhook/ReportControllerTest.php | 9 +-
tests/Unit/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJobTest.php | 407 +++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Unit/Jobs/Crm/SyncActivityTest.php | 74 +++++++---
tests/Unit/Jobs/Crm/SyncHubspotObjectsTest.php | 455 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Unit/Jobs/Crm/SyncTeamMetadataTest.php | 8 +-
tests/Unit/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEventTest.php | 199 ++++++++++++++++++++++++++
tests/Unit/Listeners/Crm/ResolveOwnerTest.php | 64 ++++-----
tests/Unit/Repositories/AutomatedReportsRepositoryTest.php | 55 ++++++++
tests/Unit/Services/Crm/Copper/ServiceTest.php | 19 ---
tests/Unit/Services/Crm/Hubspot/ServiceTraits/OpportunitySyncTest.php | 74 ++++++----
tests/Unit/Services/Crm/Hubspot/ServiceTraits/SyncCrmEntitiesTraitTest.php | 8 +-
tests/Unit/Services/Crm/IntegrationApp/ServiceTraits/NotSupportedTraitTest.php | 76 ++--------
tests/Unit/Services/Crm/IntegrationApp/ServiceTraits/SyncCrmMetadataTraitTest.php | 5 -
tests/Unit/Services/Crm/Pipedrive/ServiceTest.php | 11 --
tests/Unit/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityServiceTest.php | 430 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Unit/Services/Kiosk/AutomatedReports/AutomatedReportsServiceTest.php | 521 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
113 files changed, 5468 insertions(+), 980 deletions(-)
create mode 100644 app/Console/Commands/Crm/SyncHubspotObjects.php
create mode 100644 app/Console/Commands/Crm/Traits/SyncObjectsCommandTrait.php
create mode 100644 app/Contracts/Services/Crm/ImportsBusinessProcessesInterface.php
create mode 100644 app/Events/AutomatedReports/AutomatedReportGenerated.php
create mode 100644 app/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJob.php
create mode 100644 app/Jobs/Crm/SyncHubspotObjects.php
create mode 100644 app/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEvent.php
create mode 100644 app/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityService.php
create mode 100644 front-end/src/components/AiReports/Manage/ExpiringCell.vue
create mode 100644 front-end/src/components/AiReports/Manage/__tests__/ExpiringCell.spec.js
create mode 100644 front-end/src/components/AiReports/constants.js
create mode 100644 front-end/src/components/AiReports/useAiReportsGrid.js
create mode 100644 front-end/src/components/Settings/Kiosk/AutomatedReports/__tests__/RecipientsCell.spec.js
create mode 100644 resources/views/emails/reports/ask-jiminny-report-generated.blade.php
create mode 100644 tests/Unit/Jobs/AutomatedReports/RequestGenerateAskJiminnyReportJobTest.php
create mode 100644 tests/Unit/Jobs/Crm/SyncHubspotObjectsTest.php
create mode 100644 tests/Unit/Listeners/AutomatedReports/UserPilot/TrackAutomatedReportGeneratedEventTest.php
create mode 100644 tests/Unit/Services/Kiosk/AutomatedReports/AskJiminnyReportActivityServiceTest.php
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20372-ai-reports-promotion-pages) $ git status
On branch JY-20372-ai-reports-promotion-pages
Your branch is up to date with 'origin/JY-20372-ai-reports-promotion-pages'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .env.local
modified: app/Console/Commands/JiminnyDebugCommand.php
modified: app/Http/Controllers/API/ActivityController.php
modified: app/Http/Transformers/UserTransformer.php
modified: app/Jobs/Team/SyncToIntercom.php
modified: app/Repositories/AutomatedReportsRepository.php
modified: app/Services/PlaybackService.php
modified: config/logging.php
modified: tests/Unit/Repositories/AutomatedReportsRepositoryTest.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
.env.nikilocal
.env.other
WEBHOOK_FILTERING_IMPLEMENTATION.md
app/Console/Commands/Crm/Hubspot/SimulateWebhooksCommand.php
app/Console/Commands/Reports/CreateMockAskJiminnyReportResultCommand.php
ids.txt
raw_sql_query.sql
tests/Unit/Policies/CanAccessAiReportsTest.php
no changes added to commit (use "git add" and/or "git commit -a")
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20372-ai-reports-promotion-pages) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5613/5613 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
1) app/Console/Commands/JiminnyDebugCommand.php (braces_position, statement_indentation)
---------- begin diff ----------
--- /home/jiminny/app/Console/Commands/JiminnyDebugCommand.php
+++ /home/jiminny/app/Console/Commands/JiminnyDebugCommand.php
@@ -37,15 +37,14 @@
JobDispatcherInterface $jobDispatcher,
AutomatedReportsService $automatedReportsService,
AutomatedReportsRepository $automatedReportsRepository,
- ): void
- {
-// $user = User::find(143);
-// $count = $automatedReportsRepository->countUserReports($user);
-// $this->info("Count: {$count}");
-// $count = $automatedReportsRepository->countAllUserReports($user);
-// $this->info("All count: {$count}");
-//
-// exit(1);
+ ): void {
+ // $user = User::find(143);
+ // $count = $automatedReportsRepository->countUserReports($user);
+ // $this->info("Count: {$count}");
+ // $count = $automatedReportsRepository->countAllUserReports($user);
+ // $this->info("All count: {$count}");
+ //
+ // exit(1);
$now = Carbon::now()->subDay(1);
$this->info("Now: {$now->toDateTimeString()}");
@@ -52,18 +51,18 @@
$weekStart = Carbon::getWeekStartsAt();
$this->info("Now: {$weekStart}");
-// $from = $now->copy()->previousWeekday()->startOfDay();
-// $to = $now->copy()->previousWeekday()->endOfDay();
+ // $from = $now->copy()->previousWeekday()->startOfDay();
+ // $to = $now->copy()->previousWeekday()->endOfDay();
-// $fromOld = $now->copy()->subWeeks(1)->startOfDay();
-// $toOld = $now->copy()->subDay()->endOfDay();
-// $fromNew = $now->copy()->subWeek()->startOfWeek();
-// $toNew = $now->copy()->subWeek()->endOfWeek();
+ // $fromOld = $now->copy()->subWeeks(1)->startOfDay();
+ // $toOld = $now->copy()->subDay()->endOfDay();
+ // $fromNew = $now->copy()->subWeek()->startOfWeek();
+ // $toNew = $now->copy()->subWeek()->endOfWeek();
-// $fromOld = $now->copy()->subMonths(1)->startOfDay();
-// $toOld = $now->copy()->subDay()->endOfDay();
-// $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
-// $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
+ // $fromOld = $now->copy()->subMonths(1)->startOfDay();
+ // $toOld = $now->copy()->subDay()->endOfDay();
+ // $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
+ // $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
$fromOld = $now->copy()->subMonths(3)->startOfDay();
$toOld = $now->copy()->subDay()->endOfDay();
----------- end diff -----------
Fixed 1 of 5613 files in 66.818 seconds, 67.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5616/5616 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Fixed 0 of 5616 files in 65.183 seconds, 60.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ ;xd
docker exec -it docker_lamp_1 bash -c "mv /usr/local/etc/php/conf.d/xdebug.ini ~/xdebug.ini"
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (JY-20157-AJ-report-not-send-notification) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5616/5616 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Fixed 0 of 5616 files in 40.863 seconds, 60.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at [URL_WITH_CREDENTIALS] ~/jiminny/app (master) $ git pull
remote: Enumerating objects: 53, done.
remote: Counting objects: 100% (53/53), done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 53 (delta 33), reused 49 (delta 30), pack-reused 0 (from 0)
Unpacking objects: 100% (53/53), 46.00 KiB | 523.00 KiB/s, done.
From github.com:jiminny/app
b1d5c77ad1..dfc8da14d2 JY-20372-ai-reports-promotion-pages -> origin/JY-20372-ai-reports-promotion-pages
+ 47037d2c29...5138acf14e secfix/npm-20260423 -> origin/secfix/npm-20260423 (forced update)
Already up to date.
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (master) $ co -b JY-20738-debug-AJ-tracking-UP
Switched to a new branch 'JY-20738-debug-AJ-tracking-UP'
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20738-debug-AJ-tracking-UP) $ csfix
docker exec -it docker_lamp_1 ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no --diff
PHP CS Fixer 3.87.1 Alexander by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.30
Running 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!
Loaded config default from ".php-cs-fixer.dist.php".
5621/5621 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Fixed 0 of 5621 files in 22.942 seconds, 60.00 MB memory used
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug docker_lamp_1
Learn more at https://docs.docker.com/go/debug-cli/
lukas@Lukas-Kovaliks-MacBook-Pro-Jiminny ~/jiminny/app (JY-20738-debug-AJ-tracking-UP) $
DOCKER
Close Tab
DEV (docker)
Close Tab
APP (-zsh)
Close Tab
screenpipe"
Close Tab
-zsh
Close Tab
-zsh
Close Tab
⌥⌘1
APP (-zsh)...
|
iTerm2
|
APP (-zsh)
|
NULL
|
77303
|
|
Pushed JY-20738-debug-AJ-tracking-UP to new branch Pushed JY-20738-debug-AJ-tracking-UP to new branch origin/JY-20738-debug-AJ-tracking-UP
text/html
text/html
text/html
Create pull request
4 files committed
JY-20738 add debug logs on AJ report UP tracking
text/html
text/html
text/html
Edit Commit Message…...
|
PhpStorm
|
faVsco.js – JiminnyDebugCommand.php
|
NULL
|
77304
|
|
Pushed JY-20738-debug-AJ-tracking-UP to new branch Pushed JY-20738-debug-AJ-tracking-UP to new branch origin/JY-20738-debug-AJ-tracking-UP
text/html
text/html
text/html
Create pull request
4 files committed
JY-20738 add debug logs on AJ report UP tracking
text/html
text/html
text/html
Edit Commit Message…
Project: faVsco.js, menu
JY-20738-debug-AJ-tracking-UP, menu
Start Listening for PHP Debug Connections
ReportControllerTest
Run 'ReportControllerTest'
Debug 'ReportControllerTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
3
115
4
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use InvalidArgumentException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateAskJiminnyReportJob;
use Jiminny\Jobs\AutomatedReports\SendReportMailJob;
use Jiminny\Jobs\JobDispatcherInterface;
use Jiminny\Models\Activity;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Services\Activity\CrmOwnerResolver;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\UserPilot\UserPilotClient;
/**
* Class JiminnyDebugCommand
*
* @package Jiminny\Console\Commands
*/
class JiminnyDebugCommand extends Command
{
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';
protected $signature = 'jiminny:debug';
public function handle(
JobDispatcherInterface $jobDispatcher,
AutomatedReportsService $automatedReportsService,
AutomatedReportsRepository $automatedReportsRepository,
UserPilotClient $userPilotClient
): void {
$user = User::find(143);
// $count = $automatedReportsRepository->countUserReports($user);
// $this->info("Count: {$count}");
// $count = $automatedReportsRepository->countAllUserReports($user);
// $this->info("All count: {$count}");
$payload = [
'report_type' => 'ask_jiminny',
'frequency' => 'weekly',
];
$userPilotClient->track($user, 'ask-jiminny-report-generated', $payload);
exit(1);
$now = Carbon::now()->subDay(1);
$this->info("Now: {$now->toDateTimeString()}");
$weekStart = Carbon::getWeekStartsAt();
$this->info("Now: {$weekStart}");
// $from = $now->copy()->previousWeekday()->startOfDay();
// $to = $now->copy()->previousWeekday()->endOfDay();
// $fromOld = $now->copy()->subWeeks(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subWeek()->startOfWeek();
// $toNew = $now->copy()->subWeek()->endOfWeek();
// $fromOld = $now->copy()->subMonths(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
// $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
$fromOld = $now->copy()->subMonths(3)->startOfDay();
$toOld = $now->copy()->subDay()->endOfDay();
$fromNew = $now->copy()->subQuarterNoOverflow()->startOfQuarter();
$toNew = $now->copy()->subQuarterNoOverflow()->endOfQuarter();
$this->info("From old: {$fromOld->toDateTimeString()}");
$this->info("To old: {$toOld->toDateTimeString()}");
$this->info("From new: {$fromNew->toDateTimeString()}");
$this->info("To new: {$toNew->toDateTimeString()}");
exit(1);
$report = AutomatedReport::find(71);
$job = new RequestGenerateAskJiminnyReportJob($report->getUuid());
$jobDispatcher->dispatch($job);
exit(1);
// $this->formatDate($jobDispatcher);
// $this->sendMail($jobDispatcher, $automatedReportsService);
// $this->crmService();
$this->getPayload($automatedReportsService);
exit(1);
}
private function crmService()
{
$activity = Activity::find(418141);
$team = Team::find(19);
$config = $team->getCrmConfiguration();
$crmResolver = app(CrmOwnerResolver::class, [
'team' => $team,
'integrationAdmin' => $team->getOwner(),
'providerSlug' => $config->getProviderName(),
]);
$crmService = $crmResolver->prepareCrmService();
$crmService->createTranscriptNotes($activity);
}
private function sendMail(JobDispatcherInterface $jobDispatcher, AutomatedReportsService $automatedReportsService)
{
$reportUuid = '';
// $report = $automatedReportsService->getReportResult($reportUuid);
$report = AutomatedReportResult::find(275);
$validRecipients = $automatedReportsService->getValidRecipientUsers(
$report->getReport(),
includeJiminny: true,
);
$recipient = $validRecipients[0];
$fileName = $automatedReportsService->getReportFileName($report);
$typeName = $report->getReport()->getCustomName()
?? $automatedReportsService->getReportTypeName($report);
$teamsName = $automatedReportsService->getReportTeamsName($report);
$periodName = $automatedReportsService->getReportPeriodName($report);
$s3Path = $automatedReportsService->getMediaPath($report);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$fileName ' . PHP_EOL . print_r($fileName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$typeName ' . PHP_EOL . print_r($typeName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$teamsName ' . PHP_EOL . print_r($teamsName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$periodName ' . PHP_EOL . print_r($periodName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$s3Path ' . PHP_EOL . print_r($s3Path, true));
$jobDispatcher->dispatch(
new SendReportMailJob(
reportUuid: $report->getUuid(),
s3Path: $s3Path,
recipientEmail: $recipient['email'],
recipientName: $recipient['name'] ?? null,
fileName: $fileName,
typeName: $typeName,
teamsName: $teamsName,
periodName: $periodName,
isAskJiminny: true,
)
);
exit(1);
}
private function formatDate(JobDispatcherInterface $jobDispatcher): void
{
$customName = 'Custom report name';
// $frequency = self::FREQUENCY_DAILY;
// $frequency = self::FREQUENCY_WEEKLY;
$frequency = self::FREQUENCY_MONTHLY;
// $frequency = self::FREQUENCY_QUARTERLY;
// $frequency = self::FREQUENCY_ONE_OFF;
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
$periodName = $this->formatReportPeriodName($frequency, $from, $to);
$filenameSuffix = null;
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
$result = $this->sanitizeFileName("{$customName} - {$periodName}");
}
$this->info($result);
}
public function calculateFromAndToDatePeriod(
string $frequency,
?Carbon $fromDate = null,
?Carbon $toDate = null
): array {
if ($frequency === self::FREQUENCY_ONE_OFF) {
return [
'fromDate' => $fromDate,
'toDate' => $toDate,
];
}
$now = Carbon::now();
return match ($frequency) {
self::FREQUENCY_DAILY => [
'fromDate' => $now->copy()->subDay()->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_WEEKLY => [
'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_MONTHLY => [
'fromDate' => $now->copy()->subMonths(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_QUARTERLY => [
'fromDate' => $now->copy()->subMonths(3)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
default => throw new InvalidArgumentException("Unsupported frequency: {$frequency}"),
};
}
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 sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
private function getPayload(AutomatedReportsService $automatedReportsService)
{
$reportResult = AutomatedReportResult::find(269);
$automatedReport = $reportResult->getReport();
$activityIds = [1,2,3];
$payload = $automatedReportsService->getAskJiminnyGenerateReportPayload(
automatedReport: $automatedReport,
reportResult: $reportResult,
activityIds: $activityIds,
);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$payload ' . PHP_EOL . print_r($payload, true));
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
7
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Services\UserPilot;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Support\Facades\Http;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Partner;
use Jiminny\Models\Team;
use Jiminny\Models\User;
class UserPilotClient
{
private const API_ENDPOINT = 'https://api.userpilot.io/v1/';
private const ANALYTICS_ENDPOINT = 'https://analytex.userpilot.io/v1/';
private function createRequest(): PendingRequest
{
return Http::withHeaders([
'X-API-Version' => '2020-09-22',
'Authorization' => 'Token ' . config('services.userpilot.key'),
]);
}
public function track(User $user, string $event, array $payload = []): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'track', [
'event_name' => $event,
'user_id' => $user->getUuid(),
'metadata' => $payload,
]);
}
public function upsertUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$companyMetadata = $this->getCompanyMetadata($user->getTeam());
$companyMetadata['id'] = $user->getTeam()->getUuid();
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'identify', [
'user_id' => $user->getUuid(),
'metadata' => [
'name' => $user->name,
'first_name' => $user->getFirstName(),
'position' => $user->job ? $user->job->name : null,
'email' => $user->getEmailAddress(),
'created_at' => $user->getCreatedAt()->unix(),
'is_admin' => $user->hasRole(User::ROLE_ADMIN),
'is_manager' => $user->hasRole(User::ROLE_MANAGER),
'is_owner' => $user->isTeamOwner(),
'is_insights' => $user->hasRole(User::ROLE_ANALYST),
'is_recorder' => $user->hasRole(User::ROLE_RECORDER),
'is_jiminny_voice' => $user->hasRole(User::ROLE_RECORDER_AND_VOICE),
'is_listener' => $user->hasRole(User::ROLE_LISTENER),
'license' => null,
'team' => $user->group ? $user->group->name : null,
'language' => $user->getLanguage(),
'email_sync' => $user->isSyncEmailEnabled(),
],
'company' => $companyMetadata,
]);
}
public function upsertCompany(Team $team): void
{
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'companies/identify', [
'company_id' => $team->getUuid(),
'metadata' => $this->getCompanyMetadata($team),
]);
}
private function getCompanyMetadata(Team $team): array
{
return [
'created_at' => $team->getCreatedAt()->unix(),
'name' => $team->getName(),
'region' => config('jiminny.deploy_region'),
'crm' => $team->getCrmConfiguration()->getProviderName(),
'crm_installed_app_version' => $team->getCrmConfiguration()->getInstalledAppVersion(),
'calendar' => $team->getCalendarProvider(),
'notification_provider' => $team->getNotificationProvider(),
'has_jiminny_voice' => $team->hasFeature(FeatureEnum::DIALER),
'tier' => $team->getTier()?->getTitle(),
];
}
public function deleteUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'users', [
'users' => [$user->getUuid()],
]);
}
public function deleteCompany(Team $team): void
{
if ($this->shouldRequest($team) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'companies', [
'companies' => [$team->getUuid()],
]);
}
public function shouldRequest(Team $team): bool
{
return config('services.userpilot.key') !== null && $team->getPartnerId() === Partner::PARTNER_DEFAULT;
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
PhpStorm
|
faVsco.js – JiminnyDebugCommand.php
|
NULL
|
77305
|
|
Pushed JY-20738-debug-AJ-tracking-UP to new branch Pushed JY-20738-debug-AJ-tracking-UP to new branch origin/JY-20738-debug-AJ-tracking-UP
text/html
text/html
text/html
Create pull request
4 files committed
JY-20738 add debug logs on AJ report UP tracking
text/html
text/html
text/html
Edit Commit Message…
Project: faVsco.js, menu
JY-20738-debug-AJ-tracking-UP, menu
Start Listening for PHP Debug Connections
ReportControllerTest
Run 'ReportControllerTest'
Debug 'ReportControllerTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
3
115
4
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use InvalidArgumentException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateAskJiminnyReportJob;
use Jiminny\Jobs\AutomatedReports\SendReportMailJob;
use Jiminny\Jobs\JobDispatcherInterface;
use Jiminny\Models\Activity;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Services\Activity\CrmOwnerResolver;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\UserPilot\UserPilotClient;
/**
* Class JiminnyDebugCommand
*
* @package Jiminny\Console\Commands
*/
class JiminnyDebugCommand extends Command
{
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';
protected $signature = 'jiminny:debug';
public function handle(
JobDispatcherInterface $jobDispatcher,
AutomatedReportsService $automatedReportsService,
AutomatedReportsRepository $automatedReportsRepository,
UserPilotClient $userPilotClient
): void {
$user = User::find(143);
// $count = $automatedReportsRepository->countUserReports($user);
// $this->info("Count: {$count}");
// $count = $automatedReportsRepository->countAllUserReports($user);
// $this->info("All count: {$count}");
$payload = [
'report_type' => 'ask_jiminny',
'frequency' => 'weekly',
];
$userPilotClient->track($user, 'ask-jiminny-report-generated', $payload);
exit(1);
$now = Carbon::now()->subDay(1);
$this->info("Now: {$now->toDateTimeString()}");
$weekStart = Carbon::getWeekStartsAt();
$this->info("Now: {$weekStart}");
// $from = $now->copy()->previousWeekday()->startOfDay();
// $to = $now->copy()->previousWeekday()->endOfDay();
// $fromOld = $now->copy()->subWeeks(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subWeek()->startOfWeek();
// $toNew = $now->copy()->subWeek()->endOfWeek();
// $fromOld = $now->copy()->subMonths(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
// $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
$fromOld = $now->copy()->subMonths(3)->startOfDay();
$toOld = $now->copy()->subDay()->endOfDay();
$fromNew = $now->copy()->subQuarterNoOverflow()->startOfQuarter();
$toNew = $now->copy()->subQuarterNoOverflow()->endOfQuarter();
$this->info("From old: {$fromOld->toDateTimeString()}");
$this->info("To old: {$toOld->toDateTimeString()}");
$this->info("From new: {$fromNew->toDateTimeString()}");
$this->info("To new: {$toNew->toDateTimeString()}");
exit(1);
$report = AutomatedReport::find(71);
$job = new RequestGenerateAskJiminnyReportJob($report->getUuid());
$jobDispatcher->dispatch($job);
exit(1);
// $this->formatDate($jobDispatcher);
// $this->sendMail($jobDispatcher, $automatedReportsService);
// $this->crmService();
$this->getPayload($automatedReportsService);
exit(1);
}
private function crmService()
{
$activity = Activity::find(418141);
$team = Team::find(19);
$config = $team->getCrmConfiguration();
$crmResolver = app(CrmOwnerResolver::class, [
'team' => $team,
'integrationAdmin' => $team->getOwner(),
'providerSlug' => $config->getProviderName(),
]);
$crmService = $crmResolver->prepareCrmService();
$crmService->createTranscriptNotes($activity);
}
private function sendMail(JobDispatcherInterface $jobDispatcher, AutomatedReportsService $automatedReportsService)
{
$reportUuid = '';
// $report = $automatedReportsService->getReportResult($reportUuid);
$report = AutomatedReportResult::find(275);
$validRecipients = $automatedReportsService->getValidRecipientUsers(
$report->getReport(),
includeJiminny: true,
);
$recipient = $validRecipients[0];
$fileName = $automatedReportsService->getReportFileName($report);
$typeName = $report->getReport()->getCustomName()
?? $automatedReportsService->getReportTypeName($report);
$teamsName = $automatedReportsService->getReportTeamsName($report);
$periodName = $automatedReportsService->getReportPeriodName($report);
$s3Path = $automatedReportsService->getMediaPath($report);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$fileName ' . PHP_EOL . print_r($fileName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$typeName ' . PHP_EOL . print_r($typeName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$teamsName ' . PHP_EOL . print_r($teamsName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$periodName ' . PHP_EOL . print_r($periodName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$s3Path ' . PHP_EOL . print_r($s3Path, true));
$jobDispatcher->dispatch(
new SendReportMailJob(
reportUuid: $report->getUuid(),
s3Path: $s3Path,
recipientEmail: $recipient['email'],
recipientName: $recipient['name'] ?? null,
fileName: $fileName,
typeName: $typeName,
teamsName: $teamsName,
periodName: $periodName,
isAskJiminny: true,
)
);
exit(1);
}
private function formatDate(JobDispatcherInterface $jobDispatcher): void
{
$customName = 'Custom report name';
// $frequency = self::FREQUENCY_DAILY;
// $frequency = self::FREQUENCY_WEEKLY;
$frequency = self::FREQUENCY_MONTHLY;
// $frequency = self::FREQUENCY_QUARTERLY;
// $frequency = self::FREQUENCY_ONE_OFF;
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
$periodName = $this->formatReportPeriodName($frequency, $from, $to);
$filenameSuffix = null;
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
$result = $this->sanitizeFileName("{$customName} - {$periodName}");
}
$this->info($result);
}
public function calculateFromAndToDatePeriod(
string $frequency,
?Carbon $fromDate = null,
?Carbon $toDate = null
): array {
if ($frequency === self::FREQUENCY_ONE_OFF) {
return [
'fromDate' => $fromDate,
'toDate' => $toDate,
];
}
$now = Carbon::now();
return match ($frequency) {
self::FREQUENCY_DAILY => [
'fromDate' => $now->copy()->subDay()->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_WEEKLY => [
'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_MONTHLY => [
'fromDate' => $now->copy()->subMonths(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_QUARTERLY => [
'fromDate' => $now->copy()->subMonths(3)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
default => throw new InvalidArgumentException("Unsupported frequency: {$frequency}"),
};
}
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 sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
private function getPayload(AutomatedReportsService $automatedReportsService)
{
$reportResult = AutomatedReportResult::find(269);
$automatedReport = $reportResult->getReport();
$activityIds = [1,2,3];
$payload = $automatedReportsService->getAskJiminnyGenerateReportPayload(
automatedReport: $automatedReport,
reportResult: $reportResult,
activityIds: $activityIds,
);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$payload ' . PHP_EOL . print_r($payload, true));
}
}
Sync Changes
Hide This Notification...
|
PhpStorm
|
faVsco.js – JiminnyDebugCommand.php
|
NULL
|
77306
|
|
4 files committed
JY-20738 add debug logs on AJ re 4 files committed
JY-20738 add debug logs on AJ report UP tracking
text/html
text/html
text/html
Edit Commit Message…
Project: faVsco.js, menu
JY-20738-debug-AJ-tracking-UP, menu
Start Listening for PHP Debug Connections
ReportControllerTest
Run 'ReportControllerTest'
Debug 'ReportControllerTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
3
115
4
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use InvalidArgumentException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateAskJiminnyReportJob;
use Jiminny\Jobs\AutomatedReports\SendReportMailJob;
use Jiminny\Jobs\JobDispatcherInterface;
use Jiminny\Models\Activity;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Services\Activity\CrmOwnerResolver;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\UserPilot\UserPilotClient;
/**
* Class JiminnyDebugCommand
*
* @package Jiminny\Console\Commands
*/
class JiminnyDebugCommand extends Command
{
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';
protected $signature = 'jiminny:debug';
public function handle(
JobDispatcherInterface $jobDispatcher,
AutomatedReportsService $automatedReportsService,
AutomatedReportsRepository $automatedReportsRepository,
UserPilotClient $userPilotClient
): void {
$user = User::find(143);
// $count = $automatedReportsRepository->countUserReports($user);
// $this->info("Count: {$count}");
// $count = $automatedReportsRepository->countAllUserReports($user);
// $this->info("All count: {$count}");
$payload = [
'report_type' => 'ask_jiminny',
'frequency' => 'weekly',
];
$userPilotClient->track($user, 'ask-jiminny-report-generated', $payload);
exit(1);
$now = Carbon::now()->subDay(1);
$this->info("Now: {$now->toDateTimeString()}");
$weekStart = Carbon::getWeekStartsAt();
$this->info("Now: {$weekStart}");
// $from = $now->copy()->previousWeekday()->startOfDay();
// $to = $now->copy()->previousWeekday()->endOfDay();
// $fromOld = $now->copy()->subWeeks(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subWeek()->startOfWeek();
// $toNew = $now->copy()->subWeek()->endOfWeek();
// $fromOld = $now->copy()->subMonths(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
// $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
$fromOld = $now->copy()->subMonths(3)->startOfDay();
$toOld = $now->copy()->subDay()->endOfDay();
$fromNew = $now->copy()->subQuarterNoOverflow()->startOfQuarter();
$toNew = $now->copy()->subQuarterNoOverflow()->endOfQuarter();
$this->info("From old: {$fromOld->toDateTimeString()}");
$this->info("To old: {$toOld->toDateTimeString()}");
$this->info("From new: {$fromNew->toDateTimeString()}");
$this->info("To new: {$toNew->toDateTimeString()}");
exit(1);
$report = AutomatedReport::find(71);
$job = new RequestGenerateAskJiminnyReportJob($report->getUuid());
$jobDispatcher->dispatch($job);
exit(1);
// $this->formatDate($jobDispatcher);
// $this->sendMail($jobDispatcher, $automatedReportsService);
// $this->crmService();
$this->getPayload($automatedReportsService);
exit(1);
}
private function crmService()
{
$activity = Activity::find(418141);
$team = Team::find(19);
$config = $team->getCrmConfiguration();
$crmResolver = app(CrmOwnerResolver::class, [
'team' => $team,
'integrationAdmin' => $team->getOwner(),
'providerSlug' => $config->getProviderName(),
]);
$crmService = $crmResolver->prepareCrmService();
$crmService->createTranscriptNotes($activity);
}
private function sendMail(JobDispatcherInterface $jobDispatcher, AutomatedReportsService $automatedReportsService)
{
$reportUuid = '';
// $report = $automatedReportsService->getReportResult($reportUuid);
$report = AutomatedReportResult::find(275);
$validRecipients = $automatedReportsService->getValidRecipientUsers(
$report->getReport(),
includeJiminny: true,
);
$recipient = $validRecipients[0];
$fileName = $automatedReportsService->getReportFileName($report);
$typeName = $report->getReport()->getCustomName()
?? $automatedReportsService->getReportTypeName($report);
$teamsName = $automatedReportsService->getReportTeamsName($report);
$periodName = $automatedReportsService->getReportPeriodName($report);
$s3Path = $automatedReportsService->getMediaPath($report);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$fileName ' . PHP_EOL . print_r($fileName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$typeName ' . PHP_EOL . print_r($typeName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$teamsName ' . PHP_EOL . print_r($teamsName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$periodName ' . PHP_EOL . print_r($periodName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$s3Path ' . PHP_EOL . print_r($s3Path, true));
$jobDispatcher->dispatch(
new SendReportMailJob(
reportUuid: $report->getUuid(),
s3Path: $s3Path,
recipientEmail: $recipient['email'],
recipientName: $recipient['name'] ?? null,
fileName: $fileName,
typeName: $typeName,
teamsName: $teamsName,
periodName: $periodName,
isAskJiminny: true,
)
);
exit(1);
}
private function formatDate(JobDispatcherInterface $jobDispatcher): void
{
$customName = 'Custom report name';
// $frequency = self::FREQUENCY_DAILY;
// $frequency = self::FREQUENCY_WEEKLY;
$frequency = self::FREQUENCY_MONTHLY;
// $frequency = self::FREQUENCY_QUARTERLY;
// $frequency = self::FREQUENCY_ONE_OFF;
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
$periodName = $this->formatReportPeriodName($frequency, $from, $to);
$filenameSuffix = null;
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
$result = $this->sanitizeFileName("{$customName} - {$periodName}");
}
$this->info($result);
}
public function calculateFromAndToDatePeriod(
string $frequency,
?Carbon $fromDate = null,
?Carbon $toDate = null
): array {
if ($frequency === self::FREQUENCY_ONE_OFF) {
return [
'fromDate' => $fromDate,
'toDate' => $toDate,
];
}
$now = Carbon::now();
return match ($frequency) {
self::FREQUENCY_DAILY => [
'fromDate' => $now->copy()->subDay()->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_WEEKLY => [
'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_MONTHLY => [
'fromDate' => $now->copy()->subMonths(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_QUARTERLY => [
'fromDate' => $now->copy()->subMonths(3)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
default => throw new InvalidArgumentException("Unsupported frequency: {$frequency}"),
};
}
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 sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
private function getPayload(AutomatedReportsService $automatedReportsService)
{
$reportResult = AutomatedReportResult::find(269);
$automatedReport = $reportResult->getReport();
$activityIds = [1,2,3];
$payload = $automatedReportsService->getAskJiminnyGenerateReportPayload(
automatedReport: $automatedReport,
reportResult: $reportResult,
activityIds: $activityIds,
);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$payload ' . PHP_EOL . print_r($payload, true));
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
7
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Services\UserPilot;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Support\Facades\Http;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Partner;
use Jiminny\Models\Team;
use Jiminny\Models\User;
class UserPilotClient
{
private const API_ENDPOINT = 'https://api.userpilot.io/v1/';
private const ANALYTICS_ENDPOINT = 'https://analytex.userpilot.io/v1/';
private function createRequest(): PendingRequest
{
return Http::withHeaders([
'X-API-Version' => '2020-09-22',
'Authorization' => 'Token ' . config('services.userpilot.key'),
]);
}
public function track(User $user, string $event, array $payload = []): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'track', [
'event_name' => $event,
'user_id' => $user->getUuid(),
'metadata' => $payload,
]);
}
public function upsertUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$companyMetadata = $this->getCompanyMetadata($user->getTeam());
$companyMetadata['id'] = $user->getTeam()->getUuid();
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'identify', [
'user_id' => $user->getUuid(),
'metadata' => [
'name' => $user->name,
'first_name' => $user->getFirstName(),
'position' => $user->job ? $user->job->name : null,
'email' => $user->getEmailAddress(),
'created_at' => $user->getCreatedAt()->unix(),
'is_admin' => $user->hasRole(User::ROLE_ADMIN),
'is_manager' => $user->hasRole(User::ROLE_MANAGER),
'is_owner' => $user->isTeamOwner(),
'is_insights' => $user->hasRole(User::ROLE_ANALYST),
'is_recorder' => $user->hasRole(User::ROLE_RECORDER),
'is_jiminny_voice' => $user->hasRole(User::ROLE_RECORDER_AND_VOICE),
'is_listener' => $user->hasRole(User::ROLE_LISTENER),
'license' => null,
'team' => $user->group ? $user->group->name : null,
'language' => $user->getLanguage(),
'email_sync' => $user->isSyncEmailEnabled(),
],
'company' => $companyMetadata,
]);
}
public function upsertCompany(Team $team): void
{
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'companies/identify', [
'company_id' => $team->getUuid(),
'metadata' => $this->getCompanyMetadata($team),
]);
}
private function getCompanyMetadata(Team $team): array
{
return [
'created_at' => $team->getCreatedAt()->unix(),
'name' => $team->getName(),
'region' => config('jiminny.deploy_region'),
'crm' => $team->getCrmConfiguration()->getProviderName(),
'crm_installed_app_version' => $team->getCrmConfiguration()->getInstalledAppVersion(),
'calendar' => $team->getCalendarProvider(),
'notification_provider' => $team->getNotificationProvider(),
'has_jiminny_voice' => $team->hasFeature(FeatureEnum::DIALER),
'tier' => $team->getTier()?->getTitle(),
];
}
public function deleteUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'users', [
'users' => [$user->getUuid()],
]);
}
public function deleteCompany(Team $team): void
{
if ($this->shouldRequest($team) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'companies', [
'companies' => [$team->getUuid()],
]);
}
public function shouldRequest(Team $team): bool
{
return config('services.userpilot.key') !== null && $team->getPartnerId() === Partner::PARTNER_DEFAULT;
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
PhpStorm
|
faVsco.js – JiminnyDebugCommand.php
|
NULL
|
77307
|
|
4 files committed
JY-20738 add debug logs on AJ re 4 files committed
JY-20738 add debug logs on AJ report UP tracking
text/html
text/html
text/html
Edit Commit Message…
Project: faVsco.js, menu
JY-20738-debug-AJ-tracking-UP, menu
Start Listening for PHP Debug Connections
ReportControllerTest
Run 'ReportControllerTest'
Debug 'ReportControllerTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
3
115
4
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use InvalidArgumentException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateAskJiminnyReportJob;
use Jiminny\Jobs\AutomatedReports\SendReportMailJob;
use Jiminny\Jobs\JobDispatcherInterface;
use Jiminny\Models\Activity;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Services\Activity\CrmOwnerResolver;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\UserPilot\UserPilotClient;
/**
* Class JiminnyDebugCommand
*
* @package Jiminny\Console\Commands
*/
class JiminnyDebugCommand extends Command
{
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';
protected $signature = 'jiminny:debug';
public function handle(
JobDispatcherInterface $jobDispatcher,
AutomatedReportsService $automatedReportsService,
AutomatedReportsRepository $automatedReportsRepository,
UserPilotClient $userPilotClient
): void {
$user = User::find(143);
// $count = $automatedReportsRepository->countUserReports($user);
// $this->info("Count: {$count}");
// $count = $automatedReportsRepository->countAllUserReports($user);
// $this->info("All count: {$count}");
$payload = [
'report_type' => 'ask_jiminny',
'frequency' => 'weekly',
];
$userPilotClient->track($user, 'ask-jiminny-report-generated', $payload);
exit(1);
$now = Carbon::now()->subDay(1);
$this->info("Now: {$now->toDateTimeString()}");
$weekStart = Carbon::getWeekStartsAt();
$this->info("Now: {$weekStart}");
// $from = $now->copy()->previousWeekday()->startOfDay();
// $to = $now->copy()->previousWeekday()->endOfDay();
// $fromOld = $now->copy()->subWeeks(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subWeek()->startOfWeek();
// $toNew = $now->copy()->subWeek()->endOfWeek();
// $fromOld = $now->copy()->subMonths(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
// $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
$fromOld = $now->copy()->subMonths(3)->startOfDay();
$toOld = $now->copy()->subDay()->endOfDay();
$fromNew = $now->copy()->subQuarterNoOverflow()->startOfQuarter();
$toNew = $now->copy()->subQuarterNoOverflow()->endOfQuarter();
$this->info("From old: {$fromOld->toDateTimeString()}");
$this->info("To old: {$toOld->toDateTimeString()}");
$this->info("From new: {$fromNew->toDateTimeString()}");
$this->info("To new: {$toNew->toDateTimeString()}");
exit(1);
$report = AutomatedReport::find(71);
$job = new RequestGenerateAskJiminnyReportJob($report->getUuid());
$jobDispatcher->dispatch($job);
exit(1);
// $this->formatDate($jobDispatcher);
// $this->sendMail($jobDispatcher, $automatedReportsService);
// $this->crmService();
$this->getPayload($automatedReportsService);
exit(1);
}
private function crmService()
{
$activity = Activity::find(418141);
$team = Team::find(19);
$config = $team->getCrmConfiguration();
$crmResolver = app(CrmOwnerResolver::class, [
'team' => $team,
'integrationAdmin' => $team->getOwner(),
'providerSlug' => $config->getProviderName(),
]);
$crmService = $crmResolver->prepareCrmService();
$crmService->createTranscriptNotes($activity);
}
private function sendMail(JobDispatcherInterface $jobDispatcher, AutomatedReportsService $automatedReportsService)
{
$reportUuid = '';
// $report = $automatedReportsService->getReportResult($reportUuid);
$report = AutomatedReportResult::find(275);
$validRecipients = $automatedReportsService->getValidRecipientUsers(
$report->getReport(),
includeJiminny: true,
);
$recipient = $validRecipients[0];
$fileName = $automatedReportsService->getReportFileName($report);
$typeName = $report->getReport()->getCustomName()
?? $automatedReportsService->getReportTypeName($report);
$teamsName = $automatedReportsService->getReportTeamsName($report);
$periodName = $automatedReportsService->getReportPeriodName($report);
$s3Path = $automatedReportsService->getMediaPath($report);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$fileName ' . PHP_EOL . print_r($fileName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$typeName ' . PHP_EOL . print_r($typeName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$teamsName ' . PHP_EOL . print_r($teamsName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$periodName ' . PHP_EOL . print_r($periodName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$s3Path ' . PHP_EOL . print_r($s3Path, true));
$jobDispatcher->dispatch(
new SendReportMailJob(
reportUuid: $report->getUuid(),
s3Path: $s3Path,
recipientEmail: $recipient['email'],
recipientName: $recipient['name'] ?? null,
fileName: $fileName,
typeName: $typeName,
teamsName: $teamsName,
periodName: $periodName,
isAskJiminny: true,
)
);
exit(1);
}
private function formatDate(JobDispatcherInterface $jobDispatcher): void
{
$customName = 'Custom report name';
// $frequency = self::FREQUENCY_DAILY;
// $frequency = self::FREQUENCY_WEEKLY;
$frequency = self::FREQUENCY_MONTHLY;
// $frequency = self::FREQUENCY_QUARTERLY;
// $frequency = self::FREQUENCY_ONE_OFF;
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
$periodName = $this->formatReportPeriodName($frequency, $from, $to);
$filenameSuffix = null;
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
$result = $this->sanitizeFileName("{$customName} - {$periodName}");
}
$this->info($result);
}
public function calculateFromAndToDatePeriod(
string $frequency,
?Carbon $fromDate = null,
?Carbon $toDate = null
): array {
if ($frequency === self::FREQUENCY_ONE_OFF) {
return [
'fromDate' => $fromDate,
'toDate' => $toDate,
];
}
$now = Carbon::now();
return match ($frequency) {
self::FREQUENCY_DAILY => [
'fromDate' => $now->copy()->subDay()->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_WEEKLY => [
'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_MONTHLY => [
'fromDate' => $now->copy()->subMonths(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_QUARTERLY => [
'fromDate' => $now->copy()->subMonths(3)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
default => throw new InvalidArgumentException("Unsupported frequency: {$frequency}"),
};
}
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 sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
private function getPayload(AutomatedReportsService $automatedReportsService)
{
$reportResult = AutomatedReportResult::find(269);
$automatedReport = $reportResult->getReport();
$activityIds = [1,2,3];
$payload = $automatedReportsService->getAskJiminnyGenerateReportPayload(
automatedReport: $automatedReport,
reportResult: $reportResult,
activityIds: $activityIds,
);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$payload ' . PHP_EOL . print_r($payload, true));
}
}...
|
PhpStorm
|
faVsco.js – JiminnyDebugCommand.php
|
NULL
|
77308
|
|
4 files committed
JY-20738 add debug logs on AJ re 4 files committed
JY-20738 add debug logs on AJ report UP tracking
text/html
text/html
text/html
Edit Commit Message…
Project: faVsco.js, menu
JY-20738-debug-AJ-tracking-UP, menu
Start Listening for PHP Debug Connections
ReportControllerTest
Run 'ReportControllerTest'
Debug 'ReportControllerTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
3
115
4
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use InvalidArgumentException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateAskJiminnyReportJob;
use Jiminny\Jobs\AutomatedReports\SendReportMailJob;
use Jiminny\Jobs\JobDispatcherInterface;
use Jiminny\Models\Activity;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Services\Activity\CrmOwnerResolver;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\UserPilot\UserPilotClient;
/**
* Class JiminnyDebugCommand
*
* @package Jiminny\Console\Commands
*/
class JiminnyDebugCommand extends Command
{
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';
protected $signature = 'jiminny:debug';
public function handle(
JobDispatcherInterface $jobDispatcher,
AutomatedReportsService $automatedReportsService,
AutomatedReportsRepository $automatedReportsRepository,
UserPilotClient $userPilotClient
): void {
$user = User::find(143);
// $count = $automatedReportsRepository->countUserReports($user);
// $this->info("Count: {$count}");
// $count = $automatedReportsRepository->countAllUserReports($user);
// $this->info("All count: {$count}");
$payload = [
'report_type' => 'ask_jiminny',
'frequency' => 'weekly',
];
$userPilotClient->track($user, 'ask-jiminny-report-generated', $payload);
exit(1);
$now = Carbon::now()->subDay(1);
$this->info("Now: {$now->toDateTimeString()}");
$weekStart = Carbon::getWeekStartsAt();
$this->info("Now: {$weekStart}");
// $from = $now->copy()->previousWeekday()->startOfDay();
// $to = $now->copy()->previousWeekday()->endOfDay();
// $fromOld = $now->copy()->subWeeks(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subWeek()->startOfWeek();
// $toNew = $now->copy()->subWeek()->endOfWeek();
// $fromOld = $now->copy()->subMonths(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
// $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
$fromOld = $now->copy()->subMonths(3)->startOfDay();
$toOld = $now->copy()->subDay()->endOfDay();
$fromNew = $now->copy()->subQuarterNoOverflow()->startOfQuarter();
$toNew = $now->copy()->subQuarterNoOverflow()->endOfQuarter();
$this->info("From old: {$fromOld->toDateTimeString()}");
$this->info("To old: {$toOld->toDateTimeString()}");
$this->info("From new: {$fromNew->toDateTimeString()}");
$this->info("To new: {$toNew->toDateTimeString()}");
exit(1);
$report = AutomatedReport::find(71);
$job = new RequestGenerateAskJiminnyReportJob($report->getUuid());
$jobDispatcher->dispatch($job);
exit(1);
// $this->formatDate($jobDispatcher);
// $this->sendMail($jobDispatcher, $automatedReportsService);
// $this->crmService();
$this->getPayload($automatedReportsService);
exit(1);
}
private function crmService()
{
$activity = Activity::find(418141);
$team = Team::find(19);
$config = $team->getCrmConfiguration();
$crmResolver = app(CrmOwnerResolver::class, [
'team' => $team,
'integrationAdmin' => $team->getOwner(),
'providerSlug' => $config->getProviderName(),
]);
$crmService = $crmResolver->prepareCrmService();
$crmService->createTranscriptNotes($activity);
}
private function sendMail(JobDispatcherInterface $jobDispatcher, AutomatedReportsService $automatedReportsService)
{
$reportUuid = '';
// $report = $automatedReportsService->getReportResult($reportUuid);
$report = AutomatedReportResult::find(275);
$validRecipients = $automatedReportsService->getValidRecipientUsers(
$report->getReport(),
includeJiminny: true,
);
$recipient = $validRecipients[0];
$fileName = $automatedReportsService->getReportFileName($report);
$typeName = $report->getReport()->getCustomName()
?? $automatedReportsService->getReportTypeName($report);
$teamsName = $automatedReportsService->getReportTeamsName($report);
$periodName = $automatedReportsService->getReportPeriodName($report);
$s3Path = $automatedReportsService->getMediaPath($report);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$fileName ' . PHP_EOL . print_r($fileName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$typeName ' . PHP_EOL . print_r($typeName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$teamsName ' . PHP_EOL . print_r($teamsName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$periodName ' . PHP_EOL . print_r($periodName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$s3Path ' . PHP_EOL . print_r($s3Path, true));
$jobDispatcher->dispatch(
new SendReportMailJob(
reportUuid: $report->getUuid(),
s3Path: $s3Path,
recipientEmail: $recipient['email'],
recipientName: $recipient['name'] ?? null,
fileName: $fileName,
typeName: $typeName,
teamsName: $teamsName,
periodName: $periodName,
isAskJiminny: true,
)
);
exit(1);
}
private function formatDate(JobDispatcherInterface $jobDispatcher): void
{
$customName = 'Custom report name';
// $frequency = self::FREQUENCY_DAILY;
// $frequency = self::FREQUENCY_WEEKLY;
$frequency = self::FREQUENCY_MONTHLY;
// $frequency = self::FREQUENCY_QUARTERLY;
// $frequency = self::FREQUENCY_ONE_OFF;
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
$periodName = $this->formatReportPeriodName($frequency, $from, $to);
$filenameSuffix = null;
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
$result = $this->sanitizeFileName("{$customName} - {$periodName}");
}
$this->info($result);
}
public function calculateFromAndToDatePeriod(
string $frequency,
?Carbon $fromDate = null,
?Carbon $toDate = null
): array {
if ($frequency === self::FREQUENCY_ONE_OFF) {
return [
'fromDate' => $fromDate,
'toDate' => $toDate,
];
}
$now = Carbon::now();
return match ($frequency) {
self::FREQUENCY_DAILY => [
'fromDate' => $now->copy()->subDay()->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_WEEKLY => [
'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_MONTHLY => [
'fromDate' => $now->copy()->subMonths(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_QUARTERLY => [
'fromDate' => $now->copy()->subMonths(3)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
default => throw new InvalidArgumentException("Unsupported frequency: {$frequency}"),
};
}
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 sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
private function getPayload(AutomatedReportsService $automatedReportsService)
{
$reportResult = AutomatedReportResult::find(269);
$automatedReport = $reportResult->getReport();
$activityIds = [1,2,3];
$payload = $automatedReportsService->getAskJiminnyGenerateReportPayload(
automatedReport: $automatedReport,
reportResult: $reportResult,
activityIds: $activityIds,
);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$payload ' . PHP_EOL . print_r($payload, true));
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
7
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Services\UserPilot;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Support\Facades\Http;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Partner;
use Jiminny\Models\Team;
use Jiminny\Models\User;
class UserPilotClient
{
private const API_ENDPOINT = 'https://api.userpilot.io/v1/';
private const ANALYTICS_ENDPOINT = 'https://analytex.userpilot.io/v1/';
private function createRequest(): PendingRequest
{
return Http::withHeaders([
'X-API-Version' => '2020-09-22',
'Authorization' => 'Token ' . config('services.userpilot.key'),
]);
}
public function track(User $user, string $event, array $payload = []): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'track', [
'event_name' => $event,
'user_id' => $user->getUuid(),
'metadata' => $payload,
]);
}
public function upsertUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$companyMetadata = $this->getCompanyMetadata($user->getTeam());
$companyMetadata['id'] = $user->getTeam()->getUuid();
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'identify', [
'user_id' => $user->getUuid(),
'metadata' => [
'name' => $user->name,
'first_name' => $user->getFirstName(),
'position' => $user->job ? $user->job->name : null,
'email' => $user->getEmailAddress(),
'created_at' => $user->getCreatedAt()->unix(),
'is_admin' => $user->hasRole(User::ROLE_ADMIN),
'is_manager' => $user->hasRole(User::ROLE_MANAGER),
'is_owner' => $user->isTeamOwner(),
'is_insights' => $user->hasRole(User::ROLE_ANALYST),
'is_recorder' => $user->hasRole(User::ROLE_RECORDER),
'is_jiminny_voice' => $user->hasRole(User::ROLE_RECORDER_AND_VOICE),
'is_listener' => $user->hasRole(User::ROLE_LISTENER),
'license' => null,
'team' => $user->group ? $user->group->name : null,
'language' => $user->getLanguage(),
'email_sync' => $user->isSyncEmailEnabled(),
],
'company' => $companyMetadata,
]);
}
public function upsertCompany(Team $team): void
{
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'companies/identify', [
'company_id' => $team->getUuid(),
'metadata' => $this->getCompanyMetadata($team),
]);
}
private function getCompanyMetadata(Team $team): array
{
return [
'created_at' => $team->getCreatedAt()->unix(),
'name' => $team->getName(),
'region' => config('jiminny.deploy_region'),
'crm' => $team->getCrmConfiguration()->getProviderName(),
'crm_installed_app_version' => $team->getCrmConfiguration()->getInstalledAppVersion(),
'calendar' => $team->getCalendarProvider(),
'notification_provider' => $team->getNotificationProvider(),
'has_jiminny_voice' => $team->hasFeature(FeatureEnum::DIALER),
'tier' => $team->getTier()?->getTitle(),
];
}
public function deleteUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'users', [
'users' => [$user->getUuid()],
]);
}
public function deleteCompany(Team $team): void
{
if ($this->shouldRequest($team) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'companies', [
'companies' => [$team->getUuid()],
]);
}
public function shouldRequest(Team $team): bool
{
return config('services.userpilot.key') !== null && $team->getPartnerId() === Partner::PARTNER_DEFAULT;
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
PhpStorm
|
faVsco.js – JiminnyDebugCommand.php
|
NULL
|
77309
|
|
Project: faVsco.js, menu
JY-20738-debug-AJ-trackin Project: faVsco.js, menu
JY-20738-debug-AJ-tracking-UP, menu
Start Listening for PHP Debug Connections
ReportControllerTest
Run 'ReportControllerTest'
Debug 'ReportControllerTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
3
115
4
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use InvalidArgumentException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateAskJiminnyReportJob;
use Jiminny\Jobs\AutomatedReports\SendReportMailJob;
use Jiminny\Jobs\JobDispatcherInterface;
use Jiminny\Models\Activity;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Services\Activity\CrmOwnerResolver;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\UserPilot\UserPilotClient;
/**
* Class JiminnyDebugCommand
*
* @package Jiminny\Console\Commands
*/
class JiminnyDebugCommand extends Command
{
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';
protected $signature = 'jiminny:debug';
public function handle(
JobDispatcherInterface $jobDispatcher,
AutomatedReportsService $automatedReportsService,
AutomatedReportsRepository $automatedReportsRepository,
UserPilotClient $userPilotClient
): void {
$user = User::find(143);
// $count = $automatedReportsRepository->countUserReports($user);
// $this->info("Count: {$count}");
// $count = $automatedReportsRepository->countAllUserReports($user);
// $this->info("All count: {$count}");
$payload = [
'report_type' => 'ask_jiminny',
'frequency' => 'weekly',
];
$userPilotClient->track($user, 'ask-jiminny-report-generated', $payload);
exit(1);
$now = Carbon::now()->subDay(1);
$this->info("Now: {$now->toDateTimeString()}");
$weekStart = Carbon::getWeekStartsAt();
$this->info("Now: {$weekStart}");
// $from = $now->copy()->previousWeekday()->startOfDay();
// $to = $now->copy()->previousWeekday()->endOfDay();
// $fromOld = $now->copy()->subWeeks(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subWeek()->startOfWeek();
// $toNew = $now->copy()->subWeek()->endOfWeek();
// $fromOld = $now->copy()->subMonths(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
// $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
$fromOld = $now->copy()->subMonths(3)->startOfDay();
$toOld = $now->copy()->subDay()->endOfDay();
$fromNew = $now->copy()->subQuarterNoOverflow()->startOfQuarter();
$toNew = $now->copy()->subQuarterNoOverflow()->endOfQuarter();
$this->info("From old: {$fromOld->toDateTimeString()}");
$this->info("To old: {$toOld->toDateTimeString()}");
$this->info("From new: {$fromNew->toDateTimeString()}");
$this->info("To new: {$toNew->toDateTimeString()}");
exit(1);
$report = AutomatedReport::find(71);
$job = new RequestGenerateAskJiminnyReportJob($report->getUuid());
$jobDispatcher->dispatch($job);
exit(1);
// $this->formatDate($jobDispatcher);
// $this->sendMail($jobDispatcher, $automatedReportsService);
// $this->crmService();
$this->getPayload($automatedReportsService);
exit(1);
}
private function crmService()
{
$activity = Activity::find(418141);
$team = Team::find(19);
$config = $team->getCrmConfiguration();
$crmResolver = app(CrmOwnerResolver::class, [
'team' => $team,
'integrationAdmin' => $team->getOwner(),
'providerSlug' => $config->getProviderName(),
]);
$crmService = $crmResolver->prepareCrmService();
$crmService->createTranscriptNotes($activity);
}
private function sendMail(JobDispatcherInterface $jobDispatcher, AutomatedReportsService $automatedReportsService)
{
$reportUuid = '';
// $report = $automatedReportsService->getReportResult($reportUuid);
$report = AutomatedReportResult::find(275);
$validRecipients = $automatedReportsService->getValidRecipientUsers(
$report->getReport(),
includeJiminny: true,
);
$recipient = $validRecipients[0];
$fileName = $automatedReportsService->getReportFileName($report);
$typeName = $report->getReport()->getCustomName()
?? $automatedReportsService->getReportTypeName($report);
$teamsName = $automatedReportsService->getReportTeamsName($report);
$periodName = $automatedReportsService->getReportPeriodName($report);
$s3Path = $automatedReportsService->getMediaPath($report);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$fileName ' . PHP_EOL . print_r($fileName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$typeName ' . PHP_EOL . print_r($typeName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$teamsName ' . PHP_EOL . print_r($teamsName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$periodName ' . PHP_EOL . print_r($periodName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$s3Path ' . PHP_EOL . print_r($s3Path, true));
$jobDispatcher->dispatch(
new SendReportMailJob(
reportUuid: $report->getUuid(),
s3Path: $s3Path,
recipientEmail: $recipient['email'],
recipientName: $recipient['name'] ?? null,
fileName: $fileName,
typeName: $typeName,
teamsName: $teamsName,
periodName: $periodName,
isAskJiminny: true,
)
);
exit(1);
}
private function formatDate(JobDispatcherInterface $jobDispatcher): void
{
$customName = 'Custom report name';
// $frequency = self::FREQUENCY_DAILY;
// $frequency = self::FREQUENCY_WEEKLY;
$frequency = self::FREQUENCY_MONTHLY;
// $frequency = self::FREQUENCY_QUARTERLY;
// $frequency = self::FREQUENCY_ONE_OFF;
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
$periodName = $this->formatReportPeriodName($frequency, $from, $to);
$filenameSuffix = null;
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
$result = $this->sanitizeFileName("{$customName} - {$periodName}");
}
$this->info($result);
}
public function calculateFromAndToDatePeriod(
string $frequency,
?Carbon $fromDate = null,
?Carbon $toDate = null
): array {
if ($frequency === self::FREQUENCY_ONE_OFF) {
return [
'fromDate' => $fromDate,
'toDate' => $toDate,
];
}
$now = Carbon::now();
return match ($frequency) {
self::FREQUENCY_DAILY => [
'fromDate' => $now->copy()->subDay()->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_WEEKLY => [
'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_MONTHLY => [
'fromDate' => $now->copy()->subMonths(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_QUARTERLY => [
'fromDate' => $now->copy()->subMonths(3)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
default => throw new InvalidArgumentException("Unsupported frequency: {$frequency}"),
};
}
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 sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
private function getPayload(AutomatedReportsService $automatedReportsService)
{
$reportResult = AutomatedReportResult::find(269);
$automatedReport = $reportResult->getReport();
$activityIds = [1,2,3];
$payload = $automatedReportsService->getAskJiminnyGenerateReportPayload(
automatedReport: $automatedReport,
reportResult: $reportResult,
activityIds: $activityIds,
);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$payload ' . PHP_EOL . print_r($payload, true));
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
7
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Services\UserPilot;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Support\Facades\Http;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Partner;
use Jiminny\Models\Team;
use Jiminny\Models\User;
class UserPilotClient
{
private const API_ENDPOINT = 'https://api.userpilot.io/v1/';
private const ANALYTICS_ENDPOINT = 'https://analytex.userpilot.io/v1/';
private function createRequest(): PendingRequest
{
return Http::withHeaders([
'X-API-Version' => '2020-09-22',
'Authorization' => 'Token ' . config('services.userpilot.key'),
]);
}
public function track(User $user, string $event, array $payload = []): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'track', [
'event_name' => $event,
'user_id' => $user->getUuid(),
'metadata' => $payload,
]);
}
public function upsertUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$companyMetadata = $this->getCompanyMetadata($user->getTeam());
$companyMetadata['id'] = $user->getTeam()->getUuid();
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'identify', [
'user_id' => $user->getUuid(),
'metadata' => [
'name' => $user->name,
'first_name' => $user->getFirstName(),
'position' => $user->job ? $user->job->name : null,
'email' => $user->getEmailAddress(),
'created_at' => $user->getCreatedAt()->unix(),
'is_admin' => $user->hasRole(User::ROLE_ADMIN),
'is_manager' => $user->hasRole(User::ROLE_MANAGER),
'is_owner' => $user->isTeamOwner(),
'is_insights' => $user->hasRole(User::ROLE_ANALYST),
'is_recorder' => $user->hasRole(User::ROLE_RECORDER),
'is_jiminny_voice' => $user->hasRole(User::ROLE_RECORDER_AND_VOICE),
'is_listener' => $user->hasRole(User::ROLE_LISTENER),
'license' => null,
'team' => $user->group ? $user->group->name : null,
'language' => $user->getLanguage(),
'email_sync' => $user->isSyncEmailEnabled(),
],
'company' => $companyMetadata,
]);
}
public function upsertCompany(Team $team): void
{
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'companies/identify', [
'company_id' => $team->getUuid(),
'metadata' => $this->getCompanyMetadata($team),
]);
}
private function getCompanyMetadata(Team $team): array
{
return [
'created_at' => $team->getCreatedAt()->unix(),
'name' => $team->getName(),
'region' => config('jiminny.deploy_region'),
'crm' => $team->getCrmConfiguration()->getProviderName(),
'crm_installed_app_version' => $team->getCrmConfiguration()->getInstalledAppVersion(),
'calendar' => $team->getCalendarProvider(),
'notification_provider' => $team->getNotificationProvider(),
'has_jiminny_voice' => $team->hasFeature(FeatureEnum::DIALER),
'tier' => $team->getTier()?->getTitle(),
];
}
public function deleteUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'users', [
'users' => [$user->getUuid()],
]);
}
public function deleteCompany(Team $team): void
{
if ($this->shouldRequest($team) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'companies', [
'companies' => [$team->getUuid()],
]);
}
public function shouldRequest(Team $team): bool
{
return config('services.userpilot.key') !== null && $team->getPartnerId() === Partner::PARTNER_DEFAULT;
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
PhpStorm
|
faVsco.js – JiminnyDebugCommand.php
|
NULL
|
77310
|
|
Project: faVsco.js, menu
JY-20738-debug-AJ-trackin Project: faVsco.js, menu
JY-20738-debug-AJ-tracking-UP, menu
Start Listening for PHP Debug Connections
ReportControllerTest
Run 'ReportControllerTest'
Debug 'ReportControllerTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
3
115
4
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use InvalidArgumentException;
use Jiminny\Jobs\AutomatedReports\RequestGenerateAskJiminnyReportJob;
use Jiminny\Jobs\AutomatedReports\SendReportMailJob;
use Jiminny\Jobs\JobDispatcherInterface;
use Jiminny\Models\Activity;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Models\Team;
use Jiminny\Models\User;
use Jiminny\Repositories\AutomatedReportsRepository;
use Jiminny\Services\Activity\CrmOwnerResolver;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Jiminny\Services\UserPilot\UserPilotClient;
/**
* Class JiminnyDebugCommand
*
* @package Jiminny\Console\Commands
*/
class JiminnyDebugCommand extends Command
{
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';
protected $signature = 'jiminny:debug';
public function handle(
JobDispatcherInterface $jobDispatcher,
AutomatedReportsService $automatedReportsService,
AutomatedReportsRepository $automatedReportsRepository,
UserPilotClient $userPilotClient
): void {
$user = User::find(143);
// $count = $automatedReportsRepository->countUserReports($user);
// $this->info("Count: {$count}");
// $count = $automatedReportsRepository->countAllUserReports($user);
// $this->info("All count: {$count}");
$payload = [
'report_type' => 'ask_jiminny',
'frequency' => 'weekly',
];
$userPilotClient->track($user, 'ask-jiminny-report-generated', $payload);
exit(1);
$now = Carbon::now()->subDay(1);
$this->info("Now: {$now->toDateTimeString()}");
$weekStart = Carbon::getWeekStartsAt();
$this->info("Now: {$weekStart}");
// $from = $now->copy()->previousWeekday()->startOfDay();
// $to = $now->copy()->previousWeekday()->endOfDay();
// $fromOld = $now->copy()->subWeeks(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subWeek()->startOfWeek();
// $toNew = $now->copy()->subWeek()->endOfWeek();
// $fromOld = $now->copy()->subMonths(1)->startOfDay();
// $toOld = $now->copy()->subDay()->endOfDay();
// $fromNew = $now->copy()->subMonthNoOverflow()->startOfMonth();
// $toNew = $now->copy()->subMonthNoOverflow()->endOfMonth();
$fromOld = $now->copy()->subMonths(3)->startOfDay();
$toOld = $now->copy()->subDay()->endOfDay();
$fromNew = $now->copy()->subQuarterNoOverflow()->startOfQuarter();
$toNew = $now->copy()->subQuarterNoOverflow()->endOfQuarter();
$this->info("From old: {$fromOld->toDateTimeString()}");
$this->info("To old: {$toOld->toDateTimeString()}");
$this->info("From new: {$fromNew->toDateTimeString()}");
$this->info("To new: {$toNew->toDateTimeString()}");
exit(1);
$report = AutomatedReport::find(71);
$job = new RequestGenerateAskJiminnyReportJob($report->getUuid());
$jobDispatcher->dispatch($job);
exit(1);
// $this->formatDate($jobDispatcher);
// $this->sendMail($jobDispatcher, $automatedReportsService);
// $this->crmService();
$this->getPayload($automatedReportsService);
exit(1);
}
private function crmService()
{
$activity = Activity::find(418141);
$team = Team::find(19);
$config = $team->getCrmConfiguration();
$crmResolver = app(CrmOwnerResolver::class, [
'team' => $team,
'integrationAdmin' => $team->getOwner(),
'providerSlug' => $config->getProviderName(),
]);
$crmService = $crmResolver->prepareCrmService();
$crmService->createTranscriptNotes($activity);
}
private function sendMail(JobDispatcherInterface $jobDispatcher, AutomatedReportsService $automatedReportsService)
{
$reportUuid = '';
// $report = $automatedReportsService->getReportResult($reportUuid);
$report = AutomatedReportResult::find(275);
$validRecipients = $automatedReportsService->getValidRecipientUsers(
$report->getReport(),
includeJiminny: true,
);
$recipient = $validRecipients[0];
$fileName = $automatedReportsService->getReportFileName($report);
$typeName = $report->getReport()->getCustomName()
?? $automatedReportsService->getReportTypeName($report);
$teamsName = $automatedReportsService->getReportTeamsName($report);
$periodName = $automatedReportsService->getReportPeriodName($report);
$s3Path = $automatedReportsService->getMediaPath($report);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$fileName ' . PHP_EOL . print_r($fileName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$typeName ' . PHP_EOL . print_r($typeName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$teamsName ' . PHP_EOL . print_r($teamsName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$periodName ' . PHP_EOL . print_r($periodName, true));
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$s3Path ' . PHP_EOL . print_r($s3Path, true));
$jobDispatcher->dispatch(
new SendReportMailJob(
reportUuid: $report->getUuid(),
s3Path: $s3Path,
recipientEmail: $recipient['email'],
recipientName: $recipient['name'] ?? null,
fileName: $fileName,
typeName: $typeName,
teamsName: $teamsName,
periodName: $periodName,
isAskJiminny: true,
)
);
exit(1);
}
private function formatDate(JobDispatcherInterface $jobDispatcher): void
{
$customName = 'Custom report name';
// $frequency = self::FREQUENCY_DAILY;
// $frequency = self::FREQUENCY_WEEKLY;
$frequency = self::FREQUENCY_MONTHLY;
// $frequency = self::FREQUENCY_QUARTERLY;
// $frequency = self::FREQUENCY_ONE_OFF;
$period = $this->calculateFromAndToDatePeriod($frequency);
$from = $period['fromDate'];
$to = $period['toDate'];
$periodName = $this->formatReportPeriodName($frequency, $from, $to);
$filenameSuffix = null;
if ($customName) {
if ($filenameSuffix) {
$customName .= " {$filenameSuffix}";
}
$result = $this->sanitizeFileName("{$customName} - {$periodName}");
}
$this->info($result);
}
public function calculateFromAndToDatePeriod(
string $frequency,
?Carbon $fromDate = null,
?Carbon $toDate = null
): array {
if ($frequency === self::FREQUENCY_ONE_OFF) {
return [
'fromDate' => $fromDate,
'toDate' => $toDate,
];
}
$now = Carbon::now();
return match ($frequency) {
self::FREQUENCY_DAILY => [
'fromDate' => $now->copy()->subDay()->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_WEEKLY => [
'fromDate' => $now->copy()->subWeeks(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_MONTHLY => [
'fromDate' => $now->copy()->subMonths(1)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
self::FREQUENCY_QUARTERLY => [
'fromDate' => $now->copy()->subMonths(3)->startOfDay(),
'toDate' => $now->copy()->subDay()->endOfDay(),
],
default => throw new InvalidArgumentException("Unsupported frequency: {$frequency}"),
};
}
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 sanitizeFileName(string $fileName): string
{
return str_replace(['/', '\\'], '-', $fileName);
}
private function getPayload(AutomatedReportsService $automatedReportsService)
{
$reportResult = AutomatedReportResult::find(269);
$automatedReport = $reportResult->getReport();
$activityIds = [1,2,3];
$payload = $automatedReportsService->getAskJiminnyGenerateReportPayload(
automatedReport: $automatedReport,
reportResult: $reportResult,
activityIds: $activityIds,
);
\Illuminate\Support\Facades\Log::channel('custom_channel')->info('$payload ' . PHP_EOL . print_r($payload, true));
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
7
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Services\UserPilot;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Support\Facades\Http;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Partner;
use Jiminny\Models\Team;
use Jiminny\Models\User;
class UserPilotClient
{
private const API_ENDPOINT = 'https://api.userpilot.io/v1/';
private const ANALYTICS_ENDPOINT = 'https://analytex.userpilot.io/v1/';
private function createRequest(): PendingRequest
{
return Http::withHeaders([
'X-API-Version' => '2020-09-22',
'Authorization' => 'Token ' . config('services.userpilot.key'),
]);
}
public function track(User $user, string $event, array $payload = []): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'track', [
'event_name' => $event,
'user_id' => $user->getUuid(),
'metadata' => $payload,
]);
}
public function upsertUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$companyMetadata = $this->getCompanyMetadata($user->getTeam());
$companyMetadata['id'] = $user->getTeam()->getUuid();
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'identify', [
'user_id' => $user->getUuid(),
'metadata' => [
'name' => $user->name,
'first_name' => $user->getFirstName(),
'position' => $user->job ? $user->job->name : null,
'email' => $user->getEmailAddress(),
'created_at' => $user->getCreatedAt()->unix(),
'is_admin' => $user->hasRole(User::ROLE_ADMIN),
'is_manager' => $user->hasRole(User::ROLE_MANAGER),
'is_owner' => $user->isTeamOwner(),
'is_insights' => $user->hasRole(User::ROLE_ANALYST),
'is_recorder' => $user->hasRole(User::ROLE_RECORDER),
'is_jiminny_voice' => $user->hasRole(User::ROLE_RECORDER_AND_VOICE),
'is_listener' => $user->hasRole(User::ROLE_LISTENER),
'license' => null,
'team' => $user->group ? $user->group->name : null,
'language' => $user->getLanguage(),
'email_sync' => $user->isSyncEmailEnabled(),
],
'company' => $companyMetadata,
]);
}
public function upsertCompany(Team $team): void
{
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'companies/identify', [
'company_id' => $team->getUuid(),
'metadata' => $this->getCompanyMetadata($team),
]);
}
private function getCompanyMetadata(Team $team): array
{
return [
'created_at' => $team->getCreatedAt()->unix(),
'name' => $team->getName(),
'region' => config('jiminny.deploy_region'),
'crm' => $team->getCrmConfiguration()->getProviderName(),
'crm_installed_app_version' => $team->getCrmConfiguration()->getInstalledAppVersion(),
'calendar' => $team->getCalendarProvider(),
'notification_provider' => $team->getNotificationProvider(),
'has_jiminny_voice' => $team->hasFeature(FeatureEnum::DIALER),
'tier' => $team->getTier()?->getTitle(),
];
}
public function deleteUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'users', [
'users' => [$user->getUuid()],
]);
}
public function deleteCompany(Team $team): void
{
if ($this->shouldRequest($team) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'companies', [
'companies' => [$team->getUuid()],
]);
}
public function shouldRequest(Team $team): bool
{
return config('services.userpilot.key') !== null && $team->getPartnerId() === Partner::PARTNER_DEFAULT;
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
PhpStorm
|
faVsco.js – JiminnyDebugCommand.php
|
NULL
|
77311
|
|
Project: faVsco.js, menu
JY-20738-debug-AJ-trackin Project: faVsco.js, menu
JY-20738-debug-AJ-tracking-UP, menu
Start Listening for PHP Debug Connections
ReportControllerTest
Run 'ReportControllerTest'
Debug 'ReportControllerTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Code changed:
Hide
Sync Changes
Hide This Notification
2
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Tests\Unit\Http\Controllers\Webhook;
use Illuminate\Contracts\Bus\Dispatcher;
use Illuminate\Contracts\Events\Dispatcher as EventDispatcher;
use Illuminate\Http\Request;
use Jiminny\Events\AutomatedReports\AutomatedReportGenerated;
use Jiminny\Http\Controllers\Webhook\ReportController;
use Jiminny\Jobs\AutomatedReports\SendReportJob;
use Jiminny\Models\AutomatedReport;
use Jiminny\Models\AutomatedReportResult;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsCallbackService;
use Jiminny\Services\Kiosk\AutomatedReports\AutomatedReportsService;
use Mockery;
use Mockery\MockInterface;
use Psr\Log\LoggerInterface;
use Tests\TestCase;
class ReportControllerTest extends TestCase
{
private AutomatedReportsService|MockInterface $reportService;
private Dispatcher|MockInterface $dispatcher;
private LoggerInterface|MockInterface $logger;
private AutomatedReportsCallbackService|MockInterface $callbackService;
private EventDispatcher|MockInterface $eventDispatcher;
private ReportController $controller;
protected function setUp(): void
{
parent::setUp();
$this->reportService = Mockery::mock(AutomatedReportsService::class);
$this->dispatcher = Mockery::mock(Dispatcher::class);
$this->logger = Mockery::mock(LoggerInterface::class);
$this->callbackService = Mockery::mock(AutomatedReportsCallbackService::class);
$this->eventDispatcher = Mockery::mock(EventDispatcher::class);
$this->logger->shouldReceive('info'); // Allow info logs
$this->controller = new ReportController(
$this->reportService,
$this->dispatcher,
$this->logger,
$this->callbackService,
$this->eventDispatcher,
);
}
protected function tearDown(): void
{
Mockery::close();
parent::tearDown();
}
public function testReadyMethodSuccess(): void
{
$reportUuid = 'test-uuid';
$payload = ['request_id' => $reportUuid];
$request = Mockery::mock(Request::class);
$request->shouldReceive('all')->andReturn($payload);
$reportResult = Mockery::mock(AutomatedReportResult::class);
$automatedReport = Mockery::mock(AutomatedReport::class);
$this->callbackService->shouldReceive('getResultUuid')->with($payload)->andReturn($reportUuid);
$this->reportService->shouldReceive('getReportResult')->with($reportUuid)->andReturn($reportResult);
$this->callbackService->shouldReceive('isProcessed')->with($reportResult)->andReturn(false);
$this->reportService->shouldReceive('findChildResult')->andReturn(null);
$this->callbackService->shouldReceive('getPrimaryStatus')->andReturn(AutomatedReportResult::STATUS_GENERATED);
$this->callbackService->shouldReceive('isSuccess')->andReturn(true);
$reportResult->shouldReceive('getReport')->andReturn($automatedReport);
$automatedReport->shouldReceive('getFrequency')->andReturn(AutomatedReportsService::FREQUENCY_ONE_OFF);
$automatedReport->shouldReceive('getUuid')->andReturn('automated-report-uuid');
$reportResult->shouldReceive('update')->once();
$this->dispatcher->shouldReceive('dispatch')->once()->with(Mockery::type(SendReportJob::class));
$this->callbackService->shouldReceive('pushToDatadog')->once();
$this->eventDispatcher->shouldReceive('dispatch')->once()->with(Mockery::type(AutomatedReportGenerated::class));
$response = $this->controller->ready($request);
$this->assertEquals(200, $response->getStatusCode());
$this->assertEquals(['status' => 'ok'], json_decode($response->getContent(), true));
}
public function testReadyMethodWithPodcastSuccess(): void
{
$reportUuid = 'test-uuid';
$payload = ['request_id' => $reportUuid];
$request = Mockery::mock(Request::class);
$request->shouldReceive('all')->andReturn($payload);
$reportResult = Mockery::mock(AutomatedReportResult::class);
$podcastResult = Mockery::mock(AutomatedReportResult::class);
$automatedReport = Mockery::mock(AutomatedReport::class);
$podcastResult->shouldReceive('getUuid')->andReturn('podcast-uuid');
$podcastResult->shouldReceive('getStatus')->andReturn(AutomatedReportResult::STATUS_GENERATED);
$this->callbackService->shouldReceive('getResultUuid')->with($payload)->andReturn($reportUuid);
$this->reportService->shouldReceive('getReportResult')->with($reportUuid)->andReturn($reportResult);
$this->callbackService->shouldReceive('isProcessed')->with($reportResult)->andReturn(false);
$this->reportService->shouldReceive('findChildResult')->andReturn($podcastResult);
$this->callbackService->shouldReceive('getPrimaryStatus')->andReturn(AutomatedReportResult::STATUS_GENERATED);
$this->callbackService->shouldReceive('getPodcastStatus')->andReturn(AutomatedReportResult::STATUS_GENERATED);
$this->callbackService->shouldReceive('isSuccess')->andReturn(true);
$reportResult->shouldReceive('getReport')->andReturn($automatedReport);
$automatedReport->shouldReceive('getFrequency')->andReturn(AutomatedReportsService::FREQUENCY_ONE_OFF);
$automatedReport->shouldReceive('getUuid')->andReturn('automated-report-uuid');
$reportResult->shouldReceive('update')->once();
$podcastResult->shouldReceive('update')->once();
$this->dispatcher->shouldReceive('dispatch')->twice();
$this->callbackService->shouldReceive('pushToDatadog')->twice();
$this->eventDispatcher->shouldReceive('dispatch')->once()->with(Mockery::type(AutomatedReportGenerated::class));
$response = $this->controller->ready($request);
$this->assertEquals(200, $response->getStatusCode());
$this->assertEquals(['status' => 'ok'], json_decode($response->getContent(), true));
}
public function testReadyMethodWithPodcastFailure(): void
{
$reportUuid = 'test-uuid';
$payload = ['request_id' => $reportUuid];
$request = Mockery::mock(Request::class);
$request->shouldReceive('all')->andReturn($payload);
$reportResult = Mockery::mock(AutomatedReportResult::class);
$podcastResult = Mockery::mock(AutomatedReportResult::class);
$podcastResult->shouldReceive('getUuid')->andReturn('podcast-uuid');
$podcastResult->shouldReceive('getStatus')->andReturn(AutomatedReportResult::STATUS_FAILED);
$this->callbackService->shouldReceive('getResultUuid')->with($payload)->andReturn($reportUuid);
$this->reportService->shouldReceive('getReportResult')->with($reportUuid)->andReturn($reportResult);
$this->callbackService->shouldReceive('isProcessed')->with($reportResult)->andReturn(false);
$this->reportService->shouldReceive('findChildResult')->andReturn($podcastResult);
$this->callbackService->shouldReceive('getPrimaryStatus')->andReturn(AutomatedReportResult::STATUS_FAILED);
$this->callbackService->shouldReceive('getPodcastStatus')->andReturn(AutomatedReportResult::STATUS_FAILED);
$this->callbackService->shouldReceive('isSuccess')->andReturn(false);
$reportResult->shouldReceive('update')->once();
$podcastResult->shouldReceive('update')->once();
$this->dispatcher->shouldReceive('dispatch')->never();
$this->callbackService->shouldReceive('pushToDatadog')->never();
$this->logger->shouldReceive('warning')->once();
$response = $this->controller->ready($request);
$this->assertEquals(200, $response->getStatusCode());
$this->assertEquals(['status' => 'ok'], json_decode($response->getContent(), true));
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
7
Previous Highlighted Error
Next Highlighted Error
<?php
namespace Jiminny\Services\UserPilot;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Support\Facades\Http;
use Jiminny\Models\Feature\FeatureEnum;
use Jiminny\Models\Partner;
use Jiminny\Models\Team;
use Jiminny\Models\User;
class UserPilotClient
{
private const API_ENDPOINT = 'https://api.userpilot.io/v1/';
private const ANALYTICS_ENDPOINT = 'https://analytex.userpilot.io/v1/';
private function createRequest(): PendingRequest
{
return Http::withHeaders([
'X-API-Version' => '2020-09-22',
'Authorization' => 'Token ' . config('services.userpilot.key'),
]);
}
public function track(User $user, string $event, array $payload = []): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'track', [
'event_name' => $event,
'user_id' => $user->getUuid(),
'metadata' => $payload,
]);
}
public function upsertUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$companyMetadata = $this->getCompanyMetadata($user->getTeam());
$companyMetadata['id'] = $user->getTeam()->getUuid();
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'identify', [
'user_id' => $user->getUuid(),
'metadata' => [
'name' => $user->name,
'first_name' => $user->getFirstName(),
'position' => $user->job ? $user->job->name : null,
'email' => $user->getEmailAddress(),
'created_at' => $user->getCreatedAt()->unix(),
'is_admin' => $user->hasRole(User::ROLE_ADMIN),
'is_manager' => $user->hasRole(User::ROLE_MANAGER),
'is_owner' => $user->isTeamOwner(),
'is_insights' => $user->hasRole(User::ROLE_ANALYST),
'is_recorder' => $user->hasRole(User::ROLE_RECORDER),
'is_jiminny_voice' => $user->hasRole(User::ROLE_RECORDER_AND_VOICE),
'is_listener' => $user->hasRole(User::ROLE_LISTENER),
'license' => null,
'team' => $user->group ? $user->group->name : null,
'language' => $user->getLanguage(),
'email_sync' => $user->isSyncEmailEnabled(),
],
'company' => $companyMetadata,
]);
}
public function upsertCompany(Team $team): void
{
$this->createRequest()->post(self::ANALYTICS_ENDPOINT . 'companies/identify', [
'company_id' => $team->getUuid(),
'metadata' => $this->getCompanyMetadata($team),
]);
}
private function getCompanyMetadata(Team $team): array
{
return [
'created_at' => $team->getCreatedAt()->unix(),
'name' => $team->getName(),
'region' => config('jiminny.deploy_region'),
'crm' => $team->getCrmConfiguration()->getProviderName(),
'crm_installed_app_version' => $team->getCrmConfiguration()->getInstalledAppVersion(),
'calendar' => $team->getCalendarProvider(),
'notification_provider' => $team->getNotificationProvider(),
'has_jiminny_voice' => $team->hasFeature(FeatureEnum::DIALER),
'tier' => $team->getTier()?->getTitle(),
];
}
public function deleteUser(User $user): void
{
if ($this->shouldRequest($user->getTeam()) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'users', [
'users' => [$user->getUuid()],
]);
}
public function deleteCompany(Team $team): void
{
if ($this->shouldRequest($team) === false) {
return;
}
$this->createRequest()->delete(self::API_ENDPOINT . 'companies', [
'companies' => [$team->getUuid()],
]);
}
public function shouldRequest(Team $team): bool
{
return config('services.userpilot.key') !== null && $team->getPartnerId() === Partner::PARTNER_DEFAULT;
}
}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
PhpStorm
|
faVsco.js – ReportControllerTest.php
|
NULL
|
77312
|